Bug 867426 - Remove RawUnownedBaseShape typedef; r=jonco
authorTerrence Cole <terrence@mozilla.com>
Tue, 30 Apr 2013 15:40:00 -0700
changeset 130857 566bd5b45961f08504690ee88d5ccaaf278eff83
parent 130856 f234cb1b600e79cea8af39cd7721d78d515808bb
child 130858 e578b67ec2fa08851581b4d9eaad8540d4f9f74b
push id270
push userpvanderbeken@mozilla.com
push dateThu, 06 Mar 2014 09:24:21 +0000
reviewersjonco
bugs867426
milestone23.0a1
Bug 867426 - Remove RawUnownedBaseShape typedef; r=jonco
js/src/gc/Marking.cpp
js/src/jsscript.cpp
js/src/vm/Shape-inl.h
js/src/vm/Shape.cpp
js/src/vm/Shape.h
--- a/js/src/gc/Marking.cpp
+++ b/js/src/gc/Marking.cpp
@@ -868,17 +868,17 @@ ScanBaseShape(GCMarker *gcmarker, BaseSh
     }
 
     /*
      * All children of the owned base shape are consistent with its
      * unowned one, thus we do not need to trace through children of the
      * unowned base shape.
      */
     if (base->isOwned()) {
-        RawUnownedBaseShape unowned = base->baseUnowned();
+        UnownedBaseShape *unowned = base->baseUnowned();
         JS_ASSERT(base->compartment() == unowned->compartment());
         unowned->markIfUnmarked(gcmarker->getMarkColor());
     }
 }
 
 static inline void
 ScanLinearString(GCMarker *gcmarker, JSLinearString *str)
 {
--- a/js/src/jsscript.cpp
+++ b/js/src/jsscript.cpp
@@ -118,17 +118,17 @@ Bindings::initWithTemporaryStorage(JSCon
         JS_ASSERT(!added.has(bi->name()));
         if (!added.put(bi->name()))
             return false;
 #endif
 
         StackBaseShape base(cx->compartment, &CallClass, cx->global(),
                             BaseShape::VAROBJ | BaseShape::DELEGATE);
 
-        RawUnownedBaseShape nbase = BaseShape::getUnowned(cx, base);
+        UnownedBaseShape *nbase = BaseShape::getUnowned(cx, base);
         if (!nbase)
             return false;
 
         RootedId id(cx, NameToId(bi->name()));
         unsigned attrs = JSPROP_PERMANENT | JSPROP_ENUMERATE |
                          (bi->kind() == CONSTANT ? JSPROP_READONLY : 0);
         unsigned frameIndex = bi.frameIndex();
         StackShape child(nbase, id, slot++, 0, attrs, Shape::HAS_SHORTID, frameIndex);
--- a/js/src/vm/Shape-inl.h
+++ b/js/src/vm/Shape-inl.h
@@ -155,17 +155,17 @@ StackBaseShape::updateGetterSetter(uint8
         flags |= BaseShape::HAS_SETTER_OBJECT;
     }
 
     this->rawGetter = rawGetter;
     this->rawSetter = rawSetter;
 }
 
 inline void
-BaseShape::adoptUnowned(RawUnownedBaseShape other)
+BaseShape::adoptUnowned(UnownedBaseShape *other)
 {
     /*
      * This is a base shape owned by a dictionary object, update it to reflect the
      * unowned base shape of a new last property.
      */
     JS_ASSERT(isOwned());
 
     uint32_t span = slotSpan();
@@ -175,28 +175,28 @@ BaseShape::adoptUnowned(RawUnownedBaseSh
     setOwned(other);
     setTable(table);
     setSlotSpan(span);
 
     assertConsistency();
 }
 
 inline void
-BaseShape::setOwned(RawUnownedBaseShape unowned)
+BaseShape::setOwned(UnownedBaseShape *unowned)
 {
     flags |= OWNED_SHAPE;
     this->unowned_ = unowned;
 }
 
 inline void
 BaseShape::assertConsistency()
 {
 #ifdef DEBUG
     if (isOwned()) {
-        RawUnownedBaseShape unowned = baseUnowned();
+        UnownedBaseShape *unowned = baseUnowned();
         JS_ASSERT(hasGetterObject() == unowned->hasGetterObject());
         JS_ASSERT(hasSetterObject() == unowned->hasSetterObject());
         JS_ASSERT_IF(hasGetterObject(), getterObject() == unowned->getterObject());
         JS_ASSERT_IF(hasSetterObject(), setterObject() == unowned->setterObject());
         JS_ASSERT(getObjectParent() == unowned->getObjectParent());
         JS_ASSERT(getObjectFlags() == unowned->getObjectFlags());
     }
 #endif
@@ -211,17 +211,17 @@ Shape::Shape(const StackShape &other, ui
     flags(other.flags),
     shortid_(other.shortid),
     parent(NULL)
 {
     kids.setNull();
 }
 
 inline
-Shape::Shape(RawUnownedBaseShape base, uint32_t nfixed)
+Shape::Shape(UnownedBaseShape *base, uint32_t nfixed)
   : base_(base),
     propid_(JSID_EMPTY),
     slotInfo(SHAPE_INVALID_SLOT | (nfixed << FIXED_SLOTS_SHIFT)),
     attrs(JSPROP_SHARED),
     flags(0),
     shortid_(0),
     parent(NULL)
 {
@@ -391,17 +391,17 @@ Shape::initDictionaryShape(const StackSh
     new (this) Shape(child, nfixed);
     this->flags |= IN_DICTIONARY;
 
     this->listp = NULL;
     insertIntoDictionary(dictp);
 }
 
 inline
-EmptyShape::EmptyShape(RawUnownedBaseShape base, uint32_t nfixed)
+EmptyShape::EmptyShape(UnownedBaseShape *base, uint32_t nfixed)
   : js::Shape(base, nfixed)
 {
     /* Only empty shapes can be NON_NATIVE. */
     if (!getObjectClass()->isNative())
         flags |= NON_NATIVE;
 }
 
 inline void
--- a/js/src/vm/Shape.cpp
+++ b/js/src/vm/Shape.cpp
@@ -300,17 +300,17 @@ Shape::replaceLastProperty(JSContext *cx
         return EmptyShape::getInitialShape(cx, base.clasp, proto,
                                            base.parent, kind,
                                            base.flags & BaseShape::OBJECT_FLAG_MASK);
     }
 
     StackShape child(shape);
     StackShape::AutoRooter childRoot(cx, &child);
     {
-        RawUnownedBaseShape nbase = BaseShape::getUnowned(cx, base);
+        UnownedBaseShape *nbase = BaseShape::getUnowned(cx, base);
         if (!nbase)
             return NULL;
 
         child.base = nbase;
     }
 
     return cx->propertyTree().getChild(cx, shape->parent, shape->numFixedSlots(), child);
 }
@@ -698,17 +698,17 @@ JSObject::putProperty(JSContext *cx, Han
     } else {
         /*
          * Updating the last property in a non-dictionary-mode object. Find an
          * alternate shared child of the last property's previous shape.
          */
         StackBaseShape base(obj->lastProperty()->base());
         base.updateGetterSetter(attrs, getter, setter);
 
-        RawUnownedBaseShape nbase = BaseShape::getUnowned(cx, base);
+        UnownedBaseShape *nbase = BaseShape::getUnowned(cx, base);
         if (!nbase)
             return NULL;
 
         JS_ASSERT(shape == obj->lastProperty());
 
         /* Find or create a property tree node labeled by our arguments. */
         StackShape child(nbase, id, slot, obj->numFixedSlots(), attrs, flags, shortid);
         RootedShape parent(cx, shape->parent);
@@ -1003,17 +1003,17 @@ JSObject::clearParent(JSContext *cx, Han
 JSObject::setParent(JSContext *cx, HandleObject obj, HandleObject parent)
 {
     if (parent && !parent->setDelegate(cx))
         return false;
 
     if (obj->inDictionaryMode()) {
         StackBaseShape base(obj->lastProperty());
         base.parent = parent;
-        RawUnownedBaseShape nbase = BaseShape::getUnowned(cx, base);
+        UnownedBaseShape *nbase = BaseShape::getUnowned(cx, base);
         if (!nbase)
             return false;
 
         obj->lastProperty()->base()->adoptUnowned(nbase);
         return true;
     }
 
     RawShape newShape = Shape::setObjectParent(cx, parent, obj->getTaggedProto(), obj->shape_);
@@ -1082,17 +1082,17 @@ js::ObjectImpl::setFlag(JSContext *cx, /
 
     Rooted<ObjectImpl*> self(cx, this);
 
     if (inDictionaryMode()) {
         if (generateShape == GENERATE_SHAPE && !generateOwnShape(cx))
             return false;
         StackBaseShape base(self->lastProperty());
         base.flags |= flag;
-        RawUnownedBaseShape nbase = BaseShape::getUnowned(cx, base);
+        UnownedBaseShape *nbase = BaseShape::getUnowned(cx, base);
         if (!nbase)
             return false;
 
         self->lastProperty()->base()->adoptUnowned(nbase);
         return true;
     }
 
     RawShape newShape =
@@ -1109,17 +1109,17 @@ js::ObjectImpl::clearFlag(JSContext *cx,
 {
     JS_ASSERT(inDictionaryMode());
     JS_ASSERT(lastProperty()->getObjectFlags() & flag);
 
     RootedObject self(cx, this->asObjectPtr());
 
     StackBaseShape base(self->lastProperty());
     base.flags &= ~flag;
-    RawUnownedBaseShape nbase = BaseShape::getUnowned(cx, base);
+    UnownedBaseShape *nbase = BaseShape::getUnowned(cx, base);
     if (!nbase)
         return false;
 
     self->lastProperty()->base()->adoptUnowned(nbase);
     return true;
 }
 
 /* static */ RawShape
@@ -1142,17 +1142,17 @@ StackBaseShape::hash(const StackBaseShap
     hash = JS_ROTATE_LEFT32(hash, 4) ^ (uintptr_t(base->clasp) >> 3);
     hash = JS_ROTATE_LEFT32(hash, 4) ^ (uintptr_t(base->parent) >> 3);
     hash = JS_ROTATE_LEFT32(hash, 4) ^ uintptr_t(base->rawGetter);
     hash = JS_ROTATE_LEFT32(hash, 4) ^ uintptr_t(base->rawSetter);
     return hash;
 }
 
 /* static */ inline bool
-StackBaseShape::match(RawUnownedBaseShape key, const StackBaseShape *lookup)
+StackBaseShape::match(UnownedBaseShape *key, const StackBaseShape *lookup)
 {
     return key->flags == lookup->flags
         && key->clasp == lookup->clasp
         && key->parent == lookup->parent
         && key->rawGetter == lookup->rawGetter
         && key->rawSetter == lookup->rawSetter;
 }
 
@@ -1172,32 +1172,32 @@ BaseShape::getUnowned(JSContext *cx, con
     StackBaseShape::AutoRooter root(cx, &base);
 
     BaseShape *nbase_ = js_NewGCBaseShape<CanGC>(cx);
     if (!nbase_)
         return NULL;
 
     new (nbase_) BaseShape(base);
 
-    RawUnownedBaseShape nbase = static_cast<RawUnownedBaseShape>(nbase_);
+    UnownedBaseShape *nbase = static_cast<UnownedBaseShape *>(nbase_);
 
     if (!table.relookupOrAdd(p, &base, nbase))
         return NULL;
 
     return nbase;
 }
 
 void
 JSCompartment::sweepBaseShapeTable()
 {
     gcstats::AutoPhase ap(rt->gcStats, gcstats::PHASE_SWEEP_TABLES_BASE_SHAPE);
 
     if (baseShapes.initialized()) {
         for (BaseShapeSet::Enum e(baseShapes); !e.empty(); e.popFront()) {
-            RawUnownedBaseShape base = e.front();
+            UnownedBaseShape *base = e.front();
             if (IsBaseShapeAboutToBeFinalized(&base))
                 e.removeFront();
         }
     }
 }
 
 void
 BaseShape::finalize(FreeOp *fop)
--- a/js/src/vm/Shape.h
+++ b/js/src/vm/Shape.h
@@ -218,17 +218,17 @@ struct ShapeTable {
  * may change when the object has an established property lineage. On such
  * changes the entire property lineage is not updated, but rather only the
  * last property (and its base shape). This works because only the object's
  * last property is used to query information about the object. Care must be
  * taken to call JSObject::canRemoveLastProperty when unwinding an object to
  * an earlier property, however.
  */
 
-ForwardDeclare(UnownedBaseShape);
+class UnownedBaseShape;
 ForwardDeclare(Shape);
 struct StackBaseShape;
 
 class BaseShape : public js::gc::Cell
 {
   public:
     friend class Shape;
     friend struct StackBaseShape;
@@ -307,18 +307,18 @@ class BaseShape : public js::gc::Cell
 
     inline BaseShape &operator=(const BaseShape &other);
 
     bool isOwned() const { return !!(flags & OWNED_SHAPE); }
 
     inline bool matchesGetterSetter(PropertyOp rawGetter,
                                     StrictPropertyOp rawSetter) const;
 
-    inline void adoptUnowned(RawUnownedBaseShape other);
-    inline void setOwned(RawUnownedBaseShape unowned);
+    inline void adoptUnowned(UnownedBaseShape *other);
+    inline void setOwned(UnownedBaseShape *unowned);
 
     JSObject *getObjectParent() const { return parent; }
     uint32_t getObjectFlags() const { return flags & OBJECT_FLAG_MASK; }
 
     bool hasGetterObject() const { return !!(flags & HAS_GETTER_OBJECT); }
     JSObject *getterObject() const { JS_ASSERT(hasGetterObject()); return getterObj; }
 
     bool hasSetterObject() const { return !!(flags & HAS_SETTER_OBJECT); }
@@ -364,26 +364,26 @@ class BaseShape : public js::gc::Cell
   private:
     static void staticAsserts() {
         JS_STATIC_ASSERT(offsetof(BaseShape, clasp) == offsetof(js::shadow::BaseShape, clasp));
     }
 };
 
 class UnownedBaseShape : public BaseShape {};
 
-UnownedBaseShape*
+UnownedBaseShape *
 BaseShape::unowned()
 {
     return isOwned() ? baseUnowned() : toUnowned();
 }
 
-UnownedBaseShape*
+UnownedBaseShape *
 BaseShape::toUnowned()
 {
-    JS_ASSERT(!isOwned() && !unowned_); return static_cast<RawUnownedBaseShape>(this);
+    JS_ASSERT(!isOwned() && !unowned_); return static_cast<UnownedBaseShape *>(this);
 }
 
 UnownedBaseShape*
 BaseShape::baseUnowned()
 {
     JS_ASSERT(isOwned() && unowned_); return unowned_;
 }
 
@@ -419,17 +419,17 @@ struct StackBaseShape
 
     inline StackBaseShape(RawShape shape);
 
     inline void updateGetterSetter(uint8_t attrs,
                                    PropertyOp rawGetter,
                                    StrictPropertyOp rawSetter);
 
     static inline HashNumber hash(const StackBaseShape *lookup);
-    static inline bool match(RawUnownedBaseShape key, const StackBaseShape *lookup);
+    static inline bool match(UnownedBaseShape *key, const StackBaseShape *lookup);
 
     class AutoRooter : private JS::CustomAutoRooter
     {
       public:
         explicit AutoRooter(JSContext *cx, const StackBaseShape *base_
                             MOZ_GUARD_OBJECT_NOTIFIER_PARAM)
           : CustomAutoRooter(cx), base(base_), skip(cx, base_)
         {
@@ -621,17 +621,17 @@ class Shape : public js::gc::Cell
 
         UNUSED_BITS     = 0x3C
     };
 
     /* Get a shape identical to this one, without parent/kids information. */
     Shape(const StackShape &other, uint32_t nfixed);
 
     /* Used by EmptyShape (see jsscopeinlines.h). */
-    Shape(RawUnownedBaseShape base, uint32_t nfixed);
+    Shape(UnownedBaseShape *base, uint32_t nfixed);
 
     /* Copy constructor disabled, to avoid misuse of the above form. */
     Shape(const Shape &other) MOZ_DELETE;
 
     /*
      * Whether this shape has a valid slot value. This may be true even if
      * !hasSlot() (see SlotInfo comment above), and may be false even if
      * hasSlot() if the shape is being constructed and has not had a slot
@@ -898,17 +898,17 @@ class AutoRooterGetterSetter
 
   private:
     mozilla::Maybe<Inner> inner;
     MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER
 };
 
 struct EmptyShape : public js::Shape
 {
-    EmptyShape(RawUnownedBaseShape base, uint32_t nfixed);
+    EmptyShape(UnownedBaseShape *base, uint32_t nfixed);
 
     /*
      * Lookup an initial shape matching the given parameters, creating an empty
      * shape if none was found.
      */
     static Shape *getInitialShape(JSContext *cx, Class *clasp, TaggedProto proto,
                                   JSObject *parent, size_t nfixed, uint32_t objectFlags = 0);
     static Shape *getInitialShape(JSContext *cx, Class *clasp, TaggedProto proto,
@@ -964,24 +964,24 @@ struct InitialShapeEntry
     static inline bool match(const InitialShapeEntry &key, const Lookup &lookup);
 };
 
 typedef HashSet<InitialShapeEntry, InitialShapeEntry, SystemAllocPolicy> InitialShapeSet;
 
 struct StackShape
 {
     /* For performance, StackShape only roots when absolutely necessary. */
-    RawUnownedBaseShape base;
-    RawId               propid;
-    uint32_t            slot_;
-    uint8_t             attrs;
-    uint8_t             flags;
-    int16_t             shortid;
+    UnownedBaseShape *base;
+    RawId            propid;
+    uint32_t         slot_;
+    uint8_t          attrs;
+    uint8_t          flags;
+    int16_t          shortid;
 
-    explicit StackShape(RawUnownedBaseShape base, jsid propid, uint32_t slot,
+    explicit StackShape(UnownedBaseShape *base, jsid propid, uint32_t slot,
                         uint32_t nfixed, unsigned attrs, unsigned flags, int shortid)
       : base(base),
         propid(propid),
         slot_(slot),
         attrs(uint8_t(attrs)),
         flags(uint8_t(flags)),
         shortid(int16_t(shortid))
     {