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.

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

mercurial