Backed out changeset c03193ee070d (bug 855350) for crashes on a CLOSED TREE.
authorRyan VanderMeulen <ryanvm@gmail.com>
Wed, 03 Apr 2013 10:26:47 -0400
changeset 127062 32125e0a9954407d6d46af829d1ab07474da748c
parent 127061 c03193ee070d8c2f80a6f9150cb8250fc582d504
child 127484 c054eef6ba7750ad38f160a2be2590ef45fb2d5e
push id25814
push userryanvm@gmail.com
push dateWed, 03 Apr 2013 14:26:53 +0000
treeherdermozilla-inbound@32125e0a9954 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs855350
milestone23.0a1
backs outc03193ee070d8c2f80a6f9150cb8250fc582d504
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
Backed out changeset c03193ee070d (bug 855350) for crashes on a CLOSED TREE.
js/src/gc/RootMarking.cpp
js/src/jsapi.h
js/src/vm/ObjectImpl.h
js/src/vm/RegExpStatics-inl.h
js/src/vm/Shape.h
--- a/js/src/gc/RootMarking.cpp
+++ b/js/src/gc/RootMarking.cpp
@@ -525,16 +525,63 @@ AutoGCRooter::trace(JSTracer *trc)
         for (AutoObjectHashSet::Enum e(set); !e.empty(); e.popFront()) {
             mozilla::DebugOnly<RawObject> obj = e.front();
             MarkObjectRoot(trc, (RawObject *) &e.front(), "AutoObjectHashSet value");
             JS_ASSERT(obj == e.front());  // Needs rewriting for moving GC, see bug 726687.
         }
         return;
       }
 
+      case PROPDESC: {
+        PropDesc::AutoRooter *rooter = static_cast<PropDesc::AutoRooter *>(this);
+        MarkValueRoot(trc, &rooter->pd->pd_, "PropDesc::AutoRooter pd");
+        MarkValueRoot(trc, &rooter->pd->value_, "PropDesc::AutoRooter value");
+        MarkValueRoot(trc, &rooter->pd->get_, "PropDesc::AutoRooter get");
+        MarkValueRoot(trc, &rooter->pd->set_, "PropDesc::AutoRooter set");
+        return;
+      }
+
+      case STACKSHAPE: {
+        StackShape::AutoRooter *rooter = static_cast<StackShape::AutoRooter *>(this);
+        if (rooter->shape->base)
+            MarkBaseShapeRoot(trc, (BaseShape**) &rooter->shape->base, "StackShape::AutoRooter base");
+        MarkIdRoot(trc, (jsid*) &rooter->shape->propid, "StackShape::AutoRooter id");
+        return;
+      }
+
+      case STACKBASESHAPE: {
+        StackBaseShape::AutoRooter *rooter = static_cast<StackBaseShape::AutoRooter *>(this);
+        if (rooter->base->parent)
+            MarkObjectRoot(trc, (JSObject**) &rooter->base->parent, "StackBaseShape::AutoRooter parent");
+        if ((rooter->base->flags & BaseShape::HAS_GETTER_OBJECT) && rooter->base->rawGetter) {
+            MarkObjectRoot(trc, (JSObject**) &rooter->base->rawGetter,
+                           "StackBaseShape::AutoRooter getter");
+        }
+        if ((rooter->base->flags & BaseShape::HAS_SETTER_OBJECT) && rooter->base->rawSetter) {
+            MarkObjectRoot(trc, (JSObject**) &rooter->base->rawSetter,
+                           "StackBaseShape::AutoRooter setter");
+        }
+        return;
+      }
+
+      case GETTERSETTER: {
+        AutoRooterGetterSetter::Inner *rooter = static_cast<AutoRooterGetterSetter::Inner *>(this);
+        if ((rooter->attrs & JSPROP_GETTER) && *rooter->pgetter)
+            MarkObjectRoot(trc, (JSObject**) rooter->pgetter, "AutoRooterGetterSetter getter");
+        if ((rooter->attrs & JSPROP_SETTER) && *rooter->psetter)
+            MarkObjectRoot(trc, (JSObject**) rooter->psetter, "AutoRooterGetterSetter setter");
+        return;
+      }
+
+      case REGEXPSTATICS: {
+        RegExpStatics::AutoRooter *rooter = static_cast<RegExpStatics::AutoRooter *>(this);
+        rooter->trace(trc);
+        return;
+      }
+
       case HASHABLEVALUE: {
           /*
         HashableValue::AutoRooter *rooter = static_cast<HashableValue::AutoRooter *>(this);
         rooter->trace(trc);
           */
         return;
       }
 
@@ -573,20 +620,16 @@ AutoGCRooter::trace(JSTracer *trc)
         for (WrapperValue *p = vector.begin(); p < vector.end(); p++)
             MarkValueUnbarriered(trc, &p->get(), "js::AutoWrapperVector.vector");
         return;
       }
 
       case JSONPARSER:
         static_cast<js::JSONParser *>(this)->trace(trc);
         return;
-
-      case CUSTOM:
-        static_cast<JS::CustomAutoRooter *>(this)->trace(trc);
-        return;
     }
 
     JS_ASSERT(tag_ >= 0);
     if (Value *vp = static_cast<AutoArrayRooter *>(this)->array)
         MarkValueRootRange(trc, tag_, vp, "JS::AutoArrayRooter.array");
 }
 
 /* static */ void
@@ -600,61 +643,37 @@ AutoGCRooter::traceAll(JSTracer *trc)
 AutoGCRooter::traceAllWrappers(JSTracer *trc)
 {
     for (js::AutoGCRooter *gcr = trc->runtime->autoGCRooters; gcr; gcr = gcr->down) {
         if (gcr->tag_ == WRAPVECTOR || gcr->tag_ == WRAPPER)
             gcr->trace(trc);
     }
 }
 
-/* static */ void
-JS::CustomAutoRooter::traceObject(JSTracer *trc, JSObject **thingp, const char *name)
-{
-    MarkObjectRoot(trc, thingp, name);
-}
-
-/* static */ void
-JS::CustomAutoRooter::traceScript(JSTracer *trc, JSScript **thingp, const char *name)
+void
+RegExpStatics::AutoRooter::trace(JSTracer *trc)
 {
-    MarkScriptRoot(trc, thingp, name);
-}
-
-/* static */ void
-JS::CustomAutoRooter::traceString(JSTracer *trc, JSString **thingp, const char *name)
-{
-    MarkStringRoot(trc, thingp, name);
-}
-
-/* static */ void
-JS::CustomAutoRooter::traceId(JSTracer *trc, jsid *thingp, const char *name)
-{
-    MarkIdRoot(trc, thingp, name);
-}
-
-/* static */ void
-JS::CustomAutoRooter::traceValue(JSTracer *trc, JS::Value *thingp, const char *name)
-{
-    MarkValueRoot(trc, thingp, name);
+    if (statics->matchesInput)
+        MarkStringRoot(trc, reinterpret_cast<JSString**>(&statics->matchesInput),
+                       "RegExpStatics::AutoRooter matchesInput");
+    if (statics->lazySource)
+        MarkStringRoot(trc, reinterpret_cast<JSString**>(&statics->lazySource),
+                       "RegExpStatics::AutoRooter lazySource");
+    if (statics->pendingInput)
+        MarkStringRoot(trc, reinterpret_cast<JSString**>(&statics->pendingInput),
+                       "RegExpStatics::AutoRooter pendingInput");
 }
 
 void
 HashableValue::AutoRooter::trace(JSTracer *trc)
 {
     MarkValueRoot(trc, reinterpret_cast<Value*>(&v->value), "HashableValue::AutoRooter");
 }
 
 void
-StackShape::AutoRooter::trace(JSTracer *trc)
-{
-    if (shape->base)
-        MarkBaseShapeRoot(trc, (BaseShape**) &shape->base, "StackShape::AutoRooter base");
-    MarkIdRoot(trc, (jsid*) &shape->propid, "StackShape::AutoRooter id");
-}
-
-void
 js::gc::MarkRuntime(JSTracer *trc, bool useSavedRoots)
 {
     JSRuntime *rt = trc->runtime;
     JS_ASSERT(trc->callback != GCMarker::GrayCallback);
 
     JS_ASSERT(!rt->mainThread.suppressGC);
 
     if (IS_GC_MARKING_TRACER(trc)) {
--- a/js/src/jsapi.h
+++ b/js/src/jsapi.h
@@ -113,36 +113,42 @@ class JS_PUBLIC_API(AutoGCRooter) {
 
     enum {
         JSVAL =        -1, /* js::AutoValueRooter */
         VALARRAY =     -2, /* js::AutoValueArray */
         PARSER =       -3, /* js::frontend::Parser */
         SHAPEVECTOR =  -4, /* js::AutoShapeVector */
         IDARRAY =      -6, /* js::AutoIdArray */
         DESCRIPTORS =  -7, /* js::AutoPropDescArrayRooter */
-        OBJECT =       -8, /* js::AutoObjectRooter */
-        ID =           -9, /* js::AutoIdRooter */
-        VALVECTOR =   -10, /* js::AutoValueVector */
-        DESCRIPTOR =  -11, /* js::AutoPropertyDescriptorRooter */
-        STRING =      -12, /* js::AutoStringRooter */
-        IDVECTOR =    -13, /* js::AutoIdVector */
-        OBJVECTOR =   -14, /* js::AutoObjectVector */
-        STRINGVECTOR =-15, /* js::AutoStringVector */
-        SCRIPTVECTOR =-16, /* js::AutoScriptVector */
-        NAMEVECTOR =  -17, /* js::AutoNameVector */
-        HASHABLEVALUE=-18, /* js::HashableValue */
-        IONMASM =     -19, /* js::ion::MacroAssembler */
-        IONALLOC =    -20, /* js::ion::AutoTempAllocatorRooter */
-        WRAPVECTOR =  -21, /* js::AutoWrapperVector */
-        WRAPPER =     -22, /* js::AutoWrapperRooter */
-        OBJOBJHASHMAP=-23, /* js::AutoObjectObjectHashMap */
-        OBJU32HASHMAP=-24, /* js::AutoObjectUnsigned32HashMap */
-        OBJHASHSET =  -25, /* js::AutoObjectHashSet */
-        JSONPARSER =  -26, /* js::JSONParser */
-        CUSTOM =      -27  /* js::CustomAutoRooter */
+        // UNUSED      -8
+        // UNUSED      -9
+        OBJECT =      -10, /* js::AutoObjectRooter */
+        ID =          -11, /* js::AutoIdRooter */
+        VALVECTOR =   -12, /* js::AutoValueVector */
+        DESCRIPTOR =  -13, /* js::AutoPropertyDescriptorRooter */
+        STRING =      -14, /* js::AutoStringRooter */
+        IDVECTOR =    -15, /* js::AutoIdVector */
+        OBJVECTOR =   -16, /* js::AutoObjectVector */
+        STRINGVECTOR =-17, /* js::AutoStringVector */
+        SCRIPTVECTOR =-18, /* js::AutoScriptVector */
+        PROPDESC =    -19, /* js::PropDesc::AutoRooter */
+        STACKSHAPE =  -21, /* js::StackShape::AutoRooter */
+        STACKBASESHAPE=-22,/* js::StackBaseShape::AutoRooter */
+        GETTERSETTER =-24, /* js::AutoRooterGetterSetter */
+        REGEXPSTATICS=-25, /* js::RegExpStatics::AutoRooter */
+        NAMEVECTOR =  -26, /* js::AutoNameVector */
+        HASHABLEVALUE=-27,
+        IONMASM =     -28, /* js::ion::MacroAssembler */
+        IONALLOC =    -29, /* js::ion::AutoTempAllocatorRooter */
+        WRAPVECTOR =  -30, /* js::AutoWrapperVector */
+        WRAPPER =     -31, /* js::AutoWrapperRooter */
+        OBJOBJHASHMAP=-32, /* js::AutoObjectObjectHashMap */
+        OBJU32HASHMAP=-33, /* js::AutoObjectUnsigned32HashMap */
+        OBJHASHSET =  -34, /* js::AutoObjectHashSet */
+        JSONPARSER =  -35  /* js::JSONParser */
     };
 
   private:
     AutoGCRooter ** const stackTop;
 
     /* No copy or assignment semantics. */
     AutoGCRooter(AutoGCRooter &ida) MOZ_DELETE;
     void operator=(AutoGCRooter &ida) MOZ_DELETE;
@@ -656,45 +662,16 @@ class AutoScriptVector : public AutoVect
         : AutoVectorRooter<JSScript *>(cx, SCRIPTVECTOR)
     {
         MOZ_GUARD_OBJECT_NOTIFIER_INIT;
     }
 
     MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER
 };
 
-/*
- * Cutsom rooting behavior for internal and external clients.
- */
-class JS_PUBLIC_API(CustomAutoRooter) : private AutoGCRooter
-{
-  public:
-    explicit CustomAutoRooter(JSContext *cx MOZ_GUARD_OBJECT_NOTIFIER_PARAM)
-      : AutoGCRooter(cx, CUSTOM)
-    {
-        MOZ_GUARD_OBJECT_NOTIFIER_INIT;
-    }
-
-    friend void AutoGCRooter::trace(JSTracer *trc);
-
-  protected:
-    /* Supplied by derived class to trace roots. */
-    virtual void trace(JSTracer *trc) = 0;
-
-    /* Methods for trace() to call to mark roots, for external clients. */
-    static void traceObject(JSTracer *trc, JSObject **thingp, const char *name);
-    static void traceScript(JSTracer *trc, JSScript **thingp, const char *name);
-    static void traceString(JSTracer *trc, JSString **thingp, const char *name);
-    static void traceId(JSTracer *trc, jsid *thingp, const char *name);
-    static void traceValue(JSTracer *trc, JS::Value *thingp, const char *name);
-
-  private:
-    MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER
-};
-
 /* Returns true if |v| is considered an acceptable this-value. */
 typedef bool (*IsAcceptableThis)(const Value &v);
 
 /*
  * Implements the guts of a method; guaranteed to be provided an acceptable
  * this-value, as determined by a corresponding IsAcceptableThis method.
  */
 typedef bool (*NativeImpl)(JSContext *cx, CallArgs args);
--- a/js/src/vm/ObjectImpl.h
+++ b/js/src/vm/ObjectImpl.h
@@ -289,34 +289,29 @@ struct PropDesc {
     bool checkSetter(JSContext *cx);
 
     bool unwrapDebuggerObjectsInto(JSContext *cx, Debugger *dbg, HandleObject obj,
                                    PropDesc *unwrapped) const;
 
     bool wrapInto(JSContext *cx, HandleObject obj, const jsid &id, jsid *wrappedId,
                   PropDesc *wrappedDesc) const;
 
-    class AutoRooter : private JS::CustomAutoRooter
+    class AutoRooter : private AutoGCRooter
     {
       public:
         explicit AutoRooter(JSContext *cx, PropDesc *pd_
                             MOZ_GUARD_OBJECT_NOTIFIER_PARAM)
-          : CustomAutoRooter(cx), pd(pd_), skip(cx, pd_)
+          : AutoGCRooter(cx, PROPDESC), pd(pd_), skip(cx, pd_)
         {
             MOZ_GUARD_OBJECT_NOTIFIER_INIT;
         }
 
+        friend void AutoGCRooter::trace(JSTracer *trc);
+
       private:
-        virtual void trace(JSTracer *trc) {
-            traceValue(trc, &pd->pd_, "PropDesc::AutoRooter pd");
-            traceValue(trc, &pd->value_, "PropDesc::AutoRooter value");
-            traceValue(trc, &pd->get_, "PropDesc::AutoRooter get");
-            traceValue(trc, &pd->set_, "PropDesc::AutoRooter set");
-        }
-
         PropDesc *pd;
         SkipRoot skip;
         MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER
      };
 };
 
 class DenseElementsHeader;
 class SparseElementsHeader;
--- a/js/src/vm/RegExpStatics-inl.h
+++ b/js/src/vm/RegExpStatics-inl.h
@@ -145,42 +145,30 @@ class RegExpStatics
     void getParen(size_t pairNum, JSSubString *out) const;
     void getLastMatch(JSSubString *out) const;
     void getLastParen(JSSubString *out) const;
     void getLeftContext(JSSubString *out) const;
     void getRightContext(JSSubString *out) const;
 
     /* PreserveRegExpStatics helpers. */
 
-    class AutoRooter : private JS::CustomAutoRooter
+    class AutoRooter : private AutoGCRooter
     {
       public:
         explicit AutoRooter(JSContext *cx, RegExpStatics *statics_
                             MOZ_GUARD_OBJECT_NOTIFIER_PARAM)
-          : CustomAutoRooter(cx), statics(statics_), skip(cx, statics_)
+          : AutoGCRooter(cx, REGEXPSTATICS), statics(statics_), skip(cx, statics_)
         {
             MOZ_GUARD_OBJECT_NOTIFIER_INIT;
         }
 
+        friend void AutoGCRooter::trace(JSTracer *trc);
+        void trace(JSTracer *trc);
+
       private:
-        virtual void trace(JSTracer *trc) {
-            if (statics->matchesInput) {
-                traceString(trc, reinterpret_cast<JSString**>(&statics->matchesInput),
-                               "RegExpStatics::AutoRooter matchesInput");
-            }
-            if (statics->lazySource) {
-                traceString(trc, reinterpret_cast<JSString**>(&statics->lazySource),
-                               "RegExpStatics::AutoRooter lazySource");
-            }
-            if (statics->pendingInput) {
-                traceString(trc, reinterpret_cast<JSString**>(&statics->pendingInput),
-                               "RegExpStatics::AutoRooter pendingInput");
-            }
-        }
-
         RegExpStatics *statics;
         SkipRoot skip;
         MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER
     };
 };
 
 class PreserveRegExpStatics
 {
--- a/js/src/vm/Shape.h
+++ b/js/src/vm/Shape.h
@@ -422,36 +422,29 @@ struct StackBaseShape
 
     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);
 
-    class AutoRooter : private JS::CustomAutoRooter
+    class AutoRooter : private AutoGCRooter
     {
       public:
         explicit AutoRooter(JSContext *cx, const StackBaseShape *base_
                             MOZ_GUARD_OBJECT_NOTIFIER_PARAM)
-          : CustomAutoRooter(cx), base(base_), skip(cx, base_)
+          : AutoGCRooter(cx, STACKBASESHAPE), base(base_), skip(cx, base_)
         {
             MOZ_GUARD_OBJECT_NOTIFIER_INIT;
         }
 
+        friend void AutoGCRooter::trace(JSTracer *trc);
+
       private:
-        virtual void trace(JSTracer *trc) {
-            if (base->parent)
-                traceObject(trc, (JSObject**)&base->parent, "StackBaseShape::AutoRooter parent");
-            if ((base->flags & BaseShape::HAS_GETTER_OBJECT) && base->rawGetter)
-                traceObject(trc, (JSObject**)&base->rawGetter, "StackBaseShape::AutoRooter getter");
-            if ((base->flags & BaseShape::HAS_SETTER_OBJECT) && base->rawSetter)
-                traceObject(trc, (JSObject**)&base->rawSetter, "StackBaseShape::AutoRooter setter");
-        }
-
         const StackBaseShape *base;
         SkipRoot skip;
         MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER
     };
 };
 
 typedef HashSet<ReadBarriered<UnownedBaseShape>,
                 StackBaseShape,
@@ -853,53 +846,50 @@ class Shape : public js::gc::Cell
         JS_STATIC_ASSERT(offsetof(Shape, base_) == offsetof(js::shadow::Shape, base));
         JS_STATIC_ASSERT(offsetof(Shape, slotInfo) == offsetof(js::shadow::Shape, slotInfo));
         JS_STATIC_ASSERT(FIXED_SLOTS_SHIFT == js::shadow::Shape::FIXED_SLOTS_SHIFT);
     }
 };
 
 class AutoRooterGetterSetter
 {
-    class Inner : private JS::CustomAutoRooter
+    class Inner : private AutoGCRooter
     {
       public:
         Inner(JSContext *cx, uint8_t attrs,
               PropertyOp *pgetter_, StrictPropertyOp *psetter_)
-          : CustomAutoRooter(cx), attrs(attrs),
-            pgetter(pgetter_), psetter(psetter_),
-            getterRoot(cx, pgetter_), setterRoot(cx, psetter_)
+            : AutoGCRooter(cx, GETTERSETTER), attrs(attrs),
+              pgetter(pgetter_), psetter(psetter_),
+              getterRoot(cx, pgetter_), setterRoot(cx, psetter_)
         {
             JS_ASSERT_IF(attrs & JSPROP_GETTER, !IsPoisonedPtr(*pgetter));
             JS_ASSERT_IF(attrs & JSPROP_SETTER, !IsPoisonedPtr(*psetter));
         }
 
+        friend void AutoGCRooter::trace(JSTracer *trc);
+
       private:
-        virtual void trace(JSTracer *trc) {
-            if ((attrs & JSPROP_GETTER) && *pgetter)
-                traceObject(trc, (JSObject**) pgetter, "AutoRooterGetterSetter getter");
-            if ((attrs & JSPROP_SETTER) && *psetter)
-                traceObject(trc, (JSObject**) psetter, "AutoRooterGetterSetter setter");
-        }
-
         uint8_t attrs;
         PropertyOp *pgetter;
         StrictPropertyOp *psetter;
         SkipRoot getterRoot, setterRoot;
     };
 
   public:
     explicit AutoRooterGetterSetter(JSContext *cx, uint8_t attrs,
                                     PropertyOp *pgetter, StrictPropertyOp *psetter
                                     MOZ_GUARD_OBJECT_NOTIFIER_PARAM)
     {
         if (attrs & (JSPROP_GETTER | JSPROP_SETTER))
             inner.construct(cx, attrs, pgetter, psetter);
         MOZ_GUARD_OBJECT_NOTIFIER_INIT;
     }
 
+    friend void AutoGCRooter::trace(JSTracer *trc);
+
   private:
     mozilla::Maybe<Inner> inner;
     MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER
 };
 
 struct EmptyShape : public js::Shape
 {
     EmptyShape(RawUnownedBaseShape base, uint32_t nfixed);
@@ -1011,29 +1001,29 @@ struct StackShape
 
     void setSlot(uint32_t slot) {
         JS_ASSERT(slot <= SHAPE_INVALID_SLOT);
         slot_ = slot;
     }
 
     inline HashNumber hash() const;
 
-    class AutoRooter : private JS::CustomAutoRooter
+    class AutoRooter : private AutoGCRooter
     {
       public:
         explicit AutoRooter(JSContext *cx, const StackShape *shape_
                             MOZ_GUARD_OBJECT_NOTIFIER_PARAM)
-          : CustomAutoRooter(cx), shape(shape_), skip(cx, shape_)
+          : AutoGCRooter(cx, STACKSHAPE), shape(shape_), skip(cx, shape_)
         {
             MOZ_GUARD_OBJECT_NOTIFIER_INIT;
         }
 
+        friend void AutoGCRooter::trace(JSTracer *trc);
+
       private:
-        virtual void trace(JSTracer *trc);
-
         const StackShape *shape;
         SkipRoot skip;
         MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER
     };
  };
 
 } /* namespace js */