[JAEGER] Reimplement tempRegForConstant() as copyConstantIntoReg(); (576417, r=dvander).

This commit is contained in:
Sean Stangl 2010-07-02 11:56:34 -07:00
parent a72a022883
commit 779d2a3dd0
4 changed files with 30 additions and 24 deletions

View File

@ -379,23 +379,6 @@ FrameState::tempRegForData(FrameEntry *fe)
return reg;
}
inline JSC::MacroAssembler::RegisterID
FrameState::tempRegForConstant(FrameEntry *fe)
{
JS_ASSERT(fe->data.isConstant());
if (fe->isCopy())
fe = fe->copyOf();
if (fe->data.inRegister())
return fe->data.reg();
RegisterID reg = allocReg(fe, RematInfo::DATA);
masm.move(Imm32(fe->getValue().asInt32()), reg);
fe->data.setRegister(reg);
return reg;
}
inline JSC::MacroAssembler::RegisterID
FrameState::tempRegForData(FrameEntry *fe, RegisterID reg)
{

View File

@ -542,6 +542,25 @@ FrameState::copyTypeIntoReg(FrameEntry *fe)
return reg;
}
JSC::MacroAssembler::RegisterID
FrameState::copyConstantIntoReg(FrameEntry *fe)
{
return copyConstantIntoReg(masm, fe);
}
JSC::MacroAssembler::RegisterID
FrameState::copyConstantIntoReg(Assembler &masm, FrameEntry *fe)
{
JS_ASSERT(fe->data.isConstant());
if (fe->isCopy())
fe = fe->copyOf();
RegisterID reg = allocReg();
masm.move(Imm32(fe->getValue().asInt32()), reg);
return reg;
}
JSC::MacroAssembler::FPRegisterID
FrameState::copyEntryIntoFPReg(FrameEntry *fe, FPRegisterID fpreg)
{

View File

@ -248,12 +248,6 @@ class FrameState
*/
inline RegisterID tempRegForData(FrameEntry *fe, RegisterID reg);
/*
* Returns a register that contains the constant value of the
* frame entry's data payload.
*/
inline RegisterID tempRegForConstant(FrameEntry *fe);
/*
* Forcibly loads the type tag for the specified FrameEntry
* into a register already marked as owning the type.
@ -316,6 +310,15 @@ class FrameState
*/
RegisterID copyTypeIntoReg(FrameEntry *fe);
/*
* Returns a register that contains the constant value of the
* frame entry's data payload.
* Since the register is not bound to a FrameEntry,
* it MUST be explicitly freed with freeReg().
*/
RegisterID copyConstantIntoReg(FrameEntry *fe);
RegisterID copyConstantIntoReg(Assembler &masm, FrameEntry *fe);
/*
* Types don't always have to be in registers, sometimes the compiler
* can use addresses and avoid spilling. If this FrameEntry has a synced

View File

@ -173,9 +173,10 @@ mjit::Compiler::jsop_binary_intmath(JSOp op, RegisterID *returnReg, MaybeJump &j
#if !defined(JS_CPU_ARM)
case JSOP_MUL:
if (rhs->isConstant()) {
RegisterID rhsReg = frame.tempRegForConstant(rhs);
RegisterID rhsReg = frame.copyConstantIntoReg(rhs);
fail = masm.branchMul32(Assembler::Overflow,
rhsReg, reg);
frame.freeReg(rhsReg);
} else if (frame.shouldAvoidDataRemat(rhs)) {
fail = masm.branchMul32(Assembler::Overflow,
frame.addressOf(rhs), reg);