[JAEGER] Cache atom in PIC directly, instead of index, for simplicity.

This commit is contained in:
David Anderson 2010-06-22 15:07:10 -07:00
parent 7965d753a3
commit f4a612c01c
4 changed files with 30 additions and 35 deletions

View File

@ -298,7 +298,7 @@ mjit::Compiler::finishThisUp()
(uint8*)script->pics[i].slowPathStart.executableAddress());
script->pics[i].shapeReg = pics[i].shapeReg;
script->pics[i].objReg = pics[i].objReg;
script->pics[i].atomIndex = pics[i].atomIndex;
script->pics[i].atom = pics[i].atom;
script->pics[i].shapeGuard = masm.distanceOf(pics[i].shapeGuard) -
masm.distanceOf(pics[i].hotPathBegin);
@ -716,23 +716,23 @@ mjit::Compiler::generateMethod()
BEGIN_CASE(JSOP_GETTHISPROP)
/* Push thisv onto stack. */
jsop_this();
jsop_getprop(fullAtomIndex(PC));
jsop_getprop(script->getAtom(fullAtomIndex(PC)));
END_CASE(JSOP_GETTHISPROP);
BEGIN_CASE(JSOP_GETARGPROP)
/* Push arg onto stack. */
jsop_getarg(GET_SLOTNO(PC));
jsop_getprop(fullAtomIndex(&PC[ARGNO_LEN]));
jsop_getprop(script->getAtom(fullAtomIndex(&PC[ARGNO_LEN])));
END_CASE(JSOP_GETARGPROP)
BEGIN_CASE(JSOP_GETLOCALPROP)
frame.pushLocal(GET_SLOTNO(PC));
jsop_getprop(fullAtomIndex(&PC[SLOTNO_LEN]));
jsop_getprop(script->getAtom(fullAtomIndex(&PC[SLOTNO_LEN])));
END_CASE(JSOP_GETLOCALPROP)
BEGIN_CASE(JSOP_GETPROP)
BEGIN_CASE(JSOP_GETXPROP)
jsop_getprop(fullAtomIndex(PC));
jsop_getprop(script->getAtom(fullAtomIndex(PC)));
END_CASE(JSOP_GETPROP)
BEGIN_CASE(JSOP_LENGTH)
@ -1026,7 +1026,7 @@ mjit::Compiler::generateMethod()
END_CASE(JSOP_BINDNAME)
BEGIN_CASE(JSOP_SETPROP)
jsop_setprop(fullAtomIndex(PC));
jsop_setprop(script->getAtom(fullAtomIndex(PC)));
END_CASE(JSOP_SETPROP)
BEGIN_CASE(JSOP_SETNAME)
@ -1820,9 +1820,8 @@ mjit::Compiler::emitStubCmpOp(BoolStub stub, jsbytecode *target, JSOp fused)
}
void
mjit::Compiler::jsop_setprop_slow(uint32 atomIndex)
mjit::Compiler::jsop_setprop_slow(JSAtom *atom)
{
JSAtom *atom = script->getAtom(atomIndex);
prepareStubCall();
masm.move(ImmPtr(atom), Registers::ArgReg1);
stubCall(stubs::SetName, Uses(2), Defs(1));
@ -1861,7 +1860,7 @@ mjit::Compiler::jsop_length()
}
#if ENABLE_PIC
jsop_getprop(ic::PICInfo::LENGTH_ATOM);
jsop_getprop(cx->runtime->atomState.lengthAtom);
#else
prepareStubCall();
stubCall(stubs::Length, Uses(1), Defs(1));
@ -1872,7 +1871,7 @@ mjit::Compiler::jsop_length()
#if ENABLE_PIC
void
mjit::Compiler::jsop_getprop(uint32 atomIndex)
mjit::Compiler::jsop_getprop(JSAtom *atom)
{
FrameEntry *top = frame.peek(-1);
@ -1881,7 +1880,7 @@ mjit::Compiler::jsop_getprop(uint32 atomIndex)
(top->getTypeTag() != JSVAL_MASK32_FUNOBJ &&
top->getTypeTag() != JSVAL_MASK32_NONFUNOBJ))
{
JS_ASSERT_IF(atomIndex == ic::PICInfo::LENGTH_ATOM,
JS_ASSERT_IF(atom == cx->runtime->atomState.lengthAtom,
top->getTypeTag() != JSVAL_MASK32_STRING);
jsop_getprop_slow();
return;
@ -1894,7 +1893,7 @@ mjit::Compiler::jsop_getprop(uint32 atomIndex)
*/
RegisterID objReg = Registers::ReturnReg;
RegisterID shapeReg = Registers::ReturnReg;
if (atomIndex == ic::PICInfo::LENGTH_ATOM) {
if (atom == cx->runtime->atomState.lengthAtom) {
objReg = frame.copyDataIntoReg(top);
shapeReg = frame.allocReg();
}
@ -1923,13 +1922,13 @@ mjit::Compiler::jsop_getprop(uint32 atomIndex)
pic.typeReg = Registers::ReturnReg;
}
if (atomIndex != ic::PICInfo::LENGTH_ATOM) {
if (atom != cx->runtime->atomState.lengthAtom) {
objReg = frame.copyDataIntoReg(top);
shapeReg = frame.allocReg();
}
pic.shapeReg = shapeReg;
pic.atomIndex = atomIndex;
pic.atom = atom;
pic.objRemat = frame.dataRematInfo(top);
/* Guard on shape. */
@ -1965,7 +1964,7 @@ mjit::Compiler::jsop_getprop(uint32 atomIndex)
}
void
mjit::Compiler::jsop_setprop(uint32 atomIndex)
mjit::Compiler::jsop_setprop(JSAtom *atom)
{
FrameEntry *lhs = frame.peek(-2);
FrameEntry *rhs = frame.peek(-1);
@ -1975,12 +1974,12 @@ mjit::Compiler::jsop_setprop(uint32 atomIndex)
(lhs->getTypeTag() != JSVAL_MASK32_FUNOBJ &&
lhs->getTypeTag() != JSVAL_MASK32_NONFUNOBJ))
{
jsop_setprop_slow(atomIndex);
jsop_setprop_slow(atom);
return;
}
PICGenInfo pic(ic::PICInfo::SET);
pic.atomIndex = atomIndex;
pic.atom = atom;
/* Guard that the type is an object. */
Jump typeCheck;
@ -1996,7 +1995,7 @@ mjit::Compiler::jsop_setprop(uint32 atomIndex)
pic.typeCheck = stubcc.masm.label();
stubcc.linkExit(j);
stubcc.leave();
stubcc.masm.move(ImmPtr(script->getAtom(atomIndex)), Registers::ArgReg1);
stubcc.masm.move(ImmPtr(atom), Registers::ArgReg1);
stubcc.call(stubs::SetName);
typeCheck = stubcc.masm.jump();
pic.hasTypeCheck = true;
@ -2090,15 +2089,15 @@ mjit::Compiler::jsop_setprop(uint32 atomIndex)
#else /* ENABLE_PIC */
void
mjit::Compiler::jsop_getprop(uint32 atomIndex)
mjit::Compiler::jsop_getprop(JSAtom *atom)
{
jsop_getprop_slow(atomIndex);
jsop_getprop_slow();
}
void
mjit::Compiler::jsop_setprop(uint32 atomIndex)
mjit::Compiler::jsop_setprop(JSAtom *atom)
{
jsop_setprop_slow(atomIndex);
jsop_setprop_slow(atom);
}
#endif

View File

@ -98,7 +98,7 @@ class Compiler
RegisterID objReg;
RegisterID typeReg;
Label shapeGuard;
uint32 atomIndex;
JSAtom *atom;
StateRemat objRemat;
Call callReturn;
bool hasTypeCheck;
@ -190,10 +190,10 @@ class Compiler
void jsop_setelem_slow();
void jsop_getelem_slow();
void jsop_unbrand();
void jsop_getprop(uint32 atomIndex);
void jsop_getprop(JSAtom *atom);
void jsop_length();
void jsop_setprop(uint32 atomIndex);
void jsop_setprop_slow(uint32 atomIndex);
void jsop_setprop(JSAtom *atom);
void jsop_setprop_slow(JSAtom *atom);
/* Fast opcodes. */
void jsop_bitop(JSOp op);

View File

@ -726,8 +726,8 @@ ic::GetProp(VMFrame &f, uint32 index)
JSScript *script = f.fp->script;
PICInfo &pic = script->pics[index];
JSAtom *atom;
if (pic.atomIndex == ic::PICInfo::LENGTH_ATOM) {
JSAtom *atom = pic.atom;
if (atom == f.cx->runtime->atomState.lengthAtom) {
if (f.regs.sp[-1].isString()) {
GetPropCompiler cc(f, script, NULL, pic, NULL, stubs::Length);
if (!cc.generateStringLengthStub()) {
@ -750,8 +750,6 @@ ic::GetProp(VMFrame &f, uint32 index)
}
}
atom = f.cx->runtime->atomState.lengthAtom;
} else {
atom = script->getAtom(pic.atomIndex);
}
JSObject *obj = ValueToObject(f.cx, &f.regs.sp[-1]);
@ -779,7 +777,7 @@ SetPropSlow(VMFrame &f, uint32 index)
ic::PICInfo &pic = script->pics[index];
JS_ASSERT(pic.kind == ic::PICInfo::SET);
JSAtom *atom = script->getAtom(pic.atomIndex);
JSAtom *atom = pic.atom;
stubs::SetName(f, atom);
}
@ -792,7 +790,7 @@ ic::SetProp(VMFrame &f, uint32 index)
JSScript *script = f.fp->script;
ic::PICInfo &pic = script->pics[index];
JSAtom *atom = script->getAtom(pic.atomIndex);
JSAtom *atom = pic.atom;
JS_ASSERT(pic.kind == ic::PICInfo::SET);

View File

@ -68,8 +68,6 @@ struct PICInfo {
SET
};
static const uint32 LENGTH_ATOM = 0xFFFFFFFF;
union {
struct {
RegisterID typeReg : 5; // reg used for checking type
@ -131,7 +129,7 @@ struct PICInfo {
int shapeGuard : 8;
// Index into the script's atom table.
uint32 atomIndex;
JSAtom *atom;
// Address of inline fast-path.
JSC::CodeLocationLabel fastPathStart;