Bug 1083681 - Discard the outer resume point when the successors are becoming unreachable. r=shu
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