Bug 884283 - GC: Rename RootMethods to GCMethods r=terrence
authorJon Coppeard <jcoppeard@mozilla.com>
Wed, 19 Jun 2013 11:32:26 +0100
changeset 147105 75b8543e2b045f326a43cde164fbf62b37015fd9
parent 147104 5c902b055c44b847e05a2d1f09efcd65c40bbbe8
child 147106 693f9855e2265c04f2123d35a508a8982ff26d1d
push id2697
push userbbajaj@mozilla.com
push dateMon, 05 Aug 2013 18:49:53 +0000
treeherdermozilla-beta@dfec938c7b63 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersterrence
bugs884283
milestone24.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 884283 - GC: Rename RootMethods to GCMethods r=terrence
content/xbl/src/nsXBLMaybeCompiled.h
js/public/RootingAPI.h
js/public/Value.h
js/src/jsapi.h
js/src/jsclass.h
js/src/jsinfer.h
js/src/jsinferinlines.h
js/src/jsscript.cpp
js/src/jsscript.h
js/src/vm/ObjectImpl.h
js/src/vm/String.h
--- a/content/xbl/src/nsXBLMaybeCompiled.h
+++ b/content/xbl/src/nsXBLMaybeCompiled.h
@@ -60,26 +60,26 @@ private:
     // An pointer that represents the function before being compiled, with
     // BIT_UNCOMPILED set.
     uintptr_t mUncompiled;
 
     // The JS object for the compiled result.
     JSObject* mCompiled;
   };
 
-  friend class js::RootMethods<nsXBLMaybeCompiled<UncompiledT> >;
+  friend class js::GCMethods<nsXBLMaybeCompiled<UncompiledT> >;
 };
 
 /* Add support for JS::Heap<nsXBLMaybeCompiled>. */
 namespace js {
 
 template <class UncompiledT>
-struct RootMethods<nsXBLMaybeCompiled<UncompiledT> > : public RootMethods<JSObject *>
+struct GCMethods<nsXBLMaybeCompiled<UncompiledT> > : public GCMethods<JSObject *>
 {
-  typedef struct RootMethods<JSObject *> Base;
+  typedef struct GCMethods<JSObject *> Base;
 
   static nsXBLMaybeCompiled<UncompiledT> initial() { return nsXBLMaybeCompiled<UncompiledT>(); }
 
   static bool poisoned(nsXBLMaybeCompiled<UncompiledT> function)
   {
     return function.IsCompiled() && Base::poisoned(function.GetJSFunction());
   }
 
--- a/js/public/RootingAPI.h
+++ b/js/public/RootingAPI.h
@@ -97,17 +97,17 @@
  */
 
 namespace js {
 
 class Module;
 class ScriptSourceObject;
 
 template <typename T>
-struct RootMethods {};
+struct GCMethods {};
 
 template <typename T>
 class RootedBase {};
 
 template <typename T>
 class HandleBase {};
 
 template <typename T>
@@ -176,23 +176,23 @@ struct JS_PUBLIC_API(NullPtr)
  */
 template <typename T>
 class Heap : public js::HeapBase<T>
 {
   public:
     Heap() {
         MOZ_STATIC_ASSERT(sizeof(T) == sizeof(Heap<T>),
                           "Heap<T> must be binary compatible with T.");
-        init(js::RootMethods<T>::initial());
+        init(js::GCMethods<T>::initial());
     }
     explicit Heap(T p) { init(p); }
     explicit Heap(const Heap<T> &p) { init(p.ptr); }
 
     ~Heap() {
-        if (js::RootMethods<T>::needsPostBarrier(ptr))
+        if (js::GCMethods<T>::needsPostBarrier(ptr))
             relocate();
     }
 
     bool operator!=(const T &other) const { return ptr != other; }
     bool operator==(const T &other) const { return ptr == other; }
 
     operator T() const { return ptr; }
     T operator->() const { return ptr; }
@@ -202,46 +202,46 @@ class Heap : public js::HeapBase<T>
     T *unsafeGet() { return &ptr; }
 
     Heap<T> &operator=(T p) {
         set(p);
         return *this;
     }
 
     void set(T newPtr) {
-        JS_ASSERT(!js::RootMethods<T>::poisoned(newPtr));
-        if (js::RootMethods<T>::needsPostBarrier(newPtr)) {
+        JS_ASSERT(!js::GCMethods<T>::poisoned(newPtr));
+        if (js::GCMethods<T>::needsPostBarrier(newPtr)) {
             ptr = newPtr;
             post();
-        } else if (js::RootMethods<T>::needsPostBarrier(ptr)) {
+        } else if (js::GCMethods<T>::needsPostBarrier(ptr)) {
             relocate();  /* Called before overwriting ptr. */
             ptr = newPtr;
         } else {
             ptr = newPtr;
         }
     }
 
   private:
     void init(T newPtr) {
-        JS_ASSERT(!js::RootMethods<T>::poisoned(newPtr));
+        JS_ASSERT(!js::GCMethods<T>::poisoned(newPtr));
         ptr = newPtr;
-        if (js::RootMethods<T>::needsPostBarrier(ptr))
+        if (js::GCMethods<T>::needsPostBarrier(ptr))
             post();
     }
 
     void post() {
 #ifdef JSGC_GENERATIONAL
-        JS_ASSERT(js::RootMethods<T>::needsPostBarrier(ptr));
-        js::RootMethods<T>::postBarrier(&ptr);
+        JS_ASSERT(js::GCMethods<T>::needsPostBarrier(ptr));
+        js::GCMethods<T>::postBarrier(&ptr);
 #endif
     }
 
     void relocate() {
 #ifdef JSGC_GENERATIONAL
-        js::RootMethods<T>::relocate(&ptr);
+        js::GCMethods<T>::relocate(&ptr);
 #endif
     }
 
     T ptr;
 };
 
 /*
  * Reference to a T that has been rooted elsewhere. This is most useful
@@ -358,17 +358,17 @@ typedef Handle<Value>                   
  */
 template <typename T>
 class MOZ_STACK_CLASS MutableHandle : public js::MutableHandleBase<T>
 {
   public:
     inline MutableHandle(Rooted<T> *root);
 
     void set(T v) {
-        JS_ASSERT(!js::RootMethods<T>::poisoned(v));
+        JS_ASSERT(!js::GCMethods<T>::poisoned(v));
         *ptr = v;
     }
 
     /*
      * This may be called only if the location of the T is guaranteed
      * to be marked (for some reason other than being a Rooted),
      * e.g., if it is guaranteed to be reachable from an implicit root.
      *
@@ -476,17 +476,17 @@ class InternalHandle<T*>
  */
 template <typename T>
 struct RootKind<T *>
 {
     static ThingRootKind rootKind() { return T::rootKind(); }
 };
 
 template <typename T>
-struct RootMethods<T *>
+struct GCMethods<T *>
 {
     static T *initial() { return NULL; }
     static ThingRootKind kind() { return RootKind<T *>::rootKind(); }
     static bool poisoned(T *v) { return JS::IsPoisonedPtr(v); }
     static bool needsPostBarrier(T *v) { return v; }
 #ifdef JSGC_GENERATIONAL
     static void postBarrier(T **vp) {
         JS::HeapCellPostBarrier(reinterpret_cast<js::gc::Cell **>(vp));
@@ -523,49 +523,49 @@ class MOZ_STACK_CLASS Rooted : public js
 #if defined(JSGC_ROOT_ANALYSIS) || defined(JSGC_USE_EXACT_ROOTING)
         commonInit(pt->thingGCRooters);
 #endif
     }
 
   public:
     Rooted(JSContext *cx
            MOZ_GUARD_OBJECT_NOTIFIER_PARAM)
-      : ptr(js::RootMethods<T>::initial())
+      : ptr(js::GCMethods<T>::initial())
     {
         MOZ_GUARD_OBJECT_NOTIFIER_INIT;
         init(cx);
     }
 
     Rooted(JSContext *cx, T initial
            MOZ_GUARD_OBJECT_NOTIFIER_PARAM)
       : ptr(initial)
     {
         MOZ_GUARD_OBJECT_NOTIFIER_INIT;
         init(cx);
     }
 
     Rooted(js::PerThreadData *pt
            MOZ_GUARD_OBJECT_NOTIFIER_PARAM)
-      : ptr(js::RootMethods<T>::initial())
+      : ptr(js::GCMethods<T>::initial())
     {
         MOZ_GUARD_OBJECT_NOTIFIER_INIT;
         init(js::PerThreadDataFriendFields::get(pt));
     }
 
     Rooted(js::PerThreadData *pt, T initial
            MOZ_GUARD_OBJECT_NOTIFIER_PARAM)
       : ptr(initial)
     {
         MOZ_GUARD_OBJECT_NOTIFIER_INIT;
         init(js::PerThreadDataFriendFields::get(pt));
     }
 
     Rooted(JSRuntime *rt
            MOZ_GUARD_OBJECT_NOTIFIER_PARAM)
-      : ptr(js::RootMethods<T>::initial())
+      : ptr(js::GCMethods<T>::initial())
     {
         MOZ_GUARD_OBJECT_NOTIFIER_INIT;
         init(js::PerThreadDataFriendFields::getMainThread(rt));
     }
 
     Rooted(JSRuntime *rt, T initial
            MOZ_GUARD_OBJECT_NOTIFIER_PARAM)
       : ptr(initial)
@@ -592,43 +592,43 @@ class MOZ_STACK_CLASS Rooted : public js
     operator const T&() const { return ptr; }
     T operator->() const { return ptr; }
     T *address() { return &ptr; }
     const T *address() const { return &ptr; }
     T &get() { return ptr; }
     const T &get() const { return ptr; }
 
     T &operator=(T value) {
-        JS_ASSERT(!js::RootMethods<T>::poisoned(value));
+        JS_ASSERT(!js::GCMethods<T>::poisoned(value));
         ptr = value;
         return ptr;
     }
 
     T &operator=(const Rooted &value) {
         ptr = value;
         return ptr;
     }
 
     void set(T value) {
-        JS_ASSERT(!js::RootMethods<T>::poisoned(value));
+        JS_ASSERT(!js::GCMethods<T>::poisoned(value));
         ptr = value;
     }
 
     bool operator!=(const T &other) const { return ptr != other; }
     bool operator==(const T &other) const { return ptr == other; }
 
   private:
     void commonInit(Rooted<void*> **thingGCRooters) {
 #if defined(JSGC_ROOT_ANALYSIS) || defined(JSGC_USE_EXACT_ROOTING)
-        js::ThingRootKind kind = js::RootMethods<T>::kind();
+        js::ThingRootKind kind = js::GCMethods<T>::kind();
         this->stack = &thingGCRooters[kind];
         this->prev = *stack;
         *stack = reinterpret_cast<Rooted<void*>*>(this);
 
-        JS_ASSERT(!js::RootMethods<T>::poisoned(ptr));
+        JS_ASSERT(!js::GCMethods<T>::poisoned(ptr));
 #endif
     }
 
 #if defined(JSGC_ROOT_ANALYSIS) || defined(JSGC_USE_EXACT_ROOTING)
     Rooted<void*> **stack, *prev;
 #endif
 
 #if defined(DEBUG) && defined(JS_GC_ZEAL) && defined(JSGC_ROOT_ANALYSIS) && !defined(JS_THREADSAFE)
@@ -743,17 +743,17 @@ class SkipRoot
 
 /* Interface substitute for Rooted<T> which does not root the variable's memory. */
 template <typename T>
 class FakeRooted : public RootedBase<T>
 {
   public:
     FakeRooted(JSContext *cx
                 MOZ_GUARD_OBJECT_NOTIFIER_PARAM)
-      : ptr(RootMethods<T>::initial())
+      : ptr(GCMethods<T>::initial())
     {
         MOZ_GUARD_OBJECT_NOTIFIER_INIT;
     }
 
     FakeRooted(JSContext *cx, T initial
                 MOZ_GUARD_OBJECT_NOTIFIER_PARAM)
       : ptr(initial)
     {
@@ -763,17 +763,17 @@ class FakeRooted : public RootedBase<T>
     operator T() const { return ptr; }
     T operator->() const { return ptr; }
     T *address() { return &ptr; }
     const T *address() const { return &ptr; }
     T &get() { return ptr; }
     const T &get() const { return ptr; }
 
     T &operator=(T value) {
-        JS_ASSERT(!RootMethods<T>::poisoned(value));
+        JS_ASSERT(!GCMethods<T>::poisoned(value));
         ptr = value;
         return ptr;
     }
 
     bool operator!=(const T &other) const { return ptr != other; }
     bool operator==(const T &other) const { return ptr == other; }
 
   private:
@@ -793,17 +793,17 @@ class FakeMutableHandle : public js::Mut
         ptr = t;
     }
 
     FakeMutableHandle(FakeRooted<T> *root) {
         ptr = root->address();
     }
 
     void set(T v) {
-        JS_ASSERT(!js::RootMethods<T>::poisoned(v));
+        JS_ASSERT(!js::GCMethods<T>::poisoned(v));
         *ptr = v;
     }
 
     T *address() const { return ptr; }
     T get() const { return *ptr; }
 
     operator T() const { return get(); }
     T operator->() const { return get(); }
--- a/js/public/Value.h
+++ b/js/public/Value.h
@@ -1396,24 +1396,24 @@ SameType(const Value &lhs, const Value &
 namespace JS {
 JS_PUBLIC_API(void) HeapValuePostBarrier(Value *valuep);
 JS_PUBLIC_API(void) HeapValueRelocate(Value *valuep);
 }
 #endif
 
 namespace js {
 
-template <> struct RootMethods<const JS::Value>
+template <> struct GCMethods<const JS::Value>
 {
     static JS::Value initial() { return JS::UndefinedValue(); }
     static ThingRootKind kind() { return THING_ROOT_VALUE; }
     static bool poisoned(const JS::Value &v) { return JS::IsPoisonedValue(v); }
 };
 
-template <> struct RootMethods<JS::Value>
+template <> struct GCMethods<JS::Value>
 {
     static JS::Value initial() { return JS::UndefinedValue(); }
     static ThingRootKind kind() { return THING_ROOT_VALUE; }
     static bool poisoned(const JS::Value &v) { return JS::IsPoisonedValue(v); }
     static bool needsPostBarrier(const JS::Value &v) { return v.isMarkable(); }
 #ifdef JSGC_GENERATIONAL
     static void postBarrier(JS::Value *v) { JS::HeapValuePostBarrier(v); }
     static void relocate(JS::Value *v) { JS::HeapValueRelocate(v); }
--- a/js/src/jsapi.h
+++ b/js/src/jsapi.h
@@ -1781,17 +1781,17 @@ IsPoisonedId(jsid iden)
         return JS::IsPoisonedPtr(JSID_TO_OBJECT(iden));
     return false;
 }
 
 } /* namespace JS */
 
 namespace js {
 
-template <> struct RootMethods<jsid>
+template <> struct GCMethods<jsid>
 {
     static jsid initial() { return JSID_VOID; }
     static ThingRootKind kind() { return THING_ROOT_ID; }
     static bool poisoned(jsid id) { return JS::IsPoisonedId(id); }
     static bool needsPostBarrier(jsid id) { return false; }
 #ifdef JSGC_GENERATIONAL
     static void postBarrier(jsid *idp) {}
     static void relocate(jsid *idp) {}
@@ -3338,17 +3338,17 @@ class PropertyDescriptorOperations
     void setSetterObject(JSObject *obj) { desc()->setter = reinterpret_cast<JSStrictPropertyOp>(obj); }
 };
 
 } /* namespace JS */
 
 namespace js {
 
 template <>
-struct RootMethods<JSPropertyDescriptor> {
+struct GCMethods<JSPropertyDescriptor> {
     static JSPropertyDescriptor initial() { return JSPropertyDescriptor(); }
     static ThingRootKind kind() { return THING_ROOT_PROPERTY_DESCRIPTOR; }
     static bool poisoned(const JSPropertyDescriptor &desc) {
         return (desc.obj && JS::IsPoisonedPtr(desc.obj)) ||
                (desc.attrs & JSPROP_GETTER && desc.getter && JS::IsPoisonedPtr(desc.getter)) ||
                (desc.attrs & JSPROP_SETTER && desc.setter && JS::IsPoisonedPtr(desc.setter)) ||
                (desc.value.isGCThing() && JS::IsPoisonedPtr(desc.value.toGCThing()));
     }
--- a/js/src/jsclass.h
+++ b/js/src/jsclass.h
@@ -382,17 +382,17 @@ IsObjectWithClass(const Value &v, ESClas
 inline bool
 IsPoisonedSpecialId(js::SpecialId iden)
 {
     if (iden.isObject())
         return IsPoisonedPtr(iden.toObject());
     return false;
 }
 
-template <> struct RootMethods<SpecialId>
+template <> struct GCMethods<SpecialId>
 {
     static SpecialId initial() { return SpecialId(); }
     static ThingRootKind kind() { return THING_ROOT_ID; }
     static bool poisoned(SpecialId id) { return IsPoisonedSpecialId(id); }
 };
 
 }  /* namespace js */
 
--- a/js/src/jsinfer.h
+++ b/js/src/jsinfer.h
@@ -44,24 +44,24 @@ class TaggedProto
 };
 
 template <>
 struct RootKind<TaggedProto>
 {
     static ThingRootKind rootKind() { return THING_ROOT_OBJECT; }
 };
 
-template <> struct RootMethods<const TaggedProto>
+template <> struct GCMethods<const TaggedProto>
 {
     static TaggedProto initial() { return TaggedProto(); }
     static ThingRootKind kind() { return THING_ROOT_OBJECT; }
     static bool poisoned(const TaggedProto &v) { return IsPoisonedPtr(v.raw()); }
 };
 
-template <> struct RootMethods<TaggedProto>
+template <> struct GCMethods<TaggedProto>
 {
     static TaggedProto initial() { return TaggedProto(); }
     static ThingRootKind kind() { return THING_ROOT_OBJECT; }
     static bool poisoned(const TaggedProto &v) { return IsPoisonedPtr(v.raw()); }
 };
 
 template<class Outer>
 class TaggedProtoOperations
--- a/js/src/jsinferinlines.h
+++ b/js/src/jsinferinlines.h
@@ -1800,28 +1800,28 @@ js::analyze::ScriptAnalysis::addPushedTy
 {
     js::types::TypeSet *pushed = pushedTypes(offset, which);
     pushed->addType(cx, type);
 }
 
 namespace js {
 
 template <>
-struct RootMethods<const types::Type>
+struct GCMethods<const types::Type>
 {
     static types::Type initial() { return types::Type::UnknownType(); }
     static ThingRootKind kind() { return THING_ROOT_TYPE; }
     static bool poisoned(const types::Type &v) {
         return (v.isTypeObject() && IsPoisonedPtr(v.typeObject()))
             || (v.isSingleObject() && IsPoisonedPtr(v.singleObject()));
     }
 };
 
 template <>
-struct RootMethods<types::Type>
+struct GCMethods<types::Type>
 {
     static types::Type initial() { return types::Type::UnknownType(); }
     static ThingRootKind kind() { return THING_ROOT_TYPE; }
     static bool poisoned(const types::Type &v) {
         return (v.isTypeObject() && IsPoisonedPtr(v.typeObject()))
             || (v.isSingleObject() && IsPoisonedPtr(v.singleObject()));
     }
 };
--- a/js/src/jsscript.cpp
+++ b/js/src/jsscript.cpp
@@ -169,17 +169,17 @@ Bindings::clone(JSContext *cx, InternalB
      */
     if (!initWithTemporaryStorage(cx, self, src.numArgs(), src.numVars(), src.bindingArray()))
         return false;
     self->switchToScriptStorage(dstPackedBindings);
     return true;
 }
 
 /* static */ Bindings
-RootMethods<Bindings>::initial()
+GCMethods<Bindings>::initial()
 {
     return Bindings();
 }
 
 template<XDRMode mode>
 static bool
 XDRScriptBindings(XDRState<mode> *xdr, LifoAllocScope &las, unsigned numArgs, unsigned numVars,
                   HandleScript script)
--- a/js/src/jsscript.h
+++ b/js/src/jsscript.h
@@ -206,17 +206,17 @@ class Bindings
 
     /* Return whether this scope has any aliased bindings. */
     bool hasAnyAliasedBindings() const { return !callObjShape_->isEmptyShape(); }
 
     void trace(JSTracer *trc);
 };
 
 template <>
-struct RootMethods<Bindings> {
+struct GCMethods<Bindings> {
     static Bindings initial();
     static ThingRootKind kind() { return THING_ROOT_BINDINGS; }
     static bool poisoned(const Bindings &bindings) {
         return IsPoisonedPtr(static_cast<Shape *>(bindings.callObjShape()));
     }
 };
 
 class ScriptCounts
--- a/js/src/vm/ObjectImpl.h
+++ b/js/src/vm/ObjectImpl.h
@@ -1625,17 +1625,17 @@ DefineElement(JSContext *cx, Handle<Obje
 extern bool
 SetElement(JSContext *cx, Handle<ObjectImpl*> obj, Handle<ObjectImpl*> receiver, uint32_t index,
            const Value &v, unsigned resolveFlags, bool *succeeded);
 
 extern bool
 HasElement(JSContext *cx, Handle<ObjectImpl*> obj, uint32_t index, unsigned resolveFlags,
            bool *found);
 
-template <> struct RootMethods<PropertyId>
+template <> struct GCMethods<PropertyId>
 {
     static PropertyId initial() { return PropertyId(); }
     static ThingRootKind kind() { return THING_ROOT_PROPERTY_ID; }
     static bool poisoned(PropertyId propid) { return IsPoisonedId(propid.asId()); }
 };
 
 } /* namespace js */
 
--- a/js/src/vm/String.h
+++ b/js/src/vm/String.h
@@ -614,17 +614,17 @@ class Rooted<JSStableString *>
     JSStableString ** address() { return reinterpret_cast<JSStableString **>(rooter.addr()); }
     JSStableString * const * address() const {
         return reinterpret_cast<JSStableString * const *>(rooter.addr());
     }
     JSStableString * get() const { return static_cast<JSStableString *>(rooter.string()); }
 
     Rooted & operator =(JSStableString *value)
     {
-        JS_ASSERT(!js::RootMethods<JSStableString *>::poisoned(value));
+        JS_ASSERT(!js::GCMethods<JSStableString *>::poisoned(value));
         rooter.setString(value);
         return *this;
     }
 
     Rooted & operator =(const Rooted &value)
     {
         rooter.setString(value.get());
         return *this;