JM: Bug 574697, eagerly calculate |this|. (r=dvander)

This commit is contained in:
Chris Leary
2010-06-28 22:24:21 -07:00
parent 49f22da25b
commit e073ca19ac
15 changed files with 216 additions and 110 deletions

View File

@@ -2337,23 +2337,13 @@ mjit::Compiler::jsop_getarg(uint32 index)
void
mjit::Compiler::jsop_this()
{
/*
* :FIXME: We don't know whether it's a funobj or not... but we
* DO know it's an object! This can help downstream opcodes.
*/
RegisterID reg = frame.allocReg();
masm.load32(Address(JSFrameReg, offsetof(JSStackFrame, flags)), reg);
masm.and32(Imm32(JSFRAME_COMPUTED_THIS), reg);
Jump j = masm.branchTest32(Assembler::Zero, reg, reg);
stubcc.linkExit(j);
frame.push(Address(JSFrameReg, offsetof(JSStackFrame, thisv)));
FrameEntry *thisv = frame.peek(-1);
Jump null = frame.testNull(Assembler::Equal, thisv);
stubcc.linkExit(null);
stubcc.leave();
stubcc.call(stubs::This);
frame.freeReg(reg);
frame.push(Address(JSFrameReg, offsetof(JSStackFrame, thisv)));
stubcc.rejoin(0);
stubcc.rejoin(1);
}
void