Bug 1191099 - Replace AutoFunctionVector usage with Rooted; r=jonco
authorTerrence Cole <terrence@mozilla.com>
Tue, 04 Aug 2015 10:38:24 -0700
changeset 257371 4b635fb0b9d43efb9034e6550ae2ad840de5e14c
parent 257370 a647ab8f8d8d5808980a1d28f28f26e2f0d910c8
child 257372 3a580b48d1adca56f74b2a7491b468af3e70bee8
push id29215
push userryanvm@gmail.com
push dateWed, 12 Aug 2015 14:47:21 +0000
treeherdermozilla-central@295bbb5db86b [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjonco
bugs1191099
milestone43.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 1191099 - Replace AutoFunctionVector usage with Rooted; r=jonco
js/src/NamespaceImports.h
js/src/frontend/Parser.h
js/src/jsapi.h
--- a/js/src/NamespaceImports.h
+++ b/js/src/NamespaceImports.h
@@ -8,16 +8,17 @@
 // make unqualified references to them.
 
 #ifndef NamespaceImports_h
 #define NamespaceImports_h
 
 // These includes are needed these for some typedefs (e.g. HandleValue) and
 // functions (e.g. NullValue())...
 #include "js/CallNonGenericMethod.h"
+#include "js/TraceableVector.h"
 #include "js/TypeDecls.h"
 #include "js/Value.h"
 
 // ... but we do forward declarations of the structs and classes not pulled in
 // by the headers included above.
 namespace JS {
 
 class Latin1Chars;
@@ -28,17 +29,16 @@ class TwoByteCharsZ;
 class UTF8Chars;
 class UTF8CharsZ;
 
 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;
@@ -76,19 +76,22 @@ using JS::TwoByteChars;
 using JS::TwoByteCharsZ;
 using JS::UTF8Chars;
 using JS::UTF8CharsZ;
 
 using JS::AutoVectorRooter;
 typedef AutoVectorRooter<Value> AutoValueVector;
 typedef AutoVectorRooter<jsid> AutoIdVector;
 typedef AutoVectorRooter<JSObject*> AutoObjectVector;
-typedef AutoVectorRooter<JSFunction*> AutoFunctionVector;
 typedef AutoVectorRooter<JSScript*> AutoScriptVector;
 
+using ValueVector = TraceableVector<JS::Value>;
+using IdVector = TraceableVector<jsid>;
+using ScriptVector = TraceableVector<JSScript*>;
+
 using JS::AutoIdArray;
 
 using JS::AutoHashMapRooter;
 using JS::AutoHashSetRooter;
 using JS::RootedGeneric;
 
 using JS::CallArgs;
 using JS::CallNonGenericMethod;
--- a/js/src/frontend/Parser.h
+++ b/js/src/frontend/Parser.h
@@ -222,17 +222,17 @@ struct MOZ_STACK_CLASS ParseContext : pu
   public:
     OwnedAtomDefnMapPtr lexdeps;    /* unresolved lexical name dependencies */
 
     FuncStmtSet*    funcStmts;     /* Set of (non-top-level) function statements
                                        that will alias any top-level bindings with
                                        the same name. */
 
     // All inner functions in this context. Only filled in when parsing syntax.
-    AutoFunctionVector innerFunctions;
+    Rooted<TraceableVector<JSFunction*>> innerFunctions;
 
     // In a function context, points to a Directive struct that can be updated
     // to reflect new directives encountered in the Directive Prologue that
     // require reparsing the function. In global/module/generator-tail contexts,
     // we don't need to reparse when encountering a DirectivePrologue so this
     // pointer may be nullptr.
     Directives* newDirectives;
 
@@ -260,17 +260,17 @@ struct MOZ_STACK_CLASS ParseContext : pu
         decls_(prs->context, prs->alloc),
         args_(prs->context),
         vars_(prs->context),
         bodyLevelLexicals_(prs->context),
         parserPC(&prs->pc),
         oldpc(prs->pc),
         lexdeps(prs->context),
         funcStmts(nullptr),
-        innerFunctions(prs->context),
+        innerFunctions(prs->context, TraceableVector<JSFunction*>(prs->context)),
         newDirectives(newDirectives),
         inDeclDestructuring(false)
     {
         prs->pc = this;
     }
 
     ~ParseContext();
 
--- a/js/src/jsapi.h
+++ b/js/src/jsapi.h
@@ -24,16 +24,17 @@
 #include "jspubtd.h"
 
 #include "js/CallArgs.h"
 #include "js/Class.h"
 #include "js/HashTable.h"
 #include "js/Id.h"
 #include "js/Principals.h"
 #include "js/RootingAPI.h"
+#include "js/TraceableVector.h"
 #include "js/TracingAPI.h"
 #include "js/Utility.h"
 #include "js/Value.h"
 #include "js/Vector.h"
 
 /************************************************************************/
 
 namespace JS {
@@ -210,19 +211,22 @@ class MOZ_STACK_CLASS AutoVectorRooter :
     }
 
     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;
 
+using ValueVector = js::TraceableVector<JS::Value>;
+using IdVector = js::TraceableVector<jsid>;
+using ScriptVector = js::TraceableVector<JSScript*>;
+
 template<class Key, class Value>
 class AutoHashMapRooter : protected AutoGCRooter
 {
   private:
     typedef js::HashMap<Key, Value> HashMapImpl;
 
   public:
     explicit AutoHashMapRooter(JSContext* cx, ptrdiff_t tag