Bug 1382973 part 8 - Remove BytecodeAnalysis from IonBuilder and ControlFlowGenerator. r=nbp
authorJan de Mooij <jdemooij@mozilla.com>
Sat, 22 Jul 2017 14:31:45 +0200
changeset 419129 f5acec377801fd8f1a193f2fba787d439c3b078b
parent 419128 bfc33f7e1de45d0c219ea83298cd6813964b8b37
child 419130 4a444c40f63b397dbc67e71ab187fd4110841ecc
push id7566
push usermtabara@mozilla.com
push dateWed, 02 Aug 2017 08:25:16 +0000
treeherdermozilla-beta@86913f512c3c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersnbp
bugs1382973
milestone56.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1382973 part 8 - Remove BytecodeAnalysis from IonBuilder and ControlFlowGenerator. r=nbp
js/src/jit/IonBuilder.cpp
js/src/jit/IonBuilder.h
js/src/jit/IonControlFlow.cpp
js/src/jit/IonControlFlow.h
--- a/js/src/jit/IonBuilder.cpp
+++ b/js/src/jit/IonBuilder.cpp
@@ -125,17 +125,16 @@ IonBuilder::IonBuilder(JSContext* analys
     backgroundCodegen_(nullptr),
     actionableAbortScript_(nullptr),
     actionableAbortPc_(nullptr),
     actionableAbortMessage_(nullptr),
     rootList_(nullptr),
     analysisContext(analysisContext),
     baselineFrame_(baselineFrame),
     constraints_(constraints),
-    analysis_(*temp, info->script()),
     thisTypes(nullptr),
     argTypes(nullptr),
     typeArray(nullptr),
     typeArrayHint(0),
     bytecodeTypeMap(nullptr),
     loopDepth_(loopDepth),
     blockWorklist(*temp),
     cfgCurrent(nullptr),
@@ -181,17 +180,16 @@ IonBuilder::clearForBackEnd()
 {
     MOZ_ASSERT(!analysisContext);
     baselineFrame_ = nullptr;
 
     // The caches below allocate data from the malloc heap. Release this before
     // later phases of compilation to avoid leaks, as the top level IonBuilder
     // is not explicitly destroyed. Note that builders for inner scripts are
     // constructed on the stack and will release this memory on destruction.
-    gsn.purge();
     envCoordinateNameCache.purge();
 }
 
 mozilla::GenericErrorResult<AbortReason>
 IonBuilder::abort(AbortReason r)
 {
     auto res = this->MIRGenerator::abort(r);
 # ifdef DEBUG
@@ -701,19 +699,16 @@ IonBuilder::init()
     if (inlineCallInfo_) {
         // If we're inlining, the actual this/argument types are not necessarily
         // a subset of the script's observed types. |argTypes| is never accessed
         // for inlined scripts, so we just null it.
         thisTypes = inlineCallInfo_->thisArg()->resultTypeSet();
         argTypes = nullptr;
     }
 
-    if (!analysis().init(alloc(), gsn))
-        return abort(AbortReason::Alloc);
-
     // The baseline script normally has the bytecode type map, but compute
     // it ourselves if we do not have a baseline script.
     if (script()->hasBaselineScript()) {
         bytecodeTypeMap = script()->baselineScript()->bytecodeTypeMap();
     } else {
         bytecodeTypeMap = alloc_->lifoAlloc()->newArrayUninitialized<uint32_t>(script()->nTypeSets());
         if (!bytecodeTypeMap)
             return abort(AbortReason::Alloc);
@@ -1374,19 +1369,16 @@ GetOrCreateControlFlowGraph(TempAllocato
                             const ControlFlowGraph** cfgOut)
 {
     if (script->hasBaselineScript() && script->baselineScript()->controlFlowGraph()) {
         *cfgOut = script->baselineScript()->controlFlowGraph();
         return CFGState::Success;
     }
 
     ControlFlowGenerator cfgenerator(tempAlloc, script);
-    if (!cfgenerator.init())
-        return CFGState::Alloc;
-
     if (!cfgenerator.traverseBytecode()) {
         if (cfgenerator.aborted())
             return CFGState::Abort;
         return CFGState::Alloc;
     }
 
     // If possible cache the control flow graph on the baseline script.
     TempAllocator* graphAlloc = nullptr;
--- a/js/src/jit/IonBuilder.h
+++ b/js/src/jit/IonBuilder.h
@@ -981,29 +981,22 @@ class IonBuilder
     AbortReasonOr<Ok> init();
 
     JSContext* analysisContext;
     BaselineFrameInspector* baselineFrame_;
 
     // Constraints for recording dependencies on type information.
     CompilerConstraintList* constraints_;
 
-    // Basic analysis information about the script.
-    BytecodeAnalysis analysis_;
-    BytecodeAnalysis& analysis() {
-        return analysis_;
-    }
-
     TemporaryTypeSet* thisTypes;
     TemporaryTypeSet* argTypes;
     TemporaryTypeSet* typeArray;
     uint32_t typeArrayHint;
     uint32_t* bytecodeTypeMap;
 
-    GSNCache gsn;
     EnvironmentCoordinateNameCache envCoordinateNameCache;
 
     jsbytecode* pc;
     MBasicBlock* current;
     uint32_t loopDepth_;
     Vector<MBasicBlock*, 0, JitAllocPolicy> blockWorklist;
     const CFGBlock* cfgCurrent;
     const ControlFlowGraph* cfg;
--- a/js/src/jit/IonControlFlow.cpp
+++ b/js/src/jit/IonControlFlow.cpp
@@ -17,27 +17,20 @@ ControlFlowGenerator::ControlFlowGenerat
   : script(script),
     current(nullptr),
     alloc_(temp),
     blocks_(temp),
     cfgStack_(temp),
     loops_(temp),
     switches_(temp),
     labels_(temp),
-    analysis_(temp, script),
     aborted_(false),
     checkedTryFinally_(false)
 { }
 
-bool
-ControlFlowGenerator::init()
-{
-    return analysis_.init(alloc(), gsn);
-}
-
 static inline int32_t
 GetJumpOffset(jsbytecode* pc)
 {
     MOZ_ASSERT(CodeSpec[JSOp(*pc)].type() == JOF_JUMP);
     return GET_JUMP_OFFSET(pc);
 }
 
 void
--- a/js/src/jit/IonControlFlow.h
+++ b/js/src/jit/IonControlFlow.h
@@ -800,25 +800,22 @@ class ControlFlowGenerator
         static CFGState Label(jsbytecode* exitpc);
         static CFGState Try(jsbytecode* exitpc, CFGBlock* successor);
     };
 
     Vector<CFGState, 8, JitAllocPolicy> cfgStack_;
     Vector<ControlFlowInfo, 4, JitAllocPolicy> loops_;
     Vector<ControlFlowInfo, 0, JitAllocPolicy> switches_;
     Vector<ControlFlowInfo, 2, JitAllocPolicy> labels_;
-    BytecodeAnalysis analysis_;
     bool aborted_;
     bool checkedTryFinally_;
 
   public:
     ControlFlowGenerator(TempAllocator& alloc, JSScript* script);
 
-    MOZ_MUST_USE bool init();
-
     MOZ_MUST_USE bool traverseBytecode();
     MOZ_MUST_USE bool addBlock(CFGBlock* block);
     ControlFlowGraph* getGraph(TempAllocator& alloc) {
         ControlFlowGraph* cfg = ControlFlowGraph::New(alloc);
         if (!cfg)
             return nullptr;
         if (!cfg->init(alloc, blocks_))
             return nullptr;