Bug 1342016 - Fast-path for isObservableSlot(). r=nbp

This commit is contained in:
Sean Stangl 2017-03-21 12:12:15 -04:00
parent 8736cd834c
commit 532abae5e2
2 changed files with 20 additions and 9 deletions

View File

@ -447,12 +447,17 @@ class CompileInfo
// the frame is active on the stack. This implies that these definitions
// would have to be executed and that they cannot be removed even if they
// are unused.
bool isObservableSlot(uint32_t slot) const {
if (isObservableFrameSlot(slot))
return true;
inline bool isObservableSlot(uint32_t slot) const {
if (slot >= firstLocalSlot())
return false;
if (isObservableArgumentSlot(slot))
return true;
if (slot < firstArgSlot()) {
if (isObservableFrameSlot(slot))
return true;
} else {
if (isObservableArgumentSlot(slot))
return true;
}
return false;
}

View File

@ -196,6 +196,8 @@ FlagPhiInputsAsHavingRemovedUses(MIRGenerator* mir, MBasicBlock* block, MBasicBl
static bool
FlagAllOperandsAsHavingRemovedUses(MIRGenerator* mir, MBasicBlock* block)
{
const CompileInfo& info = block->info();
// Flag all instructions operands as having removed uses.
MInstructionIterator end = block->end();
for (MInstructionIterator it = block->begin(); it != end; it++) {
@ -210,8 +212,10 @@ FlagAllOperandsAsHavingRemovedUses(MIRGenerator* mir, MBasicBlock* block)
if (MResumePoint* rp = ins->resumePoint()) {
// Note: no need to iterate over the caller's of the resume point as
// this is the same as the entry resume point.
for (size_t i = 0, e = rp->numOperands(); i < e; i++)
rp->getOperand(i)->setUseRemovedUnchecked();
for (size_t i = 0, e = rp->numOperands(); i < e; i++) {
if (info.isObservableSlot(i))
rp->getOperand(i)->setUseRemovedUnchecked();
}
}
}
@ -221,8 +225,10 @@ FlagAllOperandsAsHavingRemovedUses(MIRGenerator* mir, MBasicBlock* block)
if (mir->shouldCancel("FlagAllOperandsAsHavingRemovedUses loop 2"))
return false;
for (size_t i = 0, e = rp->numOperands(); i < e; i++)
rp->getOperand(i)->setUseRemovedUnchecked();
for (size_t i = 0, e = rp->numOperands(); i < e; i++) {
if (info.isObservableSlot(i))
rp->getOperand(i)->setUseRemovedUnchecked();
}
rp = rp->caller();
}