Bug 1066234 - Part 4: Implement JSOP_FUNWITHPROTO. (r=jorendorff)

This commit is contained in:
Eric Faust 2015-03-10 20:27:34 -07:00
parent 74e933f6e1
commit b9e5961ff5
3 changed files with 27 additions and 3 deletions

View File

@ -1650,7 +1650,6 @@ CASE(EnableInterruptsPseudoOpcode)
/* Various 1-byte no-ops. */
CASE(JSOP_NOP)
CASE(JSOP_UNUSED2)
CASE(JSOP_UNUSED52)
CASE(JSOP_UNUSED83)
CASE(JSOP_UNUSED92)
CASE(JSOP_UNUSED103)
@ -3559,6 +3558,24 @@ CASE(JSOP_CLASSHERITAGE)
}
END_CASE(JSOP_CLASSHERITAGE)
CASE(JSOP_FUNWITHPROTO)
{
RootedObject &proto = rootObject1;
proto = &REGS.sp[-1].toObject();
/* Load the specified function object literal. */
RootedFunction &fun = rootFunction0;
fun = script->getFunction(GET_UINT32_INDEX(REGS.pc));
JSObject *obj = CloneFunctionObjectIfNotSingleton(cx, fun, REGS.fp()->scopeChain(),
proto, GenericObject);
if (!obj)
goto error;
REGS.sp[-1].setObject(*obj);
}
END_CASE(JSOP_FUNWITHPROTO)
DEFAULT()
{
char numBuf[12];

View File

@ -489,7 +489,14 @@
* Stack: heritage => objProto, funcProto
*/ \
macro(JSOP_CLASSHERITAGE, 51, "classheritage", NULL, 1, 1, 2, JOF_BYTE) \
macro(JSOP_UNUSED52, 52, "unused52", NULL, 1, 0, 0, JOF_BYTE) \
/*
* Pushes a clone of a function with a given [[Prototype]] onto the stack.
* Category: Statements
* Type: Function
* Operands: uint32_t funcIndex
* Stack: proto => obj
*/ \
macro(JSOP_FUNWITHPROTO, 52, "funwithproto", NULL, 5, 1, 1, JOF_OBJECT) \
\
/*
* Pops the top of stack value, pushes property of it onto the stack.

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 = 253;
static const uint32_t XDR_BYTECODE_VERSION_SUBTRAHEND = 254;
static const uint32_t XDR_BYTECODE_VERSION =
uint32_t(0xb973c0de - XDR_BYTECODE_VERSION_SUBTRAHEND);