Bug 1042729 part 4 - Keep a reference to outer resume point on basic blocks, and make discarding resume point precise. r=jandem

This commit is contained in:
Nicolas B. Pierron 2014-08-21 20:47:04 +02:00
parent cb81a8d124
commit 04f631b40e
4 changed files with 47 additions and 16 deletions

View File

@ -1784,7 +1784,14 @@ jit::AssertBasicGraphCoherency(MIRGraph &graph)
for (size_t i = 0; i < block->numPredecessors(); i++)
JS_ASSERT(CheckPredecessorImpliesSuccessor(*block, block->getPredecessor(i)));
MOZ_ASSERT_IF(block->entryResumePoint(), !block->entryResumePoint()->instruction());
if (block->entryResumePoint()) {
MOZ_ASSERT(!block->entryResumePoint()->instruction());
MOZ_ASSERT(block->entryResumePoint()->block() == *block);
}
if (block->outerResumePoint()) {
MOZ_ASSERT(!block->outerResumePoint()->instruction());
MOZ_ASSERT(block->outerResumePoint()->block() == *block);
}
for (MResumePointIterator iter(block->resumePointsBegin()); iter != block->resumePointsEnd(); iter++) {
// We cannot yet assert that is there is no instruction then this is
// the entry resume point because we are still storing resume points

View File

@ -3991,6 +3991,7 @@ IonBuilder::inlineScriptedCall(CallInfo &callInfo, JSFunction *target)
MResumePoint::New(alloc(), current, pc, callerResumePoint_, MResumePoint::Outer);
if (!outerResumePoint)
return false;
current->setOuterResumePoint(outerResumePoint);
// Pop formals again, except leave |fun| on stack for duration of call.
callInfo.popFormals(current);

View File

@ -150,8 +150,8 @@ MIRGraph::removeBlock(MBasicBlock *block)
}
}
block->discardAllResumePoints();
block->discardAllInstructions();
block->discardAllResumePoints();
// Note: phis are disconnected from the rest of the graph, but are not
// removed entirely. If the block being removed is a loop header then
@ -342,6 +342,7 @@ MBasicBlock::MBasicBlock(MIRGraph &graph, CompileInfo &info, const BytecodeSite
pc_(site.pc()),
lir_(nullptr),
entryResumePoint_(nullptr),
outerResumePoint_(nullptr),
successorWithPhis_(nullptr),
positionInPhiSuccessor_(0),
loopDepth_(0),
@ -861,11 +862,10 @@ void
MBasicBlock::discardAllInstructionsStartingAt(MInstructionIterator &iter)
{
while (iter != end()) {
// We only discard operands and flag the instruction as discarded as the
// resume points are exepected to be removed separately. Also we do not
// assert that we have no uses as block might be removed in reverse post
// order.
prepareForDiscard(*iter, RefType_DiscardOperands);
// Discard operands and resume point operands and flag the instruction
// as discarded. Also we do not assert that we have no uses as blocks
// might be removed in reverse post order.
prepareForDiscard(*iter, RefType_DefaultNoAssert);
iter = instructions_.removeAt(iter);
}
}
@ -890,17 +890,24 @@ MBasicBlock::discardAllPhis()
void
MBasicBlock::discardAllResumePoints(bool discardEntry)
{
for (MResumePointIterator iter = resumePointsBegin(); iter != resumePointsEnd(); ) {
MResumePoint *rp = *iter;
if (rp == entryResumePoint() && !discardEntry) {
iter++;
} else {
rp->discardUses();
iter = resumePoints_.removeAt(iter);
}
if (outerResumePoint_) {
discardResumePoint(outerResumePoint_);
outerResumePoint_ = nullptr;
}
if (discardEntry)
if (discardEntry && entryResumePoint_)
clearEntryResumePoint();
#ifdef DEBUG
if (!entryResumePoint()) {
MOZ_ASSERT(resumePointsEmpty());
} else {
MResumePointIterator iter(resumePointsBegin());
MOZ_ASSERT(iter != resumePointsEnd());
iter++;
MOZ_ASSERT(iter == resumePointsEnd());
}
#endif
}
void

View File

@ -481,8 +481,16 @@ class MBasicBlock : public TempObject, public InlineListNode<MBasicBlock>
entryResumePoint_ = rp;
}
void clearEntryResumePoint() {
discardResumePoint(entryResumePoint_);
entryResumePoint_ = nullptr;
}
MResumePoint *outerResumePoint() const {
return outerResumePoint_;
}
void setOuterResumePoint(MResumePoint *outer) {
MOZ_ASSERT(!outerResumePoint_);
outerResumePoint_ = outer;
}
MResumePoint *callerResumePoint() {
return entryResumePoint() ? entryResumePoint()->caller() : nullptr;
}
@ -565,7 +573,15 @@ class MBasicBlock : public TempObject, public InlineListNode<MBasicBlock>
uint32_t numDominated_;
jsbytecode *pc_;
LBlock *lir_;
// Resume point holding baseline-like frame for the PC corresponding to the
// entry of this basic block.
MResumePoint *entryResumePoint_;
// Resume point holding baseline-like frame for the PC corresponding to the
// beginning of the call-site which is being inlined after this block.
MResumePoint *outerResumePoint_;
MBasicBlock *successorWithPhis_;
uint32_t positionInPhiSuccessor_;
uint32_t loopDepth_;