Bug 1263558 - Part 0.2: Handle OOM inside SplitCriticalEdges and EliminatePhis at AnalyzeNewScriptDefiniteProperties and AnalyzeArgumentsUsage. r=jandem
authorTooru Fujisawa <arai_a@mac.com>
Fri, 22 Apr 2016 00:29:22 +0900
changeset 332205 344a4bcc9015457aa8deadbaac79eead70acbb60
parent 332204 611130fe9f93305ba081ce37a923d3383ccf3419
child 332206 5af002b8ef582c6d18ae5e7565d6c2c55dad0759
push id6048
push userkmoir@mozilla.com
push dateMon, 06 Jun 2016 19:02:08 +0000
treeherdermozilla-beta@46d72a56c57d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjandem
bugs1263558
milestone48.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 1263558 - Part 0.2: Handle OOM inside SplitCriticalEdges and EliminatePhis at AnalyzeNewScriptDefiniteProperties and AnalyzeArgumentsUsage. r=jandem
js/src/jit/Ion.cpp
js/src/jit/IonAnalysis.cpp
js/src/jit/IonAnalysis.h
js/src/jsapi-tests/testJitMinimalFunc.h
--- a/js/src/jit/Ion.cpp
+++ b/js/src/jit/Ion.cpp
@@ -1507,18 +1507,17 @@ OptimizeMIR(MIRGenerator* mir)
         AssertGraphCoherency(graph);
 
         if (mir->shouldCancel("Split Critical Edges"))
             return false;
     }
 
     {
         AutoTraceLog log(logger, TraceLogger_RenumberBlocks);
-        if (!RenumberBlocks(graph))
-            return false;
+        RenumberBlocks(graph);
         gs.spewPass("Renumber Blocks");
         AssertGraphCoherency(graph);
 
         if (mir->shouldCancel("Renumber Blocks"))
             return false;
     }
 
     {
--- a/js/src/jit/IonAnalysis.cpp
+++ b/js/src/jit/IonAnalysis.cpp
@@ -1877,24 +1877,22 @@ jit::MakeMRegExpHoistable(MIRGraph& grap
                 regexp->block()->insertAfter(zero, lastIndex);
             }
         }
     }
 
     return true;
 }
 
-bool
+void
 jit::RenumberBlocks(MIRGraph& graph)
 {
     size_t id = 0;
     for (ReversePostorderIterator block(graph.rpoBegin()); block != graph.rpoEnd(); block++)
         block->setId(id++);
-
-    return true;
 }
 
 // A utility for code which deletes blocks. Renumber the remaining blocks,
 // recompute dominators, and optionally recompute AliasAnalysis dependencies.
 bool
 jit::AccountForCFGChanges(MIRGenerator* mir, MIRGraph& graph, bool updateAliasAnalysis,
                           bool underValueNumberer)
 {
@@ -3766,29 +3764,32 @@ jit::AnalyzeNewScriptDefiniteProperties(
             return false;
         }
         MOZ_ASSERT(!cx->isExceptionPending());
         return true;
     }
 
     FinishDefinitePropertiesAnalysis(cx, constraints);
 
-    if (!SplitCriticalEdges(graph))
+    if (!SplitCriticalEdges(graph)) {
+        ReportOutOfMemory(cx);
         return false;
-
-    if (!RenumberBlocks(graph))
-        return false;
+    }
+
+    RenumberBlocks(graph);
 
     if (!BuildDominatorTree(graph)) {
         ReportOutOfMemory(cx);
         return false;
     }
 
-    if (!EliminatePhis(&builder, graph, AggressiveObservability))
+    if (!EliminatePhis(&builder, graph, AggressiveObservability)) {
+        ReportOutOfMemory(cx);
         return false;
+    }
 
     MDefinition* thisValue = graph.entryBlock()->getSlot(info.thisSlot());
 
     // Get a list of instructions using the |this| value in the order they
     // appear in the graph.
     Vector<MInstruction*> instructions(cx);
 
     for (MUseDefIterator uses(thisValue); uses; uses++) {
@@ -3987,29 +3988,32 @@ jit::AnalyzeArgumentsUsage(JSContext* cx
 
     if (!builder.build()) {
         if (cx->isThrowingOverRecursed() || builder.abortReason() == AbortReason_Alloc)
             return false;
         MOZ_ASSERT(!cx->isExceptionPending());
         return true;
     }
 
-    if (!SplitCriticalEdges(graph))
+    if (!SplitCriticalEdges(graph)) {
+        ReportOutOfMemory(cx);
         return false;
-
-    if (!RenumberBlocks(graph))
-        return false;
+    }
+
+    RenumberBlocks(graph);
 
     if (!BuildDominatorTree(graph)) {
         ReportOutOfMemory(cx);
         return false;
     }
 
-    if (!EliminatePhis(&builder, graph, AggressiveObservability))
+    if (!EliminatePhis(&builder, graph, AggressiveObservability)) {
+        ReportOutOfMemory(cx);
         return false;
+    }
 
     MDefinition* argumentsValue = graph.entryBlock()->getSlot(info.argsObjSlot());
 
     bool argumentsContentsObserved = false;
 
     for (MUseDefIterator uses(argumentsValue); uses; uses++) {
         MDefinition* use = uses.def();
 
--- a/js/src/jit/IonAnalysis.h
+++ b/js/src/jit/IonAnalysis.h
@@ -51,17 +51,17 @@ bool
 EliminateDeadCode(MIRGenerator* mir, MIRGraph& graph);
 
 bool
 ApplyTypeInformation(MIRGenerator* mir, MIRGraph& graph);
 
 bool
 MakeMRegExpHoistable(MIRGraph& graph);
 
-bool
+void
 RenumberBlocks(MIRGraph& graph);
 
 bool
 AccountForCFGChanges(MIRGenerator* mir, MIRGraph& graph, bool updateAliasAnalysis,
                      bool underValueNumberer = false);
 
 bool
 RemoveUnmarkedBlocks(MIRGenerator* mir, MIRGraph& graph, uint32_t numMarkedBlocks);
--- a/js/src/jsapi-tests/testJitMinimalFunc.h
+++ b/js/src/jsapi-tests/testJitMinimalFunc.h
@@ -70,36 +70,34 @@ struct MinimalFunc : MinimalAlloc
         MParameter* p = MParameter::New(alloc, numParams++, nullptr);
         return p;
     }
 
     bool runGVN()
     {
         if (!SplitCriticalEdges(graph))
             return false;
-        if (!RenumberBlocks(graph))
-            return false;
+        RenumberBlocks(graph);
         if (!BuildDominatorTree(graph))
             return false;
         if (!BuildPhiReverseMapping(graph))
             return false;
         ValueNumberer gvn(&mir, graph);
         if (!gvn.init())
             return false;
         if (!gvn.run(ValueNumberer::DontUpdateAliasAnalysis))
             return false;
         return true;
     }
 
     bool runRangeAnalysis()
     {
         if (!SplitCriticalEdges(graph))
             return false;
-        if (!RenumberBlocks(graph))
-            return false;
+        RenumberBlocks(graph);
         if (!BuildDominatorTree(graph))
             return false;
         if (!BuildPhiReverseMapping(graph))
             return false;
         RangeAnalysis rangeAnalysis(&mir, graph);
         if (!rangeAnalysis.addBetaNodes())
             return false;
         if (!rangeAnalysis.analyze())