Bug 1619007 - Part 3: Call NewPlainObjectWithProperties instead of reimplementing it. r=mgaudet

Depends on D65769

Differential Revision: https://phabricator.services.mozilla.com/D65771

--HG--
extra : moz-landing-system : lando
This commit is contained in:
André Bargull 2020-03-06 20:24:40 +00:00
Родитель ecab1ebe4b
Коммит 63e51221b8
2 изменённых файлов: 3 добавлений и 18 удалений

Просмотреть файл

@ -9097,7 +9097,7 @@ MOZ_NEVER_INLINE bool BytecodeEmitter::emitObject(ListNode* objNode,
ObjLiteralFlags flags;
if (isSingletonContext) {
// Use `ObjectGroup::newPlainObject` rather than
// `NewBuiltinClassInstance<PlainObject>`.
// `NewPlainObjectWithProperties`.
flags += ObjLiteralFlag::SpecificGroup;
if (!isInner) {
flags += ObjLiteralFlag::Singleton;

Просмотреть файл

@ -91,23 +91,8 @@ static JSObject* InterpretObjLiteralObj(
singleton ? SingletonObject : TenuredObject);
}
gc::AllocKind allocKind = gc::GetGCObjectKind(properties.length());
RootedPlainObject result(
cx, NewBuiltinClassInstance<PlainObject>(cx, allocKind, TenuredObject));
if (!result) {
return nullptr;
}
Rooted<JS::PropertyKey> propKey(cx);
for (const auto& kvPair : properties) {
propKey.set(kvPair.id);
propVal.set(kvPair.value);
if (!NativeDefineDataProperty(cx, result, propKey, propVal,
JSPROP_ENUMERATE)) {
return nullptr;
}
}
return result;
return NewPlainObjectWithProperties(cx, properties.begin(),
properties.length(), TenuredObject);
}
static JSObject* InterpretObjLiteralArray(