зеркало из https://github.com/mozilla/gecko-dev.git
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:
Родитель
ecab1ebe4b
Коммит
63e51221b8
|
@ -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(
|
||||
|
|
Загрузка…
Ссылка в новой задаче