mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1153057 - Properly initialize the [[HomeObject]] of methods with computed property names. (r=jorendorff)
This commit is contained in:
parent
0777bf19a9
commit
7a041ef5f2
@ -6755,7 +6755,7 @@ BytecodeEmitter::emitPropertyList(ParseNode* pn, MutableHandlePlainObject objp,
|
||||
propdef->pn_right->pn_funbox->needsHomeObject())
|
||||
{
|
||||
MOZ_ASSERT(propdef->pn_right->pn_funbox->function()->isMethod());
|
||||
if (!emit1(JSOP_INITHOMEOBJECT))
|
||||
if (!emit2(JSOP_INITHOMEOBJECT, isIndex))
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -7112,7 +7112,7 @@ BytecodeEmitter::emitClass(ParseNode* pn)
|
||||
return false;
|
||||
|
||||
if (constructor->pn_funbox->needsHomeObject()) {
|
||||
if (!emit1(JSOP_INITHOMEOBJECT))
|
||||
if (!emit2(JSOP_INITHOMEOBJECT, 0))
|
||||
return false;
|
||||
}
|
||||
|
||||
|
1
js/src/jit-test/tests/basic/bug1153057.js
Normal file
1
js/src/jit-test/tests/basic/bug1153057.js
Normal file
@ -0,0 +1 @@
|
||||
({ "0"() { eval(); } });
|
@ -1,4 +1,3 @@
|
||||
print("foo");
|
||||
var test = `
|
||||
|
||||
// This is super weird. A super property reference in the spec contains two
|
||||
@ -18,10 +17,12 @@ class derived extends base {
|
||||
constructor() { }
|
||||
test(expected) { super.test(expected); }
|
||||
testArrow() { return (() => super.test(this)); }
|
||||
["testCPN"](expected) { super.test(expected); }
|
||||
}
|
||||
|
||||
let derivedInstance = new derived();
|
||||
derivedInstance.test(derivedInstance);
|
||||
derivedInstance.testCPN(derivedInstance);
|
||||
|
||||
let obj = { test: derivedInstance.test };
|
||||
obj.test(obj);
|
||||
|
@ -3970,7 +3970,8 @@ END_CASE(JSOP_OBJWITHPROTO)
|
||||
|
||||
CASE(JSOP_INITHOMEOBJECT)
|
||||
{
|
||||
MOZ_ASSERT(REGS.stackDepth() >= 2);
|
||||
uint8_t skipOver = GET_UINT8(REGS.pc);
|
||||
MOZ_ASSERT(REGS.stackDepth() >= 2 + skipOver);
|
||||
|
||||
/* Load the function to be initialized */
|
||||
RootedFunction& func = rootFunction0;
|
||||
@ -3979,7 +3980,7 @@ CASE(JSOP_INITHOMEOBJECT)
|
||||
|
||||
/* Load the home object */
|
||||
RootedNativeObject& obj = rootNativeObject0;
|
||||
obj = ®S.sp[-2].toObject().as<NativeObject>();
|
||||
obj = ®S.sp[-2 - skipOver].toObject().as<NativeObject>();
|
||||
MOZ_ASSERT(obj->is<PlainObject>() || obj->is<JSFunction>());
|
||||
|
||||
func->setExtendedSlot(FunctionExtended::METHOD_HOMEOBJECT_SLOT, ObjectValue(*obj));
|
||||
|
@ -870,10 +870,10 @@
|
||||
* the set, and leaves both on the stack.
|
||||
* Category: Literals
|
||||
* Type: Object
|
||||
* Operands:
|
||||
* Stack: homeObject, fun => homeObject, fun
|
||||
* Operands: uint8_t n
|
||||
* Stack: homeObject, [...n], fun => homeObject, [...n], fun
|
||||
*/\
|
||||
macro(JSOP_INITHOMEOBJECT, 92, "inithomeobject", NULL, 1, 2, 2, JOF_BYTE|JOF_SET|JOF_DETECTING) \
|
||||
macro(JSOP_INITHOMEOBJECT, 92, "inithomeobject", NULL, 2, 2, 2, JOF_UINT8) \
|
||||
\
|
||||
/*
|
||||
* Initialize a named property in an object literal, like '{a: x}'.
|
||||
|
Loading…
Reference in New Issue
Block a user