mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-28 07:13:20 +00:00
Bug 1257929 - Add assertions to ensure the safety of entry resume point encoding. r=h4writer
This commit is contained in:
parent
060a25a7c5
commit
94139855f1
@ -2268,6 +2268,32 @@ CheckUse(const MDefinition* producer, const MUse* use, int32_t* usesBalance)
|
||||
#endif
|
||||
++*usesBalance;
|
||||
}
|
||||
|
||||
// To properly encode entry resume points, we have to ensure that all the
|
||||
// operands of the entry resume point are located before the safeInsertTop
|
||||
// location.
|
||||
static void
|
||||
AssertOperandsBeforeSafeInsertTop(MResumePoint* resume)
|
||||
{
|
||||
MBasicBlock* block = resume->block();
|
||||
if (block == block->graph().osrBlock())
|
||||
return;
|
||||
MInstruction* stop = block->safeInsertTop();
|
||||
for (size_t i = 0, e = resume->numOperands(); i < e; ++i) {
|
||||
MDefinition* def = resume->getOperand(i);
|
||||
if (def->block() != block)
|
||||
continue;
|
||||
if (def->isPhi())
|
||||
continue;
|
||||
|
||||
for (MInstructionIterator ins = block->begin(); true; ins++) {
|
||||
if (*ins == def)
|
||||
break;
|
||||
MOZ_ASSERT(*ins != stop,
|
||||
"Resume point operand located after the safeInsertTop location");
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif // DEBUG
|
||||
|
||||
void
|
||||
@ -2305,13 +2331,14 @@ jit::AssertBasicGraphCoherency(MIRGraph& graph)
|
||||
for (size_t i = 0; i < block->numPredecessors(); i++)
|
||||
MOZ_ASSERT(CheckPredecessorImpliesSuccessor(*block, block->getPredecessor(i)));
|
||||
|
||||
if (block->entryResumePoint()) {
|
||||
MOZ_ASSERT(!block->entryResumePoint()->instruction());
|
||||
MOZ_ASSERT(block->entryResumePoint()->block() == *block);
|
||||
if (MResumePoint* resume = block->entryResumePoint()) {
|
||||
MOZ_ASSERT(!resume->instruction());
|
||||
MOZ_ASSERT(resume->block() == *block);
|
||||
AssertOperandsBeforeSafeInsertTop(resume);
|
||||
}
|
||||
if (block->outerResumePoint()) {
|
||||
MOZ_ASSERT(!block->outerResumePoint()->instruction());
|
||||
MOZ_ASSERT(block->outerResumePoint()->block() == *block);
|
||||
if (MResumePoint* resume = block->outerResumePoint()) {
|
||||
MOZ_ASSERT(!resume->instruction());
|
||||
MOZ_ASSERT(resume->block() == *block);
|
||||
}
|
||||
for (MResumePointIterator iter(block->resumePointsBegin()); iter != block->resumePointsEnd(); iter++) {
|
||||
// We cannot yet assert that is there is no instruction then this is
|
||||
|
@ -912,6 +912,9 @@ MBasicBlock::moveBefore(MInstruction* at, MInstruction* ins)
|
||||
MInstruction*
|
||||
MBasicBlock::safeInsertTop(MDefinition* ins, IgnoreTop ignore)
|
||||
{
|
||||
MOZ_ASSERT(graph().osrBlock() != this,
|
||||
"We are not supposed to add any instruction in OSR blocks.");
|
||||
|
||||
// Beta nodes and interrupt checks are required to be located at the
|
||||
// beginnings of basic blocks, so we must insert new instructions after any
|
||||
// such instructions.
|
||||
@ -921,6 +924,7 @@ MBasicBlock::safeInsertTop(MDefinition* ins, IgnoreTop ignore)
|
||||
while (insertIter->isBeta() ||
|
||||
insertIter->isInterruptCheck() ||
|
||||
insertIter->isConstant() ||
|
||||
insertIter->isParameter() ||
|
||||
(!(ignore & IgnoreRecover) && insertIter->isRecoveredOnBailout()))
|
||||
{
|
||||
insertIter++;
|
||||
|
Loading…
Reference in New Issue
Block a user