Bug 1159714 - Templatise AutoVectorRooter implementation r=terrence
authorJon Coppeard <jcoppeard@mozilla.com>
Fri, 01 May 2015 16:26:10 +0100
changeset 273439 5028ca29deecc4eae67e804088564b9e2590ee37
parent 273438 a240e100cb2a662aeb187543dd8965f2af692741
child 273440 fae47e06131277b96ec7ddac2a898a072c3bd253
push id863
push userraliiev@mozilla.com
push dateMon, 03 Aug 2015 13:22:43 +0000
treeherdermozilla-release@f6321b14228d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersterrence
bugs1159714
milestone40.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 1159714 - Templatise AutoVectorRooter implementation r=terrence
dom/base/nsJSEnvironment.h
js/public/Class.h
js/src/NamespaceImports.h
js/src/ds/IdValuePair.h
js/src/gc/RootMarking.cpp
js/src/jsapi.h
js/src/jscntxt.h
js/src/jscompartment.h
js/src/jsobj.h
js/src/jsobjinlines.h
js/src/jspubtd.h
js/src/vm/String.h
js/xpconnect/wrappers/FilteringWrapper.h
--- a/dom/base/nsJSEnvironment.h
+++ b/dom/base/nsJSEnvironment.h
@@ -17,17 +17,19 @@
 #include "nsPIDOMWindow.h"
 #include "nsThreadUtils.h"
 #include "xpcpublic.h"
 
 class nsICycleCollectorListener;
 class nsScriptNameSpaceManager;
 
 namespace JS {
-class AutoValueVector;
+template <typename T>
+class AutoVectorRooter;
+typedef AutoVectorRooter<Value> AutoValueVector;
 }
 
 namespace mozilla {
 template <class> class Maybe;
 struct CycleCollectorResults;
 }
 
 // The amount of time we wait between a request to GC (due to leaving
--- a/js/public/Class.h
+++ b/js/public/Class.h
@@ -37,17 +37,19 @@ class Shape;
 // This is equal to JSFunction::class_.  Use it in places where you don't want
 // to #include jsfun.h.
 extern JS_FRIEND_DATA(const js::Class* const) FunctionClassPtr;
 
 } // namespace js
 
 namespace JS {
 
-class AutoIdVector;
+template <typename T>
+class AutoVectorRooter;
+typedef AutoVectorRooter<jsid> AutoIdVector;
 
 /*
  * Per ES6, the [[DefineOwnProperty]] internal method has three different
  * possible outcomes:
  *
  * -   It can throw an exception (which we indicate by returning false).
  *
  * -   It can return true, indicating unvarnished success.
--- a/js/src/NamespaceImports.h
+++ b/js/src/NamespaceImports.h
@@ -23,21 +23,23 @@ namespace JS {
 class Latin1Chars;
 class Latin1CharsZ;
 class ConstTwoByteChars;
 class TwoByteChars;
 class TwoByteCharsZ;
 class UTF8Chars;
 class UTF8CharsZ;
 
-class AutoFunctionVector;
-class AutoIdVector;
-class AutoObjectVector;
-class AutoScriptVector;
-class AutoValueVector;
+template <typename T>
+class AutoVectorRooter;
+typedef AutoVectorRooter<Value> AutoValueVector;
+typedef AutoVectorRooter<jsid> AutoIdVector;
+typedef AutoVectorRooter<JSObject*> AutoObjectVector;
+typedef AutoVectorRooter<JSFunction*> AutoFunctionVector;
+typedef AutoVectorRooter<JSScript*> AutoVector;
 
 class AutoIdArray;
 
 template <typename T> class AutoVectorRooter;
 template<typename K, typename V> class AutoHashMapRooter;
 template<typename T> class AutoHashSetRooter;
 template<typename T> class RootedGeneric;
 
@@ -70,27 +72,27 @@ using JS::Latin1Char;
 using JS::Latin1Chars;
 using JS::Latin1CharsZ;
 using JS::ConstTwoByteChars;
 using JS::TwoByteChars;
 using JS::TwoByteCharsZ;
 using JS::UTF8Chars;
 using JS::UTF8CharsZ;
 
-using JS::AutoFunctionVector;
-using JS::AutoIdVector;
-using JS::AutoObjectVector;
-using JS::AutoScriptVector;
-using JS::AutoValueVector;
+using JS::AutoVectorRooter;
+typedef AutoVectorRooter<Value> AutoValueVector;
+typedef AutoVectorRooter<jsid> AutoIdVector;
+typedef AutoVectorRooter<JSObject*> AutoObjectVector;
+typedef AutoVectorRooter<JSFunction*> AutoFunctionVector;
+typedef AutoVectorRooter<JSScript*> AutoScriptVector;
 
 using JS::AutoIdArray;
 
 using JS::AutoHashMapRooter;
 using JS::AutoHashSetRooter;
-using JS::AutoVectorRooter;
 using JS::RootedGeneric;
 
 using JS::CallArgs;
 using JS::CallNonGenericMethod;
 using JS::CallReceiver;
 using JS::CompileOptions;
 using JS::IsAcceptableThis;
 using JS::NativeImpl;
--- a/js/src/ds/IdValuePair.h
+++ b/js/src/ds/IdValuePair.h
@@ -25,22 +25,22 @@ struct IdValuePair
     explicit IdValuePair(jsid idArg)
       : id(idArg), value(UndefinedValue())
     {}
     IdValuePair(jsid idArg, Value valueArg)
       : id(idArg), value(valueArg)
     {}
 };
 
-class MOZ_STACK_CLASS AutoIdValueVector : public AutoVectorRooter<IdValuePair>
+class MOZ_STACK_CLASS AutoIdValueVector : public JS::AutoVectorRooterBase<IdValuePair>
 {
   public:
     explicit AutoIdValueVector(ContextFriendFields* cx
                                MOZ_GUARD_OBJECT_NOTIFIER_PARAM)
-        : AutoVectorRooter<IdValuePair>(cx, IDVALVECTOR)
+        : AutoVectorRooterBase<IdValuePair>(cx, IDVALVECTOR)
     {
         MOZ_GUARD_OBJECT_NOTIFIER_INIT;
     }
 
     MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER
 };
 
 } /* namespace js */
--- a/js/src/gc/RootMarking.cpp
+++ b/js/src/gc/RootMarking.cpp
@@ -146,23 +146,23 @@ AutoGCRooter::trace(JSTracer* trc)
             static_cast<AutoPropertyDescriptorVector*>(this)->vector;
         for (size_t i = 0, len = descriptors.length(); i < len; i++)
             descriptors[i].trace(trc);
         return;
       }
 
       case VALVECTOR: {
         AutoValueVector::VectorImpl& vector = static_cast<AutoValueVector*>(this)->vector;
-        TraceRootRange(trc, vector.length(), vector.begin(), "js::AutoValueVector.vector");
+        TraceRootRange(trc, vector.length(), vector.begin(), "JS::AutoValueVector.vector");
         return;
       }
 
       case IDVECTOR: {
         AutoIdVector::VectorImpl& vector = static_cast<AutoIdVector*>(this)->vector;
-        TraceRootRange(trc, vector.length(), vector.begin(), "js::AutoIdVector.vector");
+        TraceRootRange(trc, vector.length(), vector.begin(), "JS::AutoIdVector.vector");
         return;
       }
 
       case IDVALVECTOR: {
         AutoIdValueVector::VectorImpl& vector = static_cast<AutoIdValueVector*>(this)->vector;
         for (size_t i = 0; i < vector.length(); i++) {
             TraceRoot(trc, &vector[i].id, "js::AutoIdValueVector id");
             TraceRoot(trc, &vector[i].value, "js::AutoIdValueVector value");
@@ -174,23 +174,17 @@ AutoGCRooter::trace(JSTracer* trc)
         AutoShapeVector::VectorImpl& vector = static_cast<js::AutoShapeVector*>(this)->vector;
         TraceRootRange(trc, vector.length(), const_cast<Shape**>(vector.begin()),
                        "js::AutoShapeVector.vector");
         return;
       }
 
       case OBJVECTOR: {
         AutoObjectVector::VectorImpl& vector = static_cast<AutoObjectVector*>(this)->vector;
-        TraceRootRange(trc, vector.length(), vector.begin(), "js::AutoObjectVector.vector");
-        return;
-      }
-
-      case FUNVECTOR: {
-        AutoFunctionVector::VectorImpl& vector = static_cast<AutoFunctionVector*>(this)->vector;
-        TraceRootRange(trc, vector.length(), vector.begin(), "js::AutoFunctionVector.vector");
+        TraceRootRange(trc, vector.length(), vector.begin(), "JS::AutoObjectVector.vector");
         return;
       }
 
       case STRINGVECTOR: {
         AutoStringVector::VectorImpl& vector = static_cast<AutoStringVector*>(this)->vector;
         TraceRootRange(trc, vector.length(), vector.begin(), "js::AutoStringVector.vector");
         return;
       }
--- a/js/src/jsapi.h
+++ b/js/src/jsapi.h
@@ -89,46 +89,46 @@ class AutoValueArray : public AutoGCRoot
         MOZ_ASSERT(i < N);
         return MutableHandleValue::fromMarkedLocation(&elements_[i]);
     }
 
     MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER
 };
 
 template<class T>
-class AutoVectorRooter : protected AutoGCRooter
+class AutoVectorRooterBase : protected AutoGCRooter
 {
     typedef js::Vector<T, 8> VectorImpl;
     VectorImpl vector;
 
   public:
-    explicit AutoVectorRooter(JSContext* cx, ptrdiff_t tag
+    explicit AutoVectorRooterBase(JSContext* cx, ptrdiff_t tag
                               MOZ_GUARD_OBJECT_NOTIFIER_PARAM)
       : AutoGCRooter(cx, tag), vector(cx)
     {
         MOZ_GUARD_OBJECT_NOTIFIER_INIT;
     }
 
-    explicit AutoVectorRooter(js::ContextFriendFields* cx, ptrdiff_t tag
+    explicit AutoVectorRooterBase(js::ContextFriendFields* cx, ptrdiff_t tag
                               MOZ_GUARD_OBJECT_NOTIFIER_PARAM)
       : AutoGCRooter(cx, tag), vector(cx)
     {
         MOZ_GUARD_OBJECT_NOTIFIER_INIT;
     }
 
     typedef T ElementType;
     typedef typename VectorImpl::Range Range;
 
     size_t length() const { return vector.length(); }
     bool empty() const { return vector.empty(); }
 
     bool append(const T& v) { return vector.append(v); }
     bool appendN(const T& v, size_t len) { return vector.appendN(v, len); }
     bool append(const T* ptr, size_t len) { return vector.append(ptr, len); }
-    bool appendAll(const AutoVectorRooter<T>& other) {
+    bool appendAll(const AutoVectorRooterBase<T>& other) {
         return vector.appendAll(other.vector);
     }
 
     bool insert(T* p, const T& val) { return vector.insert(p, val); }
 
     /* For use when space has already been reserved. */
     void infallibleAppend(const T& v) { vector.infallibleAppend(v); }
 
@@ -185,16 +185,43 @@ class AutoVectorRooter : protected AutoG
         T* t = vector.begin() + oldLength;
         for (size_t i = oldLength; i < vector.length(); ++i, ++t)
             memset(t, 0, sizeof(T));
     }
 
     MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER
 };
 
+template <typename T>
+class MOZ_STACK_CLASS AutoVectorRooter : public AutoVectorRooterBase<T>
+{
+  public:
+    explicit AutoVectorRooter(JSContext* cx
+                             MOZ_GUARD_OBJECT_NOTIFIER_PARAM)
+        : AutoVectorRooterBase<T>(cx, this->GetTag(T()))
+    {
+        MOZ_GUARD_OBJECT_NOTIFIER_INIT;
+    }
+
+    explicit AutoVectorRooter(js::ContextFriendFields* cx
+                             MOZ_GUARD_OBJECT_NOTIFIER_PARAM)
+        : AutoVectorRooterBase<T>(cx, this->GetTag(T()))
+    {
+        MOZ_GUARD_OBJECT_NOTIFIER_INIT;
+    }
+
+    MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER
+};
+
+typedef AutoVectorRooter<Value> AutoValueVector;
+typedef AutoVectorRooter<jsid> AutoIdVector;
+typedef AutoVectorRooter<JSObject*> AutoObjectVector;
+typedef AutoVectorRooter<JSFunction*> AutoFunctionVector;
+typedef AutoVectorRooter<JSScript*> AutoScriptVector;
+
 template<class Key, class Value>
 class AutoHashMapRooter : protected AutoGCRooter
 {
   private:
     typedef js::HashMap<Key, Value> HashMapImpl;
 
   public:
     explicit AutoHashMapRooter(JSContext* cx, ptrdiff_t tag
@@ -418,88 +445,16 @@ class AutoHashSetRooter : protected Auto
     AutoHashSetRooter(const AutoHashSetRooter& hmr) = delete;
     AutoHashSetRooter& operator=(const AutoHashSetRooter& hmr) = delete;
 
     HashSetImpl set;
 
     MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER
 };
 
-class MOZ_STACK_CLASS AutoValueVector : public AutoVectorRooter<Value>
-{
-  public:
-    explicit AutoValueVector(JSContext* cx
-                             MOZ_GUARD_OBJECT_NOTIFIER_PARAM)
-        : AutoVectorRooter<Value>(cx, VALVECTOR)
-    {
-        MOZ_GUARD_OBJECT_NOTIFIER_INIT;
-    }
-
-    MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER
-};
-
-class AutoIdVector : public AutoVectorRooter<jsid>
-{
-  public:
-    explicit AutoIdVector(JSContext* cx
-                          MOZ_GUARD_OBJECT_NOTIFIER_PARAM)
-        : AutoVectorRooter<jsid>(cx, IDVECTOR)
-    {
-        MOZ_GUARD_OBJECT_NOTIFIER_INIT;
-    }
-
-    MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER
-};
-
-class AutoObjectVector : public AutoVectorRooter<JSObject*>
-{
-  public:
-    explicit AutoObjectVector(JSContext* cx
-                              MOZ_GUARD_OBJECT_NOTIFIER_PARAM)
-        : AutoVectorRooter<JSObject*>(cx, OBJVECTOR)
-    {
-        MOZ_GUARD_OBJECT_NOTIFIER_INIT;
-    }
-
-    MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER
-};
-
-class AutoFunctionVector : public AutoVectorRooter<JSFunction*>
-{
-  public:
-    explicit AutoFunctionVector(JSContext* cx
-                                MOZ_GUARD_OBJECT_NOTIFIER_PARAM)
-        : AutoVectorRooter<JSFunction*>(cx, FUNVECTOR)
-    {
-        MOZ_GUARD_OBJECT_NOTIFIER_INIT;
-    }
-
-    explicit AutoFunctionVector(js::ContextFriendFields* cx
-                                MOZ_GUARD_OBJECT_NOTIFIER_PARAM)
-        : AutoVectorRooter<JSFunction*>(cx, FUNVECTOR)
-    {
-        MOZ_GUARD_OBJECT_NOTIFIER_INIT;
-    }
-
-    MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER
-};
-
-class AutoScriptVector : public AutoVectorRooter<JSScript*>
-{
-  public:
-    explicit AutoScriptVector(JSContext* cx
-                              MOZ_GUARD_OBJECT_NOTIFIER_PARAM)
-        : AutoVectorRooter<JSScript*>(cx, SCRIPTVECTOR)
-    {
-        MOZ_GUARD_OBJECT_NOTIFIER_INIT;
-    }
-
-    MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER
-};
-
 /*
  * Custom rooting behavior for internal and external clients.
  */
 class JS_PUBLIC_API(CustomAutoRooter) : private AutoGCRooter
 {
   public:
     template <typename CX>
     explicit CustomAutoRooter(CX* cx MOZ_GUARD_OBJECT_NOTIFIER_PARAM)
--- a/js/src/jscntxt.h
+++ b/js/src/jscntxt.h
@@ -654,54 +654,19 @@ CheckForInterrupt(JSContext* cx)
     JSRuntime* rt = cx->runtime();
     if (MOZ_UNLIKELY(rt->hasPendingInterrupt()))
         return rt->handleInterrupt(cx);
     return true;
 }
 
 /************************************************************************/
 
-class AutoStringVector : public AutoVectorRooter<JSString*>
-{
-  public:
-    explicit AutoStringVector(JSContext* cx
-                              MOZ_GUARD_OBJECT_NOTIFIER_PARAM)
-        : AutoVectorRooter<JSString*>(cx, STRINGVECTOR)
-    {
-        MOZ_GUARD_OBJECT_NOTIFIER_INIT;
-    }
-
-    MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER
-};
-
-class AutoPropertyNameVector : public AutoVectorRooter<PropertyName*>
-{
-  public:
-    explicit AutoPropertyNameVector(JSContext* cx
-                                    MOZ_GUARD_OBJECT_NOTIFIER_PARAM)
-        : AutoVectorRooter<PropertyName*>(cx, STRINGVECTOR)
-    {
-        MOZ_GUARD_OBJECT_NOTIFIER_INIT;
-    }
-
-    MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER
-};
-
-class AutoShapeVector : public AutoVectorRooter<Shape*>
-{
-  public:
-    explicit AutoShapeVector(JSContext* cx
-                             MOZ_GUARD_OBJECT_NOTIFIER_PARAM)
-        : AutoVectorRooter<Shape*>(cx, SHAPEVECTOR)
-    {
-        MOZ_GUARD_OBJECT_NOTIFIER_INIT;
-    }
-
-    MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER
-};
+typedef JS::AutoVectorRooter<JSString*> AutoStringVector;
+typedef JS::AutoVectorRooter<PropertyName*> AutoPropertyNameVector;
+typedef JS::AutoVectorRooter<Shape*> AutoShapeVector;
 
 class AutoObjectObjectHashMap : public AutoHashMapRooter<JSObject*, JSObject*>
 {
   public:
     explicit AutoObjectObjectHashMap(JSContext* cx
                                      MOZ_GUARD_OBJECT_NOTIFIER_PARAM)
       : AutoHashMapRooter<JSObject*, JSObject*>(cx, OBJOBJHASHMAP)
     {
--- a/js/src/jscompartment.h
+++ b/js/src/jscompartment.h
@@ -726,22 +726,22 @@ struct WrapperValue
     Value get() const { return value; }
     operator const Value&() const { return value; }
     JSObject& toObject() const { return value.toObject(); }
 
   private:
     Value value;
 };
 
-class AutoWrapperVector : public AutoVectorRooter<WrapperValue>
+class AutoWrapperVector : public JS::AutoVectorRooterBase<WrapperValue>
 {
   public:
     explicit AutoWrapperVector(JSContext* cx
                                MOZ_GUARD_OBJECT_NOTIFIER_PARAM)
-        : AutoVectorRooter<WrapperValue>(cx, WRAPVECTOR)
+        : AutoVectorRooterBase<WrapperValue>(cx, WRAPVECTOR)
     {
         MOZ_GUARD_OBJECT_NOTIFIER_INIT;
     }
 
     MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER
 };
 
 class AutoWrapperRooter : private JS::AutoGCRooter {
--- a/js/src/jsobj.h
+++ b/js/src/jsobj.h
@@ -28,17 +28,17 @@
 #include "vm/Xdr.h"
 
 namespace JS {
 struct ClassInfo;
 }
 
 namespace js {
 
-class AutoPropertyDescriptorVector;
+typedef AutoVectorRooter<PropertyDescriptor> AutoPropertyDescriptorVector;
 class GCMarker;
 class Nursery;
 
 namespace gc {
 class RelocationOverlay;
 }
 
 inline JSObject*
--- a/js/src/jsobjinlines.h
+++ b/js/src/jsobjinlines.h
@@ -566,28 +566,17 @@ inline bool
 IsInternalFunctionObject(JSObject* funobj)
 {
     JSFunction* fun = &funobj->as<JSFunction>();
     MOZ_ASSERT_IF(fun->isLambda(),
                   fun->isInterpreted() || fun->isAsmJSNative());
     return fun->isLambda() && fun->isInterpreted() && !fun->environment();
 }
 
-class AutoPropertyDescriptorVector : public AutoVectorRooter<PropertyDescriptor>
-{
-  public:
-    explicit AutoPropertyDescriptorVector(JSContext* cx
-                                          MOZ_GUARD_OBJECT_NOTIFIER_PARAM)
-        : AutoVectorRooter(cx, DESCVECTOR)
-    {
-        MOZ_GUARD_OBJECT_NOTIFIER_INIT;
-    }
-
-    MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER
-};
+typedef AutoVectorRooter<PropertyDescriptor> AutoPropertyDescriptorVector;
 
 /*
  * Make an object with the specified prototype. If parent is null, it will
  * default to the prototype's global if the prototype is non-null.
  */
 JSObject*
 NewObjectWithGivenTaggedProto(ExclusiveContext* cx, const Class* clasp, Handle<TaggedProto> proto,
                               gc::AllocKind allocKind, NewObjectKind newKind);
--- a/js/src/jspubtd.h
+++ b/js/src/jspubtd.h
@@ -21,33 +21,37 @@
 #include "js/TypeDecls.h"
 
 #if defined(JS_GC_ZEAL) || defined(DEBUG)
 # define JSGC_HASH_TABLE_CHECKS
 #endif
 
 namespace JS {
 
-class AutoIdVector;
+template <typename T>
+class AutoVectorRooter;
+typedef AutoVectorRooter<jsid> AutoIdVector;
 class CallArgs;
 
 template <typename T>
 class Rooted;
 
 class JS_FRIEND_API(CompileOptions);
 class JS_FRIEND_API(ReadOnlyCompileOptions);
 class JS_FRIEND_API(OwningCompileOptions);
 class JS_PUBLIC_API(CompartmentOptions);
 
+class Value;
 struct Zone;
 
 } /* namespace JS */
 
 namespace js {
 struct ContextFriendFields;
+class Shape;
 } // namespace js
 
 /*
  * Run-time version enumeration.  For compile-time version checking, please use
  * the JS_HAS_* macros in jsversion.h, or use MOZJS_MAJOR_VERSION,
  * MOZJS_MINOR_VERSION, MOZJS_PATCH_VERSION, and MOZJS_ALPHA definitions.
  */
 enum JSVersion {
@@ -260,20 +264,27 @@ class JS_PUBLIC_API(AutoGCRooter)
         HASHABLEVALUE=-18, /* js::HashableValue */
         IONMASM =     -19, /* js::jit::MacroAssembler */
         WRAPVECTOR =  -20, /* js::AutoWrapperVector */
         WRAPPER =     -21, /* js::AutoWrapperRooter */
         OBJOBJHASHMAP=-22, /* js::AutoObjectObjectHashMap */
         OBJU32HASHMAP=-23, /* js::AutoObjectUnsigned32HashMap */
         OBJHASHSET =  -24, /* js::AutoObjectHashSet */
         JSONPARSER =  -25, /* js::JSONParser */
-        CUSTOM =      -26, /* js::CustomAutoRooter */
-        FUNVECTOR =   -27  /* js::AutoFunctionVector */
+        CUSTOM =      -26  /* js::CustomAutoRooter */
     };
 
+    static ptrdiff_t GetTag(const Value& value) { return VALVECTOR; }
+    static ptrdiff_t GetTag(const jsid& id) { return IDVECTOR; }
+    static ptrdiff_t GetTag(JSObject* obj) { return OBJVECTOR; }
+    static ptrdiff_t GetTag(JSScript* script) { return SCRIPTVECTOR; }
+    static ptrdiff_t GetTag(JSString* string) { return STRINGVECTOR; }
+    static ptrdiff_t GetTag(js::Shape* shape) { return SHAPEVECTOR; }
+    static ptrdiff_t GetTag(const JSPropertyDescriptor& pd) { return DESCVECTOR; }
+
   private:
     AutoGCRooter ** const stackTop;
 
     /* No copy or assignment semantics. */
     AutoGCRooter(AutoGCRooter& ida) = delete;
     void operator=(AutoGCRooter& ida) = delete;
 };
 
--- a/js/src/vm/String.h
+++ b/js/src/vm/String.h
@@ -1127,23 +1127,23 @@ static_assert(sizeof(PropertyName) == si
               "string subclasses must be binary-compatible with JSString");
 
 static MOZ_ALWAYS_INLINE jsid
 NameToId(PropertyName* name)
 {
     return NON_INTEGER_ATOM_TO_JSID(name);
 }
 
-class AutoNameVector : public AutoVectorRooter<PropertyName*>
+class AutoNameVector : public JS::AutoVectorRooterBase<PropertyName*>
 {
-    typedef AutoVectorRooter<PropertyName*> BaseType;
+    typedef AutoVectorRooterBase<PropertyName*> BaseType;
   public:
     explicit AutoNameVector(JSContext* cx
                             MOZ_GUARD_OBJECT_NOTIFIER_PARAM)
-        : AutoVectorRooter<PropertyName*>(cx, NAMEVECTOR)
+        : AutoVectorRooterBase<PropertyName*>(cx, NAMEVECTOR)
     {
         MOZ_GUARD_OBJECT_NOTIFIER_INIT;
     }
 
     HandlePropertyName operator[](size_t i) const {
         return HandlePropertyName::fromMarkedLocation(&begin()[i]);
     }
 
--- a/js/xpconnect/wrappers/FilteringWrapper.h
+++ b/js/xpconnect/wrappers/FilteringWrapper.h
@@ -10,17 +10,19 @@
 #include "XrayWrapper.h"
 #include "mozilla/Attributes.h"
 #include "jswrapper.h"
 #include "js/CallNonGenericMethod.h"
 
 struct JSPropertyDescriptor;
 
 namespace JS {
-class AutoIdVector;
+template <typename T>
+class AutoVectorRooter;
+typedef AutoVectorRooter<jsid> AutoIdVector;
 }
 
 namespace xpc {
 
 template <typename Base, typename Policy>
 class FilteringWrapper : public Base {
   public:
     MOZ_CONSTEXPR explicit FilteringWrapper(unsigned flags) : Base(flags) {}