Bug 968931: IonMonkey: Loosen the verifyOsiPointRegs checks, r=jandem

This commit is contained in:
Hannes Verschore 2014-03-27 20:08:34 +01:00
parent 3215a5daf1
commit 45f269f089
3 changed files with 22 additions and 12 deletions

View File

@ -987,9 +987,9 @@ class LSafepoint : public TempObject
GeneralRegisterSet gcRegs_;
#ifdef CHECK_OSIPOINT_REGISTERS
// Temp regs of the current instruction. This set is never written to the
// safepoint; it's only used by assertions during compilation.
RegisterSet tempRegs_;
// Clobbered regs of the current instruction. This set is never written to
// the safepoint; it's only used by assertions during compilation.
RegisterSet clobberedRegs_;
#endif
// Offset to a position in the safepoint stream, or
@ -1052,12 +1052,12 @@ class LSafepoint : public TempObject
return liveRegs_;
}
#ifdef CHECK_OSIPOINT_REGISTERS
void addTempRegister(AnyRegister reg) {
tempRegs_.addUnchecked(reg);
void addClobberedRegister(AnyRegister reg) {
clobberedRegs_.addUnchecked(reg);
assertInvariants();
}
const RegisterSet &tempRegs() const {
return tempRegs_;
const RegisterSet &clobberedRegs() const {
return clobberedRegs_;
}
#endif
void addGcRegister(Register reg) {

View File

@ -686,8 +686,16 @@ class LiveRangeAllocator : protected RegisterAllocator
// Don't add output registers to the safepoint.
CodePosition start = interval->start();
if (interval->index() == 0 && !reg->isTemp())
if (interval->index() == 0 && !reg->isTemp()) {
#ifdef CHECK_OSIPOINT_REGISTERS
// We don't add the output register to the safepoint,
// but it still might get added as one of the inputs.
// So eagerly add this reg to the safepoint clobbered registers.
if (LSafepoint *safepoint = reg->ins()->safepoint())
safepoint->addClobberedRegister(a->toRegister());
#endif
start = start.next();
}
size_t i = findFirstNonCallSafepoint(start);
for (; i < graph.numNonCallSafepoints(); i++) {
@ -707,7 +715,7 @@ class LiveRangeAllocator : protected RegisterAllocator
#ifdef CHECK_OSIPOINT_REGISTERS
if (reg->isTemp())
safepoint->addTempRegister(a->toRegister());
safepoint->addClobberedRegister(a->toRegister());
#endif
}
}

View File

@ -560,11 +560,13 @@ CodeGeneratorShared::verifyOsiPointRegs(LSafepoint *safepoint)
// before the return address.
masm.branch32(Assembler::NotEqual, checkRegs, Imm32(1), &failure);
// Ignore temp registers. Some instructions (like LValueToInt32) modify
// Ignore clobbered registers. Some instructions (like LValueToInt32) modify
// temps after calling into the VM. This is fine because no other
// instructions (including this OsiPoint) will depend on them.
// instructions (including this OsiPoint) will depend on them. Also
// backtracking can also use the same register for an input and an output.
// These are marked as clobbered and shouldn't get checked.
RegisterSet liveRegs = safepoint->liveRegs();
liveRegs = RegisterSet::Intersect(liveRegs, RegisterSet::Not(safepoint->tempRegs()));
liveRegs = RegisterSet::Intersect(liveRegs, RegisterSet::Not(safepoint->clobberedRegs()));
VerifyOp op(masm, &failure);
HandleRegisterDump<VerifyOp>(op, masm, liveRegs, scratch, allRegs.getAny());