Bug 1083681 - Discard the outer resume point when the successors are becoming unreachable. r=shu
authorNicolas B. Pierron <nicolas.b.pierron@mozilla.com>
Fri, 17 Oct 2014 11:26:49 +0200
changeset 211008 fcf1af7b09741b020bf47f921dd91e154894af70
parent 211007 5dd335d13677a2124fdbe0db7973987d42bd1abc
child 211009 c04673e080a3fed69bc6e514a67f934fafb52c6e
push id1
push userroot
push dateMon, 20 Oct 2014 17:29:22 +0000
reviewersshu
bugs1083681
milestone36.0a1
Bug 1083681 - Discard the outer resume point when the successors are becoming unreachable. r=shu
js/src/jit-test/tests/parallel/bug1083681.js
js/src/jit/MIRGraph.cpp
js/src/jit/MIRGraph.h
js/src/jit/ParallelSafetyAnalysis.cpp
new file mode 100644
--- /dev/null
+++ b/js/src/jit-test/tests/parallel/bug1083681.js
@@ -0,0 +1,5 @@
+function f() {
+    Function() * (function() {})()
+}
+Array.buildPar(1, f)
+
--- a/js/src/jit/MIRGraph.cpp
+++ b/js/src/jit/MIRGraph.cpp
@@ -896,20 +896,18 @@ MBasicBlock::discardAllPhis()
 {
     discardAllPhiOperands();
     phis_.clear();
 }
 
 void
 MBasicBlock::discardAllResumePoints(bool discardEntry)
 {
-    if (outerResumePoint_) {
-        discardResumePoint(outerResumePoint_);
-        outerResumePoint_ = nullptr;
-    }
+    if (outerResumePoint_)
+        clearOuterResumePoint();
 
     if (discardEntry && entryResumePoint_)
         clearEntryResumePoint();
 
 #ifdef DEBUG
     if (!entryResumePoint()) {
         MOZ_ASSERT(resumePointsEmpty());
     } else {
--- a/js/src/jit/MIRGraph.h
+++ b/js/src/jit/MIRGraph.h
@@ -528,16 +528,20 @@ class MBasicBlock : public TempObject, p
     }
     MResumePoint *outerResumePoint() const {
         return outerResumePoint_;
     }
     void setOuterResumePoint(MResumePoint *outer) {
         MOZ_ASSERT(!outerResumePoint_);
         outerResumePoint_ = outer;
     }
+    void clearOuterResumePoint() {
+        discardResumePoint(outerResumePoint_);
+        outerResumePoint_ = nullptr;
+    }
     MResumePoint *callerResumePoint() {
         return entryResumePoint() ? entryResumePoint()->caller() : nullptr;
     }
     void setCallerResumePoint(MResumePoint *caller) {
         entryResumePoint()->setCaller(caller);
     }
     size_t numEntrySlots() const {
         return entryResumePoint()->numOperands();
--- a/js/src/jit/ParallelSafetyAnalysis.cpp
+++ b/js/src/jit/ParallelSafetyAnalysis.cpp
@@ -460,16 +460,21 @@ ParallelSafetyVisitor::convertToBailout(
     MBail *bail = MBail::New(graph_.alloc(), Bailout_ParallelUnsafe);
 
     // Discard the rest of the block and sever its link to its successors in
     // the CFG.
     for (size_t i = 0; i < block->numSuccessors(); i++)
         block->getSuccessor(i)->removePredecessor(block);
     block->discardAllInstructionsStartingAt(iter);
 
+    // No more successors are reachable, so the current block can no longer be
+    // the parent of an inlined function.
+    if (block->outerResumePoint())
+        block->clearOuterResumePoint();
+
     // End the block in a bail.
     block->add(bail);
     block->end(MUnreachable::New(alloc()));
     return true;
 }
 
 /////////////////////////////////////////////////////////////////////////////
 // Memory allocation