Bug 739520 - rm JSOP_SETLOCALPOP (r=bhackett)

--HG--
extra : rebase_source : d81a637b6b8ba873a78ea6971b3ef5010a0823a3
This commit is contained in:
Luke Wagner 2012-03-26 22:29:55 -07:00
parent 57eb0b35a5
commit 5a664afd4c
10 changed files with 23 additions and 58 deletions

View File

@ -2900,7 +2900,9 @@ EmitDestructuringLHS(JSContext *cx, BytecodeEmitter *bce, ParseNode *pn, VarEmit
case JSOP_SETLOCAL:
{
uint16_t slot = pn->pn_cookie.slot();
EMIT_UINT16_IMM_OP(JSOP_SETLOCALPOP, slot);
EMIT_UINT16_IMM_OP(JSOP_SETLOCAL, slot);
if (Emit1(cx, bce, JSOP_POP) < 0)
return JS_FALSE;
break;
}
@ -3934,7 +3936,9 @@ EmitCatch(JSContext *cx, BytecodeEmitter *bce, ParseNode *pn)
case PNK_NAME:
/* Inline and specialize BindNameToSlot for pn2. */
JS_ASSERT(!pn2->pn_cookie.isFree());
EMIT_UINT16_IMM_OP(JSOP_SETLOCALPOP, pn2->pn_cookie.slot());
EMIT_UINT16_IMM_OP(JSOP_SETLOCAL, pn2->pn_cookie.slot());
if (Emit1(cx, bce, JSOP_POP) < 0)
return false;
break;
default:

View File

@ -517,8 +517,7 @@ ScriptAnalysis::analyzeBytecode(JSContext *cx)
case JSOP_DECLOCAL:
case JSOP_LOCALINC:
case JSOP_LOCALDEC:
case JSOP_SETLOCAL:
case JSOP_SETLOCALPOP: {
case JSOP_SETLOCAL: {
uint32_t local = GET_SLOTNO(pc);
if (local >= script->nfixed) {
localsAliasStack_ = true;
@ -825,8 +824,7 @@ ScriptAnalysis::analyzeLifetimes(JSContext *cx)
}
case JSOP_SETARG:
case JSOP_SETLOCAL:
case JSOP_SETLOCALPOP: {
case JSOP_SETLOCAL: {
uint32_t slot = GetBytecodeSlot(script, pc);
if (!slotEscapes(slot))
killVariable(cx, lifetimes[slot], offset, saved, savedCount);

View File

@ -257,7 +257,6 @@ ExtendedDef(jsbytecode *pc)
case JSOP_ARGINC:
case JSOP_ARGDEC:
case JSOP_SETLOCAL:
case JSOP_SETLOCALPOP:
case JSOP_INCLOCAL:
case JSOP_DECLOCAL:
case JSOP_LOCALINC:
@ -385,7 +384,6 @@ static inline uint32_t GetBytecodeSlot(JSScript *script, jsbytecode *pc)
case JSOP_GETLOCAL:
case JSOP_CALLLOCAL:
case JSOP_SETLOCAL:
case JSOP_SETLOCALPOP:
case JSOP_INCLOCAL:
case JSOP_DECLOCAL:
case JSOP_LOCALINC:
@ -408,7 +406,6 @@ BytecodeUpdatesSlot(JSOp op)
switch (op) {
case JSOP_SETARG:
case JSOP_SETLOCAL:
case JSOP_SETLOCALPOP:
case JSOP_INCARG:
case JSOP_DECARG:
case JSOP_ARGINC:

View File

@ -3621,8 +3621,7 @@ ScriptAnalysis::analyzeTypesBytecode(JSContext *cx, unsigned offset,
}
case JSOP_SETARG:
case JSOP_SETLOCAL:
case JSOP_SETLOCALPOP: {
case JSOP_SETLOCAL: {
uint32_t slot = GetBytecodeSlot(script, pc);
if (!trackSlot(slot) && slot < TotalSlots(script)) {
TypeSet *types = TypeScript::SlotTypes(script, slot);

View File

@ -1714,6 +1714,7 @@ ADD_EMPTY_CASE(JSOP_UNUSED27)
ADD_EMPTY_CASE(JSOP_UNUSED28)
ADD_EMPTY_CASE(JSOP_UNUSED29)
ADD_EMPTY_CASE(JSOP_UNUSED30)
ADD_EMPTY_CASE(JSOP_UNUSED31)
ADD_EMPTY_CASE(JSOP_CONDSWITCH)
ADD_EMPTY_CASE(JSOP_TRY)
#if JS_HAS_XML_SUPPORT
@ -3458,14 +3459,6 @@ BEGIN_CASE(JSOP_THROW)
/* let the code at error try to catch the exception. */
goto error;
}
BEGIN_CASE(JSOP_SETLOCALPOP)
/*
* The stack must have a block with at least one local slot below the
* exception object.
*/
JS_ASSERT((size_t) (regs.sp - regs.fp()->base()) >= 2);
POP_COPY_TO(regs.fp()->localSlot(GET_UINT16(regs.pc)));
END_CASE(JSOP_SETLOCALPOP)
BEGIN_CASE(JSOP_INSTANCEOF)
{

View File

@ -1980,9 +1980,6 @@ DecompileDestructuringLHS(SprintStack *ss, jsbytecode *pc, jsbytecode *endpc, JS
case JSOP_SETLOCAL:
LOCAL_ASSERT(!letNames);
LOCAL_ASSERT(pc[oplen] == JSOP_POP || pc[oplen] == JSOP_POPN);
/* FALL THROUGH */
case JSOP_SETLOCALPOP:
LOCAL_ASSERT(!letNames);
if (op == JSOP_SETARG) {
atom = GetArgOrVarAtom(jp, GET_SLOTNO(pc));
LOCAL_ASSERT(atom);
@ -1998,15 +1995,13 @@ DecompileDestructuringLHS(SprintStack *ss, jsbytecode *pc, jsbytecode *endpc, JS
if (!lval || ss->sprinter.put(lval) < 0)
return NULL;
}
if (op != JSOP_SETLOCALPOP) {
pc += oplen;
if (pc == endpc)
return pc;
LOAD_OP_DATA(pc);
if (op == JSOP_POPN)
return pc;
LOCAL_ASSERT(op == JSOP_POP);
}
pc += oplen;
if (pc == endpc)
return pc;
LOAD_OP_DATA(pc);
if (op == JSOP_POPN)
return pc;
LOCAL_ASSERT(op == JSOP_POP);
break;
default: {
@ -3282,8 +3277,10 @@ Decompile(SprintStack *ss, jsbytecode *pc, int nb)
js_puts(jp, lval);
} else {
#endif
LOCAL_ASSERT(*pc == JSOP_SETLOCALPOP);
pc += JSOP_SETLOCALPOP_LENGTH;
LOCAL_ASSERT(*pc == JSOP_SETLOCAL);
pc += JSOP_SETLOCAL_LENGTH;
LOCAL_ASSERT(*pc == JSOP_POP);
pc += JSOP_POP_LENGTH;
LOCAL_ASSERT(blockObj.slotCount() >= 1);
if (!QuoteString(&jp->sprinter, atoms[0], 0))
return NULL;
@ -3550,7 +3547,6 @@ Decompile(SprintStack *ss, jsbytecode *pc, int nb)
break;
case JSOP_SETLOCAL:
case JSOP_SETLOCALPOP:
if (IsVarSlot(jp, pc, &i)) {
atom = GetArgOrVarAtom(jp, i);
LOCAL_ASSERT(atom);
@ -4246,14 +4242,6 @@ Decompile(SprintStack *ss, jsbytecode *pc, int nb)
Sprint(&ss->sprinter, "%s%s = ", prefix, lval);
SprintOpcode(ss, rval, rvalpc, pc, todo);
}
if (op == JSOP_SETLOCALPOP) {
if (!PushOff(ss, todo, saveop))
return NULL;
rval = POP_STR();
LOCAL_ASSERT(*rval != '\0');
js_printf(jp, "\t%s;\n", rval);
todo = -2;
}
break;
case JSOP_NEW:

View File

@ -348,11 +348,7 @@ OPDEF(JSOP_LAMBDA, 130, "lambda", NULL, 5, 0, 1, 19, JOF_OBJECT
/* Used for named function expression self-naming, if lightweight. */
OPDEF(JSOP_CALLEE, 131, "callee", NULL, 1, 0, 1, 19, JOF_BYTE)
/*
* Like JSOP_SETLOCAL, but specialized to avoid requiring JSOP_POP immediately
* after to throw away the exception value.
*/
OPDEF(JSOP_SETLOCALPOP, 132, "setlocalpop", NULL, 3, 1, 0, 3, JOF_LOCAL|JOF_NAME|JOF_SET)
OPDEF(JSOP_UNUSED31, 132, "unused31", NULL, 1, 0, 0, 0, JOF_BYTE)
/* Pick an element from the stack. */
OPDEF(JSOP_PICK, 133, "pick", NULL, 2, 0, 0, 0, JOF_UINT8|JOF_TMPSLOT2)

View File

@ -2868,15 +2868,6 @@ mjit::Compiler::generateMethod()
}
END_CASE(JSOP_SETLOCAL)
BEGIN_CASE(JSOP_SETLOCALPOP)
{
uint32_t slot = GET_SLOTNO(PC);
frame.storeLocal(slot, true);
frame.pop();
updateVarType();
}
END_CASE(JSOP_SETLOCALPOP)
BEGIN_CASE(JSOP_UINT16)
frame.push(Value(Int32Value((int32_t) GET_UINT16(PC))));
END_CASE(JSOP_UINT16)

View File

@ -1917,7 +1917,6 @@ LoopState::analyzeLoopBody(unsigned frame)
case JSOP_THIS:
case JSOP_GETLOCAL:
case JSOP_SETLOCAL:
case JSOP_SETLOCALPOP:
case JSOP_INCLOCAL:
case JSOP_DECLOCAL:
case JSOP_LOCALINC:

View File

@ -55,7 +55,7 @@ namespace js {
* and saved versions. If deserialization fails, the data should be
* invalidated if possible.
*/
static const uint32_t XDR_BYTECODE_VERSION = uint32_t(0xb973c0de - 112);
static const uint32_t XDR_BYTECODE_VERSION = uint32_t(0xb973c0de - 113);
class XDRBuffer {
public: