diff --git a/js/src/frontend/BytecodeEmitter.cpp b/js/src/frontend/BytecodeEmitter.cpp index 17618b3014d..06847404ad3 100644 --- a/js/src/frontend/BytecodeEmitter.cpp +++ b/js/src/frontend/BytecodeEmitter.cpp @@ -2788,7 +2788,8 @@ EmitNameOp(JSContext *cx, BytecodeEmitter *bce, ParseNode *pn, JSBool callContex if (op == JSOP_ARGUMENTS || op == JSOP_CALLEE) { if (Emit1(cx, bce, op) < 0) return JS_FALSE; - if (callContext && Emit1(cx, bce, JSOP_PUSH) < 0) + /* Need to provide |this| value for call */ + if (callContext && Emit1(cx, bce, JSOP_UNDEFINED) < 0) return JS_FALSE; } else { if (!pn->pn_cookie.isFree()) { @@ -6075,7 +6076,8 @@ EmitReturn(JSContext *cx, BytecodeEmitter *bce, ParseNode *pn) if (!EmitTree(cx, bce, pn2)) return false; } else { - if (Emit1(cx, bce, JSOP_PUSH) < 0) + /* No explicit return value provided */ + if (Emit1(cx, bce, JSOP_UNDEFINED) < 0) return false; } @@ -6355,9 +6357,9 @@ EmitCallOrNew(JSContext *cx, BytecodeEmitter *bce, ParseNode *pn, ptrdiff_t top) * in jsinterp.cpp for JSOP_LAMBDA followed by JSOP_{SET,INIT}PROP. * * Then (or in a call case that has no explicit reference-base - * object) we emit JSOP_PUSH to produce the |this| slot required - * for calls (which non-strict mode functions will box into the - * global object). + * object) we emit JSOP_UNDEFINED to produce the undefined |this| + * value required for calls (which non-strict mode functions + * will box into the global object). */ ParseNode *pn2 = pn->pn_head; switch (pn2->getKind()) { @@ -6379,16 +6381,16 @@ EmitCallOrNew(JSContext *cx, BytecodeEmitter *bce, ParseNode *pn, ptrdiff_t top) JS_ASSERT(pn2->isOp(JSOP_XMLNAME)); if (!EmitXMLName(cx, pn2, JSOP_CALLXMLNAME, bce)) return false; - callop = true; /* suppress JSOP_PUSH after */ + callop = true; /* suppress JSOP_UNDEFINED after */ break; #endif default: if (!EmitTree(cx, bce, pn2)) return false; - callop = false; /* trigger JSOP_PUSH after */ + callop = false; /* trigger JSOP_UNDEFINED after */ break; } - if (!callop && Emit1(cx, bce, JSOP_PUSH) < 0) + if (!callop && Emit1(cx, bce, JSOP_UNDEFINED) < 0) return false; /* Remember start of callable-object bytecode for decompilation hint. */ @@ -7027,7 +7029,7 @@ frontend::EmitTree(JSContext *cx, BytecodeEmitter *bce, ParseNode *pn) if (!EmitTree(cx, bce, pn->pn_kid)) return JS_FALSE; } else { - if (Emit1(cx, bce, JSOP_PUSH) < 0) + if (Emit1(cx, bce, JSOP_UNDEFINED) < 0) return JS_FALSE; } if (pn->pn_hidden && NewSrcNote(cx, bce, SRC_HIDDEN) < 0) diff --git a/js/src/jsinfer.cpp b/js/src/jsinfer.cpp index 355b6d4e06c..99b53dd8063 100644 --- a/js/src/jsinfer.cpp +++ b/js/src/jsinfer.cpp @@ -3421,7 +3421,7 @@ ScriptAnalysis::analyzeTypesBytecode(JSContext *cx, unsigned offset, /* Bytecodes pushing values of known type. */ case JSOP_VOID: - case JSOP_PUSH: + case JSOP_UNDEFINED: pushed[0].addType(cx, Type::UndefinedType()); break; case JSOP_ZERO: diff --git a/js/src/jsinterp.cpp b/js/src/jsinterp.cpp index 6b5f8ca2d98..616f5283af5 100644 --- a/js/src/jsinterp.cpp +++ b/js/src/jsinterp.cpp @@ -1995,9 +1995,9 @@ END_CASE(JSOP_LINENO) BEGIN_CASE(JSOP_BLOCKCHAIN) END_CASE(JSOP_BLOCKCHAIN) -BEGIN_CASE(JSOP_PUSH) +BEGIN_CASE(JSOP_UNDEFINED) PUSH_UNDEFINED(); -END_CASE(JSOP_PUSH) +END_CASE(JSOP_UNDEFINED) BEGIN_CASE(JSOP_POP) regs.sp--; diff --git a/js/src/jsopcode.cpp b/js/src/jsopcode.cpp index e2a74e4b09c..d2008adbab2 100644 --- a/js/src/jsopcode.cpp +++ b/js/src/jsopcode.cpp @@ -1917,7 +1917,7 @@ DecompileGroupAssignment(SprintStack *ss, jsbytecode *pc, jsbytecode *endpc, const char *rval; LOAD_OP_DATA(pc); - LOCAL_ASSERT(op == JSOP_PUSH || op == JSOP_GETLOCAL); + LOCAL_ASSERT(op == JSOP_GETLOCAL); todo = Sprint(&ss->sprinter, "%s[", VarPrefix(sn)); if (todo < 0 || !PushOff(ss, todo, JSOP_NOP)) @@ -1934,7 +1934,7 @@ DecompileGroupAssignment(SprintStack *ss, jsbytecode *pc, jsbytecode *endpc, if (pc == endpc) return pc; LOAD_OP_DATA(pc); - if (op != JSOP_PUSH && op != JSOP_GETLOCAL) + if (op != JSOP_GETLOCAL) break; if (!hole && SprintPut(&ss->sprinter, ", ", 2) < 0) return NULL; @@ -2548,20 +2548,6 @@ Decompile(SprintStack *ss, jsbytecode *pc, intN nb) } break; - case JSOP_PUSH: -#if JS_HAS_DESTRUCTURING - sn = js_GetSrcNote(jp->script, pc); - if (sn && SN_TYPE(sn) == SRC_GROUPASSIGN) { - pc = DecompileGroupAssignment(ss, pc, endpc, sn, &todo); - if (!pc) - return NULL; - LOCAL_ASSERT(*pc == JSOP_POPN); - len = oplen = JSOP_POPN_LENGTH; - goto end_groupassignment; - } -#endif - /* FALL THROUGH */ - case JSOP_BINDNAME: case JSOP_BINDGNAME: todo = Sprint(&ss->sprinter, ""); @@ -4193,8 +4179,8 @@ Decompile(SprintStack *ss, jsbytecode *pc, intN nb) LOCAL_ASSERT(*pc == JSOP_NULLBLOCKCHAIN); pc += JSOP_NULLBLOCKCHAIN_LENGTH; } - LOCAL_ASSERT(*pc == JSOP_PUSH); - pc += JSOP_PUSH_LENGTH; + LOCAL_ASSERT(*pc == JSOP_UNDEFINED); + pc += JSOP_UNDEFINED_LENGTH; LOCAL_ASSERT(*pc == JSOP_CALL); LOCAL_ASSERT(GET_ARGC(pc) == 0); len = JSOP_CALL_LENGTH; @@ -5225,10 +5211,6 @@ DecompileExpression(JSContext *cx, JSScript *script, JSFunction *fun, JS_ASSERT(op != JSOP_CASE && op != JSOP_CASEX && op != JSOP_DUP && op != JSOP_DUP2); - /* JSOP_PUSH is used to generate undefined for group assignment holes. */ - if (op == JSOP_PUSH) - return JS_strdup(cx, js_undefined_str); - /* * |this| could convert to a very long object initialiser, so cite it by * its keyword name instead. diff --git a/js/src/jsopcode.tbl b/js/src/jsopcode.tbl index f99adf415a0..9067f7877c0 100644 --- a/js/src/jsopcode.tbl +++ b/js/src/jsopcode.tbl @@ -113,7 +113,7 @@ OPDEF(JSOP_NOP, 0, "nop", NULL, 1, 0, 0, 0, JOF_BYTE) /* Long-standing JavaScript bytecodes. */ -OPDEF(JSOP_PUSH, 1, "push", NULL, 1, 0, 1, 0, JOF_BYTE) +OPDEF(JSOP_UNDEFINED, 1, js_undefined_str, "", 1, 0, 1, 0, JOF_BYTE) OPDEF(JSOP_POPV, 2, "popv", NULL, 1, 1, 0, 2, JOF_BYTE) OPDEF(JSOP_ENTERWITH, 3, "enterwith", NULL, 1, 1, 1, 0, JOF_BYTE|JOF_PARENHEAD) OPDEF(JSOP_LEAVEWITH, 4, "leavewith", NULL, 1, 1, 0, 0, JOF_BYTE) diff --git a/js/src/methodjit/Compiler.cpp b/js/src/methodjit/Compiler.cpp index 583785363e5..1f806ccfebc 100644 --- a/js/src/methodjit/Compiler.cpp +++ b/js/src/methodjit/Compiler.cpp @@ -1681,9 +1681,9 @@ mjit::Compiler::generateMethod() BEGIN_CASE(JSOP_NOP) END_CASE(JSOP_NOP) - BEGIN_CASE(JSOP_PUSH) + BEGIN_CASE(JSOP_UNDEFINED) frame.push(UndefinedValue()); - END_CASE(JSOP_PUSH) + END_CASE(JSOP_UNDEFINED) BEGIN_CASE(JSOP_POPV) BEGIN_CASE(JSOP_SETRVAL)