Bug 1191099 - Replace AutoFunctionVector usage with Rooted; r=jonco
☠☠ backed out by e426fa97ea77 ☠ ☠
authorTerrence Cole <terrence@mozilla.com>
Tue, 04 Aug 2015 10:38:24 -0700
changeset 256347 6249e4edb023c89661910a5838f7442b72411a10
parent 256346 21c28216e5e7255fa072ceefe2f31b1930758f34
child 256348 fa8ed8cd2a064a7d66ef64c8d3e70461fb867443
push id63309
push usertcole@mozilla.com
push dateWed, 05 Aug 2015 18:50:07 +0000
treeherdermozilla-inbound@6249e4edb023 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjonco
bugs1191099
milestone42.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,23 @@ 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 ObjectVector = TraceableVector<JSObject*>;
+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
@@ -227,17 +227,17 @@ struct ParseContext : public GenericPars
   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;
 
@@ -268,17 +268,17 @@ struct ParseContext : public GenericPars
         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
@@ -23,16 +23,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 {
@@ -209,19 +210,23 @@ 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 ObjectVector = js::TraceableVector<JSObject*>;
+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