Bug 1521509: Remove superfluous call to JSObject::setSingleton in NewObjectOperation. r=tcampbell
authorAndré Bargull <andre.bargull@gmail.com>
Mon, 21 Jan 2019 05:57:02 -0800
changeset 514822 7a6c6a3752664e1bfa0f02d0f58c8f03a9c77b41
parent 514821 ed955b30c2f0fc92dbb4844d4fe8a868ee8378d3
child 514823 fb87ba30098c91ee7f8a3b8c59b9e344d3a5525a
push id1953
push userffxbld-merge
push dateMon, 11 Mar 2019 12:10:20 +0000
treeherdermozilla-release@9c35dcbaa899 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerstcampbell
bugs1521509
milestone66.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1521509: Remove superfluous call to JSObject::setSingleton in NewObjectOperation. r=tcampbell
js/src/vm/Interpreter.cpp
js/src/vm/JSObject-inl.h
--- a/js/src/vm/Interpreter.cpp
+++ b/js/src/vm/Interpreter.cpp
@@ -5171,19 +5171,17 @@ JSObject* js::NewObjectOperation(JSConte
     obj = NewBuiltinClassInstance<PlainObject>(cx, newKind);
   }
 
   if (!obj) {
     return nullptr;
   }
 
   if (newKind == SingletonObject) {
-    if (!JSObject::setSingleton(cx, obj)) {
-      return nullptr;
-    }
+    MOZ_ASSERT(obj->isSingleton());
   } else {
     obj->setGroup(group);
 
     AutoSweepObjectGroup sweep(group);
     if (PreliminaryObjectArray* preliminaryObjects =
             group->maybePreliminaryObjects(sweep)) {
       preliminaryObjects->registerNewObject(obj);
     }
--- a/js/src/vm/JSObject-inl.h
+++ b/js/src/vm/JSObject-inl.h
@@ -128,16 +128,17 @@ js::NativeObject::updateDictionaryListPo
   if (shape()->listp == old->shapePtr()) {
     shape()->listp = shapePtr();
   }
 }
 
 /* static */ inline bool JSObject::setSingleton(JSContext* cx,
                                                 js::HandleObject obj) {
   MOZ_ASSERT(!IsInsideNursery(obj));
+  MOZ_ASSERT(!obj->isSingleton());
 
   js::ObjectGroup* group = js::ObjectGroup::lazySingletonGroup(
       cx, obj->group_, obj->getClass(), obj->taggedProto());
   if (!group) {
     return false;
   }
 
   obj->group_ = group;