Bug 1534516 - Use correct AutoGCRooter::Tag in BinASTParserBase. r=Yoric
authorTooru Fujisawa <arai_a@mac.com>
Tue, 12 Mar 2019 09:16:00 +0000
changeset 521508 caa78f1b64987daad530822173a6c1359a260514
parent 521507 e651386473edf4981e41c91f776705324fdc2210
child 521509 e565518151b74eaadbdaf09da5e3c897400bf28d
push id10867
push userdvarga@mozilla.com
push dateThu, 14 Mar 2019 15:20:45 +0000
treeherdermozilla-beta@abad13547875 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersYoric
bugs1534516
milestone67.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 1534516 - Use correct AutoGCRooter::Tag in BinASTParserBase. r=Yoric Differential Revision: https://phabricator.services.mozilla.com/D23083
js/public/RootingAPI.h
js/src/frontend/BinASTParserBase.cpp
js/src/frontend/BinASTParserPerTokenizer.cpp
js/src/frontend/BinASTParserPerTokenizer.h
js/src/frontend/BytecodeCompiler.h
js/src/frontend/Parser.cpp
js/src/frontend/Parser.h
js/src/gc/RootMarking.cpp
--- a/js/public/RootingAPI.h
+++ b/js/public/RootingAPI.h
@@ -906,17 +906,17 @@ class RootingContext {
 
 class JS_PUBLIC_API AutoGCRooter {
  protected:
   enum class Tag : uint8_t {
     Array,      /* js::AutoArrayRooter */
     ValueArray, /* js::AutoValueArray */
     Parser,     /* js::frontend::Parser */
 #if defined(JS_BUILD_BINAST)
-    BinParser,     /* js::frontend::BinSource */
+    BinASTParser,  /* js::frontend::BinASTParser */
 #endif             // defined(JS_BUILD_BINAST)
     WrapperVector, /* js::AutoWrapperVector */
     Wrapper,       /* js::AutoWrapperRooter */
     Custom         /* js::CustomAutoRooter */
   };
 
  public:
   AutoGCRooter(JSContext* cx, Tag tag)
--- a/js/src/frontend/BinASTParserBase.cpp
+++ b/js/src/frontend/BinASTParserBase.cpp
@@ -9,12 +9,13 @@
 #include "vm/JSContext-inl.h"
 
 namespace js {
 namespace frontend {
 
 BinASTParserBase::BinASTParserBase(JSContext* cx, LifoAlloc& alloc,
                                    UsedNameTracker& usedNames,
                                    HandleScriptSourceObject sourceObject)
-    : ParserSharedBase(cx, alloc, usedNames, sourceObject) {}
+    : ParserSharedBase(cx, alloc, usedNames, sourceObject,
+                       ParserSharedBase::Kind::BinASTParser) {}
 
 }  // namespace frontend
 }  // namespace js
--- a/js/src/frontend/BinASTParserPerTokenizer.cpp
+++ b/js/src/frontend/BinASTParserPerTokenizer.cpp
@@ -764,17 +764,17 @@ bool BinASTParserPerTokenizer<Tok>::comp
     errorOffset.is<NoOffset>();
     err->columnNumber = 0;
   }
 
   err->isMuted = options().mutedErrors();
   return true;
 }
 
-void TraceBinParser(JSTracer* trc, JS::AutoGCRooter* parser) {
+void TraceBinASTParser(JSTracer* trc, JS::AutoGCRooter* parser) {
   static_cast<BinASTParserBase*>(parser)->trace(trc);
 }
 
 template <typename Tok>
 void BinASTParserPerTokenizer<Tok>::doTrace(JSTracer* trc) {
   if (tokenizer_) {
     tokenizer_->traceMetadata(trc);
   }
--- a/js/src/frontend/BinASTParserPerTokenizer.h
+++ b/js/src/frontend/BinASTParserPerTokenizer.h
@@ -318,16 +318,16 @@ class BinParseContext : public ParseCont
  public:
   template <typename Tok>
   BinParseContext(JSContext* cx, BinASTParserPerTokenizer<Tok>* parser,
                   SharedContext* sc, Directives* newDirectives)
       : ParseContext(cx, parser->pc_, sc, *parser, parser->usedNames_,
                      newDirectives, /* isFull = */ true) {}
 };
 
-void TraceBinParser(JSTracer* trc, JS::AutoGCRooter* parser);
+void TraceBinASTParser(JSTracer* trc, JS::AutoGCRooter* parser);
 
 extern template class BinASTParserPerTokenizer<BinTokenReaderMultipart>;
 
 }  // namespace frontend
 }  // namespace js
 
 #endif  // frontend_BinASTParserPerTokenizer_h
--- a/js/src/frontend/BytecodeCompiler.h
+++ b/js/src/frontend/BytecodeCompiler.h
@@ -193,17 +193,17 @@ bool IsKeyword(JSLinearString* str);
 
 /* Trace all GC things reachable from parser. Defined in Parser.cpp. */
 void TraceParser(JSTracer* trc, JS::AutoGCRooter* parser);
 
 #if defined(JS_BUILD_BINAST)
 
 /* Trace all GC things reachable from binjs parser. Defined in
  * BinASTParserPerTokenizer.cpp. */
-void TraceBinParser(JSTracer* trc, JS::AutoGCRooter* parser);
+void TraceBinASTParser(JSTracer* trc, JS::AutoGCRooter* parser);
 
 #endif  // defined(JS_BUILD_BINAST)
 
 class MOZ_STACK_CLASS AutoFrontendTraceLog {
 #ifdef JS_TRACE_LOGGING
   TraceLoggerThread* logger_;
   mozilla::Maybe<TraceLoggerEvent> frontendEvent_;
   mozilla::Maybe<AutoTraceLog> frontendLog_;
--- a/js/src/frontend/Parser.cpp
+++ b/js/src/frontend/Parser.cpp
@@ -132,18 +132,20 @@ bool GeneralParser<ParseHandler, Unit>::
     errorReport(actual);
     return false;
   }
   return true;
 }
 
 ParserSharedBase::ParserSharedBase(JSContext* cx, LifoAlloc& alloc,
                                    UsedNameTracker& usedNames,
-                                   ScriptSourceObject* sourceObject)
-    : JS::AutoGCRooter(cx, AutoGCRooter::Tag::Parser),
+                                   ScriptSourceObject* sourceObject, Kind kind)
+    : JS::AutoGCRooter(cx, kind == Kind::Parser
+                               ? JS::AutoGCRooter::Tag::Parser
+                               : JS::AutoGCRooter::Tag::BinASTParser),
       cx_(cx),
       alloc_(alloc),
       traceListHead_(nullptr),
       pc_(nullptr),
       usedNames_(usedNames),
       sourceObject_(cx, sourceObject),
       keepAtoms_(cx) {
   cx->frontendCollectionPool().addActiveCompilation();
@@ -162,17 +164,18 @@ ParserSharedBase::~ParserSharedBase() {
 
   cx_->frontendCollectionPool().removeActiveCompilation();
 }
 
 ParserBase::ParserBase(JSContext* cx, LifoAlloc& alloc,
                        const ReadOnlyCompileOptions& options,
                        bool foldConstants, UsedNameTracker& usedNames,
                        ScriptSourceObject* sourceObject, ParseGoal parseGoal)
-    : ParserSharedBase(cx, alloc, usedNames, sourceObject),
+    : ParserSharedBase(cx, alloc, usedNames, sourceObject,
+                       ParserSharedBase::Kind::Parser),
       anyChars(cx, options, thisForCtor()),
       ss(nullptr),
       foldConstants_(foldConstants),
 #ifdef DEBUG
       checkOptionsCalled_(false),
 #endif
       isUnexpectedEOF_(false),
       awaitHandling_(AwaitIsName),
--- a/js/src/frontend/Parser.h
+++ b/js/src/frontend/Parser.h
@@ -235,18 +235,20 @@ enum AwaitHandling : uint8_t {
 template <class ParseHandler, typename Unit>
 class AutoAwaitIsKeyword;
 
 template <class ParseHandler, typename Unit>
 class AutoInParametersOfAsyncFunction;
 
 class MOZ_STACK_CLASS ParserSharedBase : private JS::AutoGCRooter {
  public:
+  enum class Kind { Parser, BinASTParser };
+
   ParserSharedBase(JSContext* cx, LifoAlloc& alloc, UsedNameTracker& usedNames,
-                   ScriptSourceObject* sourceObject);
+                   ScriptSourceObject* sourceObject, Kind kind);
   ~ParserSharedBase();
 
  public:
   JSContext* const cx_;
 
   LifoAlloc& alloc_;
 
   LifoAlloc::Mark tempPoolMark_;
@@ -266,18 +268,18 @@ class MOZ_STACK_CLASS ParserSharedBase :
   AutoKeepAtoms keepAtoms_;
 
  private:
   // This is needed to cast a parser to JS::AutoGCRooter.
   friend void js::frontend::TraceParser(JSTracer* trc,
                                         JS::AutoGCRooter* parser);
 
 #if defined(JS_BUILD_BINAST)
-  friend void js::frontend::TraceBinParser(JSTracer* trc,
-                                           JS::AutoGCRooter* parser);
+  friend void js::frontend::TraceBinASTParser(JSTracer* trc,
+                                              JS::AutoGCRooter* parser);
 #endif  // JS_BUILD_BINAST
 
  private:
   // Create a new traceable node and store it into the trace list.
   template <typename BoxT, typename ArgT>
   BoxT* newTraceListNode(ArgT* arg);
 
  public:
--- a/js/src/gc/RootMarking.cpp
+++ b/js/src/gc/RootMarking.cpp
@@ -154,18 +154,18 @@ void JSRuntime::finishPersistentRoots() 
 
 inline void AutoGCRooter::trace(JSTracer* trc) {
   switch (tag_) {
     case Tag::Parser:
       frontend::TraceParser(trc, this);
       return;
 
 #if defined(JS_BUILD_BINAST)
-    case Tag::BinParser:
-      frontend::TraceBinParser(trc, this);
+    case Tag::BinASTParser:
+      frontend::TraceBinASTParser(trc, this);
       return;
 #endif  // defined(JS_BUILD_BINAST)
 
     case Tag::ValueArray: {
       /*
        * We don't know the template size parameter, but we can safely treat it
        * as an AutoValueArray<1> because the length is stored separately.
        */