Bug 1132282 - Part 2: Handlify ObjectGroup arguments to NewObject; r=sfink
authorTerrence Cole <terrence@mozilla.com>
Fri, 13 Feb 2015 11:36:40 -0800
changeset 256309 78adb26a80b1d32f986ce49ed305c590ba067a6a
parent 256308 7e497c0b0bad04f76d43d94e469b5a350c0a3598
child 256310 f8556dc2b9856504cdb0fa843b9554010324838d
push id4610
push userjlund@mozilla.com
push dateMon, 30 Mar 2015 18:32:55 +0000
treeherdermozilla-beta@4df54044d9ef [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssfink
bugs1132282
milestone38.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 1132282 - Part 2: Handlify ObjectGroup arguments to NewObject; r=sfink
js/src/jsobj.cpp
--- a/js/src/jsobj.cpp
+++ b/js/src/jsobj.cpp
@@ -1165,28 +1165,26 @@ NewObjectGCKind(const js::Class *clasp)
     if (clasp == &ArrayObject::class_)
         return gc::FINALIZE_OBJECT8;
     if (clasp == &JSFunction::class_)
         return gc::FINALIZE_OBJECT2;
     return gc::FINALIZE_OBJECT4;
 }
 
 static inline JSObject *
-NewObject(ExclusiveContext *cx, ObjectGroup *groupArg, HandleObject parent, gc::AllocKind kind,
+NewObject(ExclusiveContext *cx, HandleObjectGroup group, HandleObject parent, gc::AllocKind kind,
           NewObjectKind newKind)
 {
-    const Class *clasp = groupArg->clasp();
+    const Class *clasp = group->clasp();
 
     MOZ_ASSERT(clasp != &ArrayObject::class_);
     MOZ_ASSERT_IF(clasp == &JSFunction::class_,
                   kind == JSFunction::FinalizeKind || kind == JSFunction::ExtendedFinalizeKind);
     MOZ_ASSERT_IF(parent, &parent->global() == cx->global());
 
-    RootedObjectGroup group(cx, groupArg);
-
     JSObject *metadata = nullptr;
     if (!NewObjectMetadata(cx, &metadata))
         return nullptr;
 
     // For objects which can have fixed data following the object, only use
     // enough fixed slots to cover the number of reserved slots in the object,
     // regardless of the allocation kind specified.
     size_t nfixed = ClassCanHaveFixedData(clasp)
@@ -1257,17 +1255,17 @@ js::NewObjectWithGivenTaggedProto(Exclus
                     MOZ_ASSERT(!obj);
                 }
             } else {
                 gcNumber = rt->gc.gcNumber();
             }
         }
     }
 
-    ObjectGroup *group = ObjectGroup::defaultNewGroup(cxArg, clasp, proto, nullptr);
+    RootedObjectGroup group(cxArg, ObjectGroup::defaultNewGroup(cxArg, clasp, proto, nullptr));
     if (!group)
         return nullptr;
 
     /*
      * Default parent to the parent of the prototype, which was set from
      * the parent of the prototype's constructor.
      */
     RootedObject parent(cxArg, parentArg);
@@ -1435,17 +1433,17 @@ js::NewObjectWithClassProtoCommon(Exclus
         }
     }
 
     RootedObject proto(cxArg, protoArg);
     if (!FindProto(cxArg, clasp, &proto))
         return nullptr;
 
     Rooted<TaggedProto> taggedProto(cxArg, TaggedProto(proto));
-    ObjectGroup *group = ObjectGroup::defaultNewGroup(cxArg, clasp, taggedProto);
+    RootedObjectGroup group(cxArg, ObjectGroup::defaultNewGroup(cxArg, clasp, taggedProto));
     if (!group)
         return nullptr;
 
     JSObject *obj = NewObject(cxArg, group, parent, allocKind, newKind);
     if (!obj)
         return nullptr;
 
     if (entry != -1 && !obj->as<NativeObject>().hasDynamicSlots() &&