зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1146472 part 2. Use JSOP_NEWOBJECT as needed even if the script is not compile-and-go. r=luke
This commit is contained in:
Родитель
64eb476fc9
Коммит
da29ffd385
|
@ -2223,8 +2223,6 @@ BytecodeEmitter::emitNewInit(JSProtoKey key)
|
|||
static bool
|
||||
IteratorResultShape(ExclusiveContext *cx, BytecodeEmitter *bce, unsigned *shape)
|
||||
{
|
||||
MOZ_ASSERT(bce->script->compileAndGo());
|
||||
|
||||
RootedPlainObject obj(cx);
|
||||
// No need to do any guessing for the object kind, since we know exactly how
|
||||
// many properties we plan to have.
|
||||
|
@ -2258,14 +2256,10 @@ IteratorResultShape(ExclusiveContext *cx, BytecodeEmitter *bce, unsigned *shape)
|
|||
bool
|
||||
BytecodeEmitter::emitPrepareIteratorResult()
|
||||
{
|
||||
if (script->compileAndGo()) {
|
||||
unsigned shape;
|
||||
if (!IteratorResultShape(cx, this, &shape))
|
||||
return false;
|
||||
return emitIndex32(JSOP_NEWOBJECT, shape);
|
||||
}
|
||||
|
||||
return emitNewInit(JSProto_Object);
|
||||
unsigned shape;
|
||||
if (!IteratorResultShape(cx, this, &shape))
|
||||
return false;
|
||||
return emitIndex32(JSOP_NEWOBJECT, shape);
|
||||
}
|
||||
|
||||
bool
|
||||
|
@ -6587,14 +6581,12 @@ BytecodeEmitter::emitObject(ParseNode *pn)
|
|||
* JSOP_NEWOBJECT with the final shape instead.
|
||||
*/
|
||||
RootedPlainObject obj(cx);
|
||||
if (script->compileAndGo()) {
|
||||
// No need to do any guessing for the object kind, since we know exactly
|
||||
// how many properties we plan to have.
|
||||
gc::AllocKind kind = gc::GetGCObjectKind(pn->pn_count);
|
||||
obj = NewBuiltinClassInstance<PlainObject>(cx, kind, TenuredObject);
|
||||
if (!obj)
|
||||
return false;
|
||||
}
|
||||
// No need to do any guessing for the object kind, since we know exactly
|
||||
// how many properties we plan to have.
|
||||
gc::AllocKind kind = gc::GetGCObjectKind(pn->pn_count);
|
||||
obj = NewBuiltinClassInstance<PlainObject>(cx, kind, TenuredObject);
|
||||
if (!obj)
|
||||
return false;
|
||||
|
||||
if (!emitPropertyList(pn, &obj, ObjectLiteral))
|
||||
return false;
|
||||
|
|
Загрузка…
Ссылка в новой задаче