Compile JSOP_DELPROP, JSOP_DELELEM (bug 578736, r=dmandelin).

This commit is contained in:
David Anderson 2010-09-16 12:13:25 -07:00
parent 7418b836b8
commit 699ebd405b
3 changed files with 63 additions and 0 deletions

View File

@ -885,6 +885,26 @@ mjit::Compiler::generateMethod()
jsop_pos(); jsop_pos();
END_CASE(JSOP_POS) END_CASE(JSOP_POS)
BEGIN_CASE(JSOP_DELPROP)
{
uint32 index = fullAtomIndex(PC);
JSAtom *atom = script->getAtom(index);
prepareStubCall(Uses(1));
masm.move(ImmPtr(atom), Registers::ArgReg1);
stubCall(STRICT_VARIANT(stubs::DelProp));
frame.pop();
frame.pushSynced();
}
END_CASE(JSOP_DELPROP)
BEGIN_CASE(JSOP_DELELEM)
prepareStubCall(Uses(2));
stubCall(STRICT_VARIANT(stubs::DelElem));
frame.popn(2);
frame.pushSynced();
END_CASE(JSOP_DELELEM)
BEGIN_CASE(JSOP_TYPEOF) BEGIN_CASE(JSOP_TYPEOF)
BEGIN_CASE(JSOP_TYPEOFEXPR) BEGIN_CASE(JSOP_TYPEOFEXPR)
jsop_typeof(); jsop_typeof();

View File

@ -2665,3 +2665,44 @@ stubs::ArgSub(VMFrame &f, uint32 n)
f.regs.sp[0] = rval; f.regs.sp[0] = rval;
} }
template<JSBool strict>
void JS_FASTCALL
stubs::DelProp(VMFrame &f, JSAtom *atom)
{
JSContext *cx = f.cx;
JSObject *obj = ValueToObject(cx, &f.regs.sp[-1]);
if (!obj)
THROW();
Value rval;
if (!obj->deleteProperty(cx, ATOM_TO_JSID(atom), &rval, strict))
THROW();
f.regs.sp[-1] = rval;
}
template void JS_FASTCALL stubs::DelProp<true>(VMFrame &f, JSAtom *atom);
template void JS_FASTCALL stubs::DelProp<false>(VMFrame &f, JSAtom *atom);
template<JSBool strict>
void JS_FASTCALL
stubs::DelElem(VMFrame &f)
{
JSContext *cx = f.cx;
JSObject *obj = ValueToObject(cx, &f.regs.sp[-2]);
if (!obj)
THROW();
jsid id;
if (!FetchElementId(f, obj, f.regs.sp[-1], id, &f.regs.sp[-1]))
THROW();
if (!obj->deleteProperty(cx, id, &f.regs.sp[-2], strict))
THROW();
}
template void JS_FASTCALL stubs::DelElem<true>(VMFrame &f);
template void JS_FASTCALL stubs::DelElem<false>(VMFrame &f);

View File

@ -145,6 +145,8 @@ template<JSBool strict> void JS_FASTCALL ElemDec(VMFrame &f);
template<JSBool strict> void JS_FASTCALL IncElem(VMFrame &f); template<JSBool strict> void JS_FASTCALL IncElem(VMFrame &f);
template<JSBool strict> void JS_FASTCALL DecElem(VMFrame &f); template<JSBool strict> void JS_FASTCALL DecElem(VMFrame &f);
void JS_FASTCALL CallProp(VMFrame &f, JSAtom *atom); void JS_FASTCALL CallProp(VMFrame &f, JSAtom *atom);
template <JSBool strict> void JS_FASTCALL DelProp(VMFrame &f, JSAtom *atom);
template <JSBool strict> void JS_FASTCALL DelElem(VMFrame &f);
template<JSBool strict> void JS_FASTCALL DefFun(VMFrame &f, JSFunction *fun); template<JSBool strict> void JS_FASTCALL DefFun(VMFrame &f, JSFunction *fun);
JSObject * JS_FASTCALL DefLocalFun(VMFrame &f, JSFunction *fun); JSObject * JS_FASTCALL DefLocalFun(VMFrame &f, JSFunction *fun);