js/src/jit/IonAnalysis.h

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

michael@0 1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
michael@0 2 * vim: set ts=8 sts=4 et sw=4 tw=99:
michael@0 3 * This Source Code Form is subject to the terms of the Mozilla Public
michael@0 4 * License, v. 2.0. If a copy of the MPL was not distributed with this
michael@0 5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
michael@0 6
michael@0 7 #ifndef jit_IonAnalysis_h
michael@0 8 #define jit_IonAnalysis_h
michael@0 9
michael@0 10 #ifdef JS_ION
michael@0 11
michael@0 12 // This file declares various analysis passes that operate on MIR.
michael@0 13
michael@0 14 #include "jit/IonAllocPolicy.h"
michael@0 15 #include "jit/MIR.h"
michael@0 16
michael@0 17 namespace js {
michael@0 18 namespace jit {
michael@0 19
michael@0 20 class MIRGenerator;
michael@0 21 class MIRGraph;
michael@0 22
michael@0 23 bool
michael@0 24 SplitCriticalEdges(MIRGraph &graph);
michael@0 25
michael@0 26 enum Observability {
michael@0 27 ConservativeObservability,
michael@0 28 AggressiveObservability
michael@0 29 };
michael@0 30
michael@0 31 bool
michael@0 32 EliminatePhis(MIRGenerator *mir, MIRGraph &graph, Observability observe);
michael@0 33
michael@0 34 bool
michael@0 35 EliminateDeadResumePointOperands(MIRGenerator *mir, MIRGraph &graph);
michael@0 36
michael@0 37 bool
michael@0 38 EliminateDeadCode(MIRGenerator *mir, MIRGraph &graph);
michael@0 39
michael@0 40 bool
michael@0 41 ApplyTypeInformation(MIRGenerator *mir, MIRGraph &graph);
michael@0 42
michael@0 43 bool
michael@0 44 MakeMRegExpHoistable(MIRGraph &graph);
michael@0 45
michael@0 46 bool
michael@0 47 RenumberBlocks(MIRGraph &graph);
michael@0 48
michael@0 49 bool
michael@0 50 BuildDominatorTree(MIRGraph &graph);
michael@0 51
michael@0 52 bool
michael@0 53 BuildPhiReverseMapping(MIRGraph &graph);
michael@0 54
michael@0 55 void
michael@0 56 AssertBasicGraphCoherency(MIRGraph &graph);
michael@0 57
michael@0 58 void
michael@0 59 AssertGraphCoherency(MIRGraph &graph);
michael@0 60
michael@0 61 void
michael@0 62 AssertExtendedGraphCoherency(MIRGraph &graph);
michael@0 63
michael@0 64 bool
michael@0 65 EliminateRedundantChecks(MIRGraph &graph);
michael@0 66
michael@0 67 bool
michael@0 68 UnsplitEdges(LIRGraph *lir);
michael@0 69
michael@0 70 class MDefinition;
michael@0 71
michael@0 72 // Simple linear sum of the form 'n' or 'x + n'.
michael@0 73 struct SimpleLinearSum
michael@0 74 {
michael@0 75 MDefinition *term;
michael@0 76 int32_t constant;
michael@0 77
michael@0 78 SimpleLinearSum(MDefinition *term, int32_t constant)
michael@0 79 : term(term), constant(constant)
michael@0 80 {}
michael@0 81 };
michael@0 82
michael@0 83 SimpleLinearSum
michael@0 84 ExtractLinearSum(MDefinition *ins);
michael@0 85
michael@0 86 bool
michael@0 87 ExtractLinearInequality(MTest *test, BranchDirection direction,
michael@0 88 SimpleLinearSum *plhs, MDefinition **prhs, bool *plessEqual);
michael@0 89
michael@0 90 struct LinearTerm
michael@0 91 {
michael@0 92 MDefinition *term;
michael@0 93 int32_t scale;
michael@0 94
michael@0 95 LinearTerm(MDefinition *term, int32_t scale)
michael@0 96 : term(term), scale(scale)
michael@0 97 {
michael@0 98 }
michael@0 99 };
michael@0 100
michael@0 101 // General linear sum of the form 'x1*n1 + x2*n2 + ... + n'
michael@0 102 class LinearSum
michael@0 103 {
michael@0 104 public:
michael@0 105 LinearSum(TempAllocator &alloc)
michael@0 106 : terms_(alloc),
michael@0 107 constant_(0)
michael@0 108 {
michael@0 109 }
michael@0 110
michael@0 111 LinearSum(const LinearSum &other)
michael@0 112 : terms_(other.terms_.allocPolicy()),
michael@0 113 constant_(other.constant_)
michael@0 114 {
michael@0 115 terms_.appendAll(other.terms_);
michael@0 116 }
michael@0 117
michael@0 118 bool multiply(int32_t scale);
michael@0 119 bool add(const LinearSum &other);
michael@0 120 bool add(MDefinition *term, int32_t scale);
michael@0 121 bool add(int32_t constant);
michael@0 122
michael@0 123 int32_t constant() const { return constant_; }
michael@0 124 size_t numTerms() const { return terms_.length(); }
michael@0 125 LinearTerm term(size_t i) const { return terms_[i]; }
michael@0 126
michael@0 127 void print(Sprinter &sp) const;
michael@0 128 void dump(FILE *) const;
michael@0 129 void dump() const;
michael@0 130
michael@0 131 private:
michael@0 132 Vector<LinearTerm, 2, IonAllocPolicy> terms_;
michael@0 133 int32_t constant_;
michael@0 134 };
michael@0 135
michael@0 136 bool
michael@0 137 AnalyzeNewScriptProperties(JSContext *cx, JSFunction *fun,
michael@0 138 types::TypeObject *type, HandleObject baseobj,
michael@0 139 Vector<types::TypeNewScript::Initializer> *initializerList);
michael@0 140
michael@0 141 bool
michael@0 142 AnalyzeArgumentsUsage(JSContext *cx, JSScript *script);
michael@0 143
michael@0 144 } // namespace jit
michael@0 145 } // namespace js
michael@0 146
michael@0 147 #endif // JS_ION
michael@0 148
michael@0 149 #endif /* jit_IonAnalysis_h */

mercurial