Bug 1186626 - Part 4: Convert ShapeVectors in jsobj.cpp; r=jonco
authorTerrence Cole <terrence@mozilla.com>
Thu, 23 Jul 2015 08:19:08 -0700
changeset 256200 6cc0bc6b707daff1ca9fb66db299d2bb930baa1e
parent 256199 30a773d3e4c158eb6bf5a7692db7e64a5d31c44a
child 256201 7cbb4de9b9c621f6cf1bf805cfa4376432b63e67
push id63254
push usertcole@mozilla.com
push dateTue, 04 Aug 2015 22:13:58 +0000
treeherdermozilla-inbound@a220d2e6b904 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjonco
bugs1186626
milestone42.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 1186626 - Part 4: Convert ShapeVectors in jsobj.cpp; r=jonco
js/src/jsobj.cpp
--- a/js/src/jsobj.cpp
+++ b/js/src/jsobj.cpp
@@ -515,25 +515,25 @@ js::SetIntegrityLevel(JSContext* cx, Han
         RootedShape last(cx, EmptyShape::getInitialShape(cx, nobj->getClass(),
                                                          nobj->getTaggedProto(),
                                                          nobj->numFixedSlots(),
                                                          nobj->lastProperty()->getObjectFlags()));
         if (!last)
             return false;
 
         // Get an in-order list of the shapes in this object.
-        AutoShapeVector shapes(cx);
+        Rooted<ShapeVector> shapes(cx, ShapeVector(cx));
         for (Shape::Range<NoGC> r(nobj->lastProperty()); !r.empty(); r.popFront()) {
             if (!shapes.append(&r.front()))
                 return false;
         }
         Reverse(shapes.begin(), shapes.end());
 
-        for (size_t i = 0; i < shapes.length(); i++) {
-            StackShape unrootedChild(shapes[i]);
+        for (Shape* shape : shapes) {
+            StackShape unrootedChild(shape);
             RootedGeneric<StackShape*> child(cx, &unrootedChild);
             child->attrs |= GetSealedOrFrozenAttributes(child->attrs, level);
 
             if (!JSID_IS_EMPTY(child->propid) && level == IntegrityLevel::Frozen)
                 MarkTypePropertyNonWritable(cx, nobj, child->propid);
 
             last = cx->compartment()->propertyTree.getChild(cx, last, *child);
             if (!last)
@@ -1346,25 +1346,25 @@ InitializePropertiesFromCompatibleNative
         // the property information from src.  Note that we asserted above that
         // dst's object flags are 0.
         shape = EmptyShape::getInitialShape(cx, dst->getClass(), dst->getTaggedProto(),
                                             dst->numFixedSlots(), 0);
         if (!shape)
             return false;
 
         // Get an in-order list of the shapes in the src object.
-        AutoShapeVector shapes(cx);
+        Rooted<ShapeVector> shapes(cx, ShapeVector(cx));
         for (Shape::Range<NoGC> r(src->lastProperty()); !r.empty(); r.popFront()) {
             if (!shapes.append(&r.front()))
                 return false;
         }
         Reverse(shapes.begin(), shapes.end());
 
-        for (size_t i = 0; i < shapes.length(); i++) {
-            StackShape unrootedChild(shapes[i]);
+        for (Shape* shape : shapes) {
+            StackShape unrootedChild(shape);
             RootedGeneric<StackShape*> child(cx, &unrootedChild);
             shape = cx->compartment()->propertyTree.getChild(cx, shape, *child);
             if (!shape)
                 return false;
         }
     }
     size_t span = shape->slotSpan();
     if (!dst->setLastProperty(cx, shape))