Bug 991069 - Optimize MPostWriteBarrier OOL path to not save non-volatile regs. r=terrence

This commit is contained in:
Jan de Mooij 2014-04-03 20:01:30 +02:00
parent e1e2408909
commit 2cd42336bd
3 changed files with 25 additions and 6 deletions

View File

@ -1742,14 +1742,11 @@ class OutOfLineCallPostWriteBarrier : public OutOfLineCodeBase<CodeGenerator>
bool
CodeGenerator::visitOutOfLineCallPostWriteBarrier(OutOfLineCallPostWriteBarrier *ool)
{
saveLive(ool->lir());
saveLiveVolatile(ool->lir());
const LAllocation *obj = ool->object();
GeneralRegisterSet regs;
regs.add(CallTempReg0);
regs.add(CallTempReg1);
regs.add(CallTempReg2);
GeneralRegisterSet regs = GeneralRegisterSet::Volatile();
Register objreg;
bool isGlobal = false;
@ -1772,7 +1769,7 @@ CodeGenerator::visitOutOfLineCallPostWriteBarrier(OutOfLineCallPostWriteBarrier
masm.passABIArg(objreg);
masm.callWithABI(JS_FUNC_TO_DATA_PTR(void *, fun));
restoreLive(ool->lir());
restoreLiveVolatile(ool->lir());
masm.jump(ool->rejoin());
return true;

View File

@ -164,6 +164,24 @@ CodeGeneratorShared::restoreLiveIgnore(LInstruction *ins, RegisterSet ignore)
masm.PopRegsInMaskIgnore(safepoint->liveRegs(), ignore);
}
void
CodeGeneratorShared::saveLiveVolatile(LInstruction *ins)
{
JS_ASSERT(!ins->isCall());
LSafepoint *safepoint = ins->safepoint();
RegisterSet regs = RegisterSet::Intersect(safepoint->liveRegs(), RegisterSet::Volatile());
masm.PushRegsInMask(regs);
}
void
CodeGeneratorShared::restoreLiveVolatile(LInstruction *ins)
{
JS_ASSERT(!ins->isCall());
LSafepoint *safepoint = ins->safepoint();
RegisterSet regs = RegisterSet::Intersect(safepoint->liveRegs(), RegisterSet::Volatile());
masm.PopRegsInMask(regs);
}
} // ion
} // js

View File

@ -351,6 +351,10 @@ class CodeGeneratorShared : public LInstructionVisitor
inline void restoreLive(LInstruction *ins);
inline void restoreLiveIgnore(LInstruction *ins, RegisterSet reg);
// Save/restore all registers that are both live and volatile.
inline void saveLiveVolatile(LInstruction *ins);
inline void restoreLiveVolatile(LInstruction *ins);
template <typename T>
void pushArg(const T &t) {
masm.Push(t);