Bug 1070258 - IonMonkey: Assert that resume points are dominated by their operands r=nbp
authorDan Gohman <sunfish@mozilla.com>
Wed, 08 Oct 2014 18:21:46 -0700
changeset 209508 628fabf04fdac4f00b5c5e2170a3202ecae4ff1a
parent 209507 b37bddc0adfa78fbaadda9925f643602cd6debb4
child 209509 c3bb5abdd01eff8bb6be7900d6405687397941be
push id1
push userroot
push dateMon, 20 Oct 2014 17:29:22 +0000
reviewersnbp
bugs1070258
milestone35.0a1
Bug 1070258 - IonMonkey: Assert that resume points are dominated by their operands r=nbp
js/src/jit/IonAnalysis.cpp
--- a/js/src/jit/IonAnalysis.cpp
+++ b/js/src/jit/IonAnalysis.cpp
@@ -1973,16 +1973,30 @@ jit::AssertGraphCoherency(MIRGraph &grap
 #ifdef DEBUG
     if (!js_JitOptions.checkGraphConsistency)
         return;
     AssertBasicGraphCoherency(graph);
     AssertReversePostorder(graph);
 #endif
 }
 
+static void
+AssertResumePointDominatedByOperands(MResumePoint *resume)
+{
+#ifdef DEBUG
+    for (size_t i = 0, e = resume->numOperands(); i < e; ++i) {
+        MDefinition *op = resume->getOperand(i);
+        if (op->type() == MIRType_MagicOptimizedArguments)
+            continue;
+        MOZ_ASSERT(op->block()->dominates(resume->block()),
+                   "Resume point is not dominated by its operands");
+    }
+#endif
+}
+
 void
 jit::AssertExtendedGraphCoherency(MIRGraph &graph)
 {
     // Checks the basic GraphCoherency but also other conditions that
     // do not hold immediately (such as the fact that critical edges
     // are split)
 
 #ifdef DEBUG
@@ -2057,17 +2071,25 @@ jit::AssertExtendedGraphCoherency(MIRGra
                     MInstructionIterator opIter = block->begin(op->toInstruction());
                     do {
                         ++opIter;
                         MOZ_ASSERT(opIter != block->end(),
                                    "Operand in same block as instruction does not precede");
                     } while (*opIter != ins);
                 }
             }
+            if (MResumePoint *resume = ins->resumePoint())
+                AssertResumePointDominatedByOperands(resume);
         }
+
+        // Verify that the block resume points are dominated by their operands.
+        if (MResumePoint *resume = block->entryResumePoint())
+            AssertResumePointDominatedByOperands(resume);
+        if (MResumePoint *resume = block->outerResumePoint())
+            AssertResumePointDominatedByOperands(resume);
     }
 #endif
 }
 
 
 struct BoundsCheckInfo
 {
     MBoundsCheck *check;