Bug 1528837 - Part 2: Rename ParserBase::alloc field to alloc_. r=Yoric
authorTooru Fujisawa <arai_a@mac.com>
Sun, 24 Feb 2019 03:25:38 +0000
changeset 518649 886ae31b4f01
parent 518648 4c9346b3f7e3
child 518650 404e9820bc40
push id10862
push userffxbld-merge
push dateMon, 11 Mar 2019 13:01:11 +0000
treeherdermozilla-beta@a2e7f5c935da [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersYoric
bugs1528837
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 1528837 - Part 2: Rename ParserBase::alloc field to alloc_. r=Yoric Differential Revision: https://phabricator.services.mozilla.com/D20213
js/src/frontend/Parser.cpp
js/src/frontend/Parser.h
--- a/js/src/frontend/Parser.cpp
+++ b/js/src/frontend/Parser.cpp
@@ -136,55 +136,55 @@ bool GeneralParser<ParseHandler, Unit>::
 }
 
 ParserBase::ParserBase(JSContext* cx, LifoAlloc& alloc,
                        const ReadOnlyCompileOptions& options,
                        bool foldConstants, UsedNameTracker& usedNames,
                        ScriptSourceObject* sourceObject, ParseGoal parseGoal)
     : AutoGCRooter(cx, AutoGCRooter::Tag::Parser),
       cx_(cx),
-      alloc(alloc),
+      alloc_(alloc),
       anyChars(cx, options, thisForCtor()),
       traceListHead(nullptr),
       pc(nullptr),
       usedNames(usedNames),
       ss(nullptr),
       sourceObject(cx, sourceObject),
       keepAtoms(cx),
       foldConstants(foldConstants),
 #ifdef DEBUG
       checkOptionsCalled(false),
 #endif
       isUnexpectedEOF_(false),
       awaitHandling_(AwaitIsName),
       inParametersOfAsyncFunction_(false),
       parseGoal_(uint8_t(parseGoal)) {
   cx->frontendCollectionPool().addActiveCompilation();
-  tempPoolMark = alloc.mark();
+  tempPoolMark = alloc_.mark();
 }
 
 bool ParserBase::checkOptions() {
 #ifdef DEBUG
   checkOptionsCalled = true;
 #endif
 
   return anyChars.checkOptions();
 }
 
 ParserBase::~ParserBase() {
   MOZ_ASSERT(checkOptionsCalled);
 
-  alloc.release(tempPoolMark);
+  alloc_.release(tempPoolMark);
 
   /*
    * The parser can allocate enormous amounts of memory for large functions.
    * Eagerly free the memory now (which otherwise won't be freed until the
    * next GC) to avoid unnecessary OOMs.
    */
-  alloc.freeAllIfHugeAndUnused();
+  alloc_.freeAllIfHugeAndUnused();
 
   cx_->frontendCollectionPool().removeActiveCompilation();
 }
 
 template <class ParseHandler>
 PerHandlerParser<ParseHandler>::PerHandlerParser(
     JSContext* cx, LifoAlloc& alloc, const ReadOnlyCompileOptions& options,
     bool foldConstants, UsedNameTracker& usedNames,
@@ -255,17 +255,17 @@ BoxT* ParserBase::newTraceListNode(ArgT*
   /*
    * We use JSContext.tempLifoAlloc to allocate parsed objects and place them
    * on a list in this Parser to ensure GC safety. Thus the tempLifoAlloc
    * arenas containing the entries must be alive until we are done with
    * scanning, parsing and code generation for the whole script or top-level
    * function.
    */
 
-  BoxT* box = alloc.template new_<BoxT>(arg, traceListHead);
+  BoxT* box = alloc_.template new_<BoxT>(arg, traceListHead);
   if (!box) {
     ReportOutOfMemory(cx_);
     return nullptr;
   }
 
   traceListHead = box;
 
   return box;
@@ -288,17 +288,17 @@ FunctionBox* PerHandlerParser<ParseHandl
 
   /*
    * We use JSContext.tempLifoAlloc to allocate parsed objects and place them
    * on a list in this Parser to ensure GC safety. Thus the tempLifoAlloc
    * arenas containing the entries must be alive until we are done with
    * scanning, parsing and code generation for the whole script or top-level
    * function.
    */
-  FunctionBox* funbox = alloc.new_<FunctionBox>(
+  FunctionBox* funbox = alloc_.new_<FunctionBox>(
       cx_, traceListHead, fun, toStringStart, inheritedDirectives,
       options().extraWarningsOption, generatorKind, asyncKind);
   if (!funbox) {
     ReportOutOfMemory(cx_);
     return nullptr;
   }
 
   traceListHead = funbox;
@@ -990,17 +990,17 @@ Maybe<GlobalScope::Data*> NewGlobalScope
                           &GlobalScope::Data::constStart, consts);
   }
 
   return Some(bindings);
 }
 
 Maybe<GlobalScope::Data*> ParserBase::newGlobalScopeData(
     ParseContext::Scope& scope) {
-  return NewGlobalScopeData(cx_, scope, alloc, pc);
+  return NewGlobalScopeData(cx_, scope, alloc_, pc);
 }
 
 Maybe<ModuleScope::Data*> NewModuleScopeData(JSContext* cx,
                                              ParseContext::Scope& scope,
                                              LifoAlloc& alloc,
                                              ParseContext* pc) {
   BindingNameVector imports(cx);
   BindingNameVector vars(cx);
@@ -1055,17 +1055,17 @@ Maybe<ModuleScope::Data*> NewModuleScope
                           &ModuleScope::Data::constStart, consts);
   }
 
   return Some(bindings);
 }
 
 Maybe<ModuleScope::Data*> ParserBase::newModuleScopeData(
     ParseContext::Scope& scope) {
-  return NewModuleScopeData(cx_, scope, alloc, pc);
+  return NewModuleScopeData(cx_, scope, alloc_, pc);
 }
 
 Maybe<EvalScope::Data*> NewEvalScopeData(JSContext* cx,
                                          ParseContext::Scope& scope,
                                          LifoAlloc& alloc, ParseContext* pc) {
   BindingNameVector vars(cx);
 
   for (BindingIter bi = scope.bindings(pc); bi; bi++) {
@@ -1092,17 +1092,17 @@ Maybe<EvalScope::Data*> NewEvalScopeData
     InitializeBindingData(bindings, numBindings, vars);
   }
 
   return Some(bindings);
 }
 
 Maybe<EvalScope::Data*> ParserBase::newEvalScopeData(
     ParseContext::Scope& scope) {
-  return NewEvalScopeData(cx_, scope, alloc, pc);
+  return NewEvalScopeData(cx_, scope, alloc_, pc);
 }
 
 Maybe<FunctionScope::Data*> NewFunctionScopeData(JSContext* cx,
                                                  ParseContext::Scope& scope,
                                                  bool hasParameterExprs,
                                                  LifoAlloc& alloc,
                                                  ParseContext* pc) {
   BindingNameVector positionalFormals(cx);
@@ -1190,17 +1190,17 @@ Maybe<FunctionScope::Data*> NewFunctionS
                           formals, &FunctionScope::Data::varStart, vars);
   }
 
   return Some(bindings);
 }
 
 Maybe<FunctionScope::Data*> ParserBase::newFunctionScopeData(
     ParseContext::Scope& scope, bool hasParameterExprs) {
-  return NewFunctionScopeData(cx_, scope, hasParameterExprs, alloc, pc);
+  return NewFunctionScopeData(cx_, scope, hasParameterExprs, alloc_, pc);
 }
 
 Maybe<VarScope::Data*> NewVarScopeData(JSContext* cx,
                                        ParseContext::Scope& scope,
                                        LifoAlloc& alloc, ParseContext* pc) {
   BindingNameVector vars(cx);
 
   bool allBindingsClosedOver = pc->sc()->allBindingsClosedOver();
@@ -1225,17 +1225,17 @@ Maybe<VarScope::Data*> NewVarScopeData(J
 
     InitializeBindingData(bindings, numBindings, vars);
   }
 
   return Some(bindings);
 }
 
 Maybe<VarScope::Data*> ParserBase::newVarScopeData(ParseContext::Scope& scope) {
-  return NewVarScopeData(cx_, scope, alloc, pc);
+  return NewVarScopeData(cx_, scope, alloc_, pc);
 }
 
 Maybe<LexicalScope::Data*> NewLexicalScopeData(JSContext* cx,
                                                ParseContext::Scope& scope,
                                                LifoAlloc& alloc,
                                                ParseContext* pc) {
   BindingNameVector lets(cx);
   BindingNameVector consts(cx);
@@ -1278,17 +1278,17 @@ Maybe<LexicalScope::Data*> NewLexicalSco
                           &LexicalScope::Data::constStart, consts);
   }
 
   return Some(bindings);
 }
 
 Maybe<LexicalScope::Data*> ParserBase::newLexicalScopeData(
     ParseContext::Scope& scope) {
-  return NewLexicalScopeData(cx_, scope, alloc, pc);
+  return NewLexicalScopeData(cx_, scope, alloc_, pc);
 }
 
 template <>
 SyntaxParseHandler::LexicalScopeNodeType
 PerHandlerParser<SyntaxParseHandler>::finishLexicalScope(
     ParseContext::Scope& scope, Node body) {
   if (!propagateFreeNamesAndMarkClosedOverBindings(scope)) {
     return null();
@@ -9262,17 +9262,17 @@ Parser<SyntaxParseHandler, Unit>::newReg
   MOZ_ASSERT(!options().selfHostingMode);
 
   // Only check the regexp's syntax, but don't create a regexp object.
   const auto& chars = tokenStream.getCharBuffer();
   RegExpFlag flags = anyChars.currentToken().regExpFlags();
 
   mozilla::Range<const char16_t> source(chars.begin(), chars.length());
   {
-    LifoAllocScope scopeAlloc(&alloc);
+    LifoAllocScope scopeAlloc(&alloc_);
     if (!js::irregexp::ParsePatternSyntax(anyChars, scopeAlloc.alloc(), source,
                                           flags & UnicodeFlag)) {
       return null();
     }
   }
 
   return handler.newRegExp(SyntaxParseHandler::NodeGeneric, pos(), *this);
 }
--- a/js/src/frontend/Parser.h
+++ b/js/src/frontend/Parser.h
@@ -244,17 +244,17 @@ class MOZ_STACK_CLASS ParserBase : priva
 
   // This is needed to cast a parser to JS::AutoGCRooter.
   friend void js::frontend::TraceParser(JSTracer* trc,
                                         JS::AutoGCRooter* parser);
 
  public:
   JSContext* const cx_;
 
-  LifoAlloc& alloc;
+  LifoAlloc& alloc_;
 
   TokenStreamAnyChars anyChars;
   LifoAlloc::Mark tempPoolMark;
 
   /* list of parsed objects and BigInts for GC tracing */
   TraceListNode* traceListHead;
 
   /* innermost parse context (stack-allocated) */
@@ -380,22 +380,22 @@ class MOZ_STACK_CLASS ParserBase : priva
   // that points into released ParseNodes is destroyed.
   class Mark {
     friend class ParserBase;
     LifoAlloc::Mark mark;
     TraceListNode* traceListHead;
   };
   Mark mark() const {
     Mark m;
-    m.mark = alloc.mark();
+    m.mark = alloc_.mark();
     m.traceListHead = traceListHead;
     return m;
   }
   void release(Mark m) {
-    alloc.release(m.mark);
+    alloc_.release(m.mark);
     traceListHead = m.traceListHead;
   }
 
  private:
   template <typename BoxT, typename ArgT>
   BoxT* newTraceListNode(ArgT* arg);
 
  public:
@@ -712,17 +712,17 @@ class MOZ_STACK_CLASS GeneralParser : pu
 
  protected:
   using Modifier = TokenStreamShared::Modifier;
   using Position = typename TokenStream::Position;
 
   using Base::PredictInvoked;
   using Base::PredictUninvoked;
 
-  using Base::alloc;
+  using Base::alloc_;
   using Base::awaitIsKeyword;
   using Base::inParametersOfAsyncFunction;
   using Base::parseGoal;
 #if DEBUG
   using Base::checkOptionsCalled;
 #endif
   using Base::finishFunctionScopes;
   using Base::finishLexicalScope;
@@ -1482,17 +1482,17 @@ class MOZ_STACK_CLASS Parser<SyntaxParse
   using Base::warning;
   using Base::warningAt;
   using Base::warningNoOffset;
   using Base::warningWithNotes;
   using Base::warningWithNotesAt;
   using Base::warningWithNotesNoOffset;
 
  private:
-  using Base::alloc;
+  using Base::alloc_;
 #if DEBUG
   using Base::checkOptionsCalled;
 #endif
   using Base::finishFunctionScopes;
   using Base::functionFormalParametersAndBody;
   using Base::handler;
   using Base::innerFunction;
   using Base::keepAtoms;
@@ -1631,17 +1631,17 @@ class MOZ_STACK_CLASS Parser<FullParseHa
   using Base::warning;
   using Base::warningAt;
   using Base::warningNoOffset;
   using Base::warningWithNotes;
   using Base::warningWithNotesAt;
   using Base::warningWithNotesNoOffset;
 
  private:
-  using Base::alloc;
+  using Base::alloc_;
   using Base::checkLabelOrIdentifierReference;
 #if DEBUG
   using Base::checkOptionsCalled;
 #endif
   using Base::cx_;
   using Base::finishFunctionScopes;
   using Base::finishLexicalScope;
   using Base::innerFunction;