Bug 1141862 - Part 5: Change JSOP_SETCALL to JSOP_THROWMSG, anticipating future use. (r=jorendorff)

This commit is contained in:
Eric Faust 2015-04-02 19:20:17 -07:00
parent 4abd8b284a
commit 920476bbc7
7 changed files with 21 additions and 19 deletions

View File

@ -6148,7 +6148,7 @@ BytecodeEmitter::emitCallOrNew(ParseNode* pn)
return false;
}
if (pn->pn_xflags & PNX_SETCALL) {
if (!emit1(JSOP_SETCALL))
if (!emitUint16Operand(JSOP_THROWMSG, JSMSG_BAD_LEFTSIDE_OF_ASS))
return false;
}
return true;

View File

@ -2901,14 +2901,15 @@ BaselineCompiler::emit_JSOP_TYPEOFEXPR()
return emit_JSOP_TYPEOF();
}
typedef bool (*SetCallFn)(JSContext*);
static const VMFunction SetCallInfo = FunctionInfo<SetCallFn>(js::SetCallOperation);
typedef bool (*ThrowMsgFn)(JSContext*, const unsigned);
static const VMFunction ThrowMsgInfo = FunctionInfo<ThrowMsgFn>(js::ThrowMsgOperation);
bool
BaselineCompiler::emit_JSOP_SETCALL()
BaselineCompiler::emit_JSOP_THROWMSG()
{
prepareVMCall();
return callVM(SetCallInfo);
pushArg(Imm32(GET_UINT16(pc)));
return callVM(ThrowMsgInfo);
}
typedef bool (*ThrowFn)(JSContext*, HandleValue);

View File

@ -163,7 +163,7 @@ namespace jit {
_(JSOP_INSTANCEOF) \
_(JSOP_TYPEOF) \
_(JSOP_TYPEOFEXPR) \
_(JSOP_SETCALL) \
_(JSOP_THROWMSG) \
_(JSOP_THROW) \
_(JSOP_THROWING) \
_(JSOP_TRY) \

View File

@ -2923,12 +2923,12 @@ CASE(JSOP_FUNCALL)
ADVANCE_AND_DISPATCH(0);
}
CASE(JSOP_SETCALL)
CASE(JSOP_THROWMSG)
{
JS_ALWAYS_FALSE(SetCallOperation(cx));
JS_ALWAYS_FALSE(ThrowMsgOperation(cx, GET_UINT16(REGS.pc)));
goto error;
}
END_CASE(JSOP_SETCALL)
END_CASE(JSOP_THROWMSG)
CASE(JSOP_IMPLICITTHIS)
CASE(JSOP_GIMPLICITTHIS)
@ -4133,9 +4133,9 @@ js::DefFunOperation(JSContext* cx, HandleScript script, HandleObject scopeChain,
}
bool
js::SetCallOperation(JSContext* cx)
js::ThrowMsgOperation(JSContext* cx, const unsigned errorNum)
{
JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_BAD_LEFTSIDE_OF_ASS);
JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, errorNum);
return false;
}

View File

@ -399,7 +399,7 @@ bool
DefFunOperation(JSContext* cx, HandleScript script, HandleObject scopeChain, HandleFunction funArg);
bool
SetCallOperation(JSContext* cx);
ThrowMsgOperation(JSContext* cx, const unsigned errorNum);
bool
GetAndClearException(JSContext* cx, MutableHandleValue res);

View File

@ -677,15 +677,16 @@
macro(JSOP_STRICTNE, 73, "strictne", "!==", 1, 2, 1, JOF_BYTE|JOF_DETECTING|JOF_LEFTASSOC|JOF_ARITH) \
\
/*
* Sometimes web pages do 'o.Item(i) = j'. This is not an early SyntaxError,
* for web compatibility. Instead we emit JSOP_SETCALL after the function
* call, an opcode that always throws.
* Sometimes we know when emitting that an operation will always throw.
*
* Throws the indicated JSMSG.
*
* Category: Statements
* Type: Function
* Operands:
* Type: Exceptions
* Operands: uint16_t msgNumber
* Stack: =>
*/ \
macro(JSOP_SETCALL, 74, "setcall", NULL, 1, 0, 0, JOF_BYTE) \
macro(JSOP_THROWMSG, 74, "throwmsg", NULL, 3, 0, 0, JOF_UINT16) \
\
/*
* Sets up a for-in or for-each-in loop using the JSITER_* flag bits in

View File

@ -29,7 +29,7 @@ namespace js {
*
* https://developer.mozilla.org/en-US/docs/SpiderMonkey/Internals/Bytecode
*/
static const uint32_t XDR_BYTECODE_VERSION_SUBTRAHEND = 272;
static const uint32_t XDR_BYTECODE_VERSION_SUBTRAHEND = 273;
static const uint32_t XDR_BYTECODE_VERSION =
uint32_t(0xb973c0de - XDR_BYTECODE_VERSION_SUBTRAHEND);