зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1146472 part 1. Don't do object-kind guessing for object literal templates in scripts, since we in fact know exactly how many slots we want them to have and hence what the kind should be. r=terrence
This commit is contained in:
Родитель
6f0fc8160b
Коммит
64eb476fc9
|
@ -2226,7 +2226,9 @@ IteratorResultShape(ExclusiveContext *cx, BytecodeEmitter *bce, unsigned *shape)
|
|||
MOZ_ASSERT(bce->script->compileAndGo());
|
||||
|
||||
RootedPlainObject obj(cx);
|
||||
gc::AllocKind kind = GuessObjectGCKind(2);
|
||||
// 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(2);
|
||||
obj = NewBuiltinClassInstance<PlainObject>(cx, kind);
|
||||
if (!obj)
|
||||
return false;
|
||||
|
@ -6586,7 +6588,9 @@ BytecodeEmitter::emitObject(ParseNode *pn)
|
|||
*/
|
||||
RootedPlainObject obj(cx);
|
||||
if (script->compileAndGo()) {
|
||||
gc::AllocKind kind = GuessObjectGCKind(pn->pn_count);
|
||||
// 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;
|
||||
|
|
|
@ -2107,7 +2107,7 @@ JSObject *
|
|||
js::CloneObjectLiteral(JSContext *cx, HandleObject srcObj)
|
||||
{
|
||||
if (srcObj->is<PlainObject>()) {
|
||||
AllocKind kind = GetBackgroundAllocKind(GuessObjectGCKind(srcObj->as<PlainObject>().numFixedSlots()));
|
||||
AllocKind kind = GetBackgroundAllocKind(gc::GetGCObjectKind(srcObj->as<PlainObject>().numFixedSlots()));
|
||||
MOZ_ASSERT_IF(srcObj->isTenured(), kind == srcObj->asTenured().getAllocKind());
|
||||
|
||||
RootedObject proto(cx, cx->global()->getOrCreateObjectPrototype(cx));
|
||||
|
|
Загрузка…
Ссылка в новой задаче