Bug 1424946 - Move GeneralParser::newFunctionBox into a baser class. r=arai
authorJeff Walden <jwalden@mit.edu>
Tue, 12 Dec 2017 15:20:57 -0600
changeset 448145 8d12eae2c379704ab79914f5b0d822962f203333
parent 448144 e934b45172edc7425a3a5a22f7005db734f8f659
child 448146 6eb563243c9a610ea40f9f7cba2f798b535744ca
push id8527
push userCallek@gmail.com
push dateThu, 11 Jan 2018 21:05:50 +0000
treeherdermozilla-beta@95342d212a7a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersarai
bugs1424946
milestone59.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 1424946 - Move GeneralParser::newFunctionBox into a baser class. r=arai
js/src/frontend/Parser.cpp
js/src/frontend/Parser.h
--- a/js/src/frontend/Parser.cpp
+++ b/js/src/frontend/Parser.cpp
@@ -918,37 +918,35 @@ ParserBase::newObjectBox(JSObject* obj)
         return nullptr;
     }
 
     traceListHead = objbox;
 
     return objbox;
 }
 
-template <class ParseHandler, typename CharT>
+template <class ParseHandler>
 FunctionBox*
-GeneralParser<ParseHandler, CharT>::newFunctionBox(Node fn, JSFunction* fun,
-                                                   uint32_t toStringStart,
-                                                   Directives inheritedDirectives,
-                                                   GeneratorKind generatorKind,
-                                                   FunctionAsyncKind asyncKind)
+PerHandlerParser<ParseHandler>::newFunctionBox(Node fn, JSFunction* fun, uint32_t toStringStart,
+                                               Directives inheritedDirectives,
+                                               GeneratorKind generatorKind,
+                                               FunctionAsyncKind asyncKind)
 {
     MOZ_ASSERT(fun);
 
     /*
      * 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.template new_<FunctionBox>(context, traceListHead, fun, toStringStart,
-                                         inheritedDirectives, options().extraWarningsOption,
-                                         generatorKind, asyncKind);
+        alloc.new_<FunctionBox>(context, traceListHead, fun, toStringStart, inheritedDirectives,
+                                options().extraWarningsOption, generatorKind, asyncKind);
     if (!funbox) {
         ReportOutOfMemory(context);
         return nullptr;
     }
 
     traceListHead = funbox;
     if (fn)
         handler.setFunctionBox(fn, funbox);
--- a/js/src/frontend/Parser.h
+++ b/js/src/frontend/Parser.h
@@ -281,17 +281,19 @@ class PerHandlerParser
     ParseHandler handler;
 
     const char* nameIsArgumentsOrEval(Node node);
 
   public:
     bool isValidSimpleAssignmentTarget(Node node,
                                        FunctionCallBehavior behavior = ForbidAssignmentToFunctionCalls);
 
-
+    FunctionBox* newFunctionBox(Node fn, JSFunction* fun, uint32_t toStringStart,
+                                Directives directives, GeneratorKind generatorKind,
+                                FunctionAsyncKind asyncKind);
 };
 
 enum class ExpressionClosure { Allowed, Forbidden };
 
 template<class Parser>
 class ParserAnyCharsAccess
 {
   public:
@@ -338,16 +340,17 @@ class GeneralParser
 #endif
     using Base::foldConstants;
     using Base::getFilename;
     using Base::hasValidSimpleStrictParameterNames;
     using Base::isUnexpectedEOF_;
     using Base::keepAtoms;
     using Base::nameIsArgumentsOrEval;
     using Base::newFunction;
+    using Base::newFunctionBox;
     using Base::options;
     using Base::pos;
     using Base::setLocalStrictMode;
     using Base::traceListHead;
     using Base::yieldExpressionsSupported;
 
   public:
     using Base::anyChars;
@@ -522,20 +525,16 @@ class GeneralParser
 
     friend void js::frontend::TraceParser(JSTracer* trc, JS::AutoGCRooter* parser);
 
     /*
      * Parse a top-level JS script.
      */
     Node parse();
 
-    FunctionBox* newFunctionBox(Node fn, JSFunction* fun, uint32_t toStringStart,
-                                Directives directives,
-                                GeneratorKind generatorKind, FunctionAsyncKind asyncKind);
-
     void trace(JSTracer* trc);
 
     /* Report the given error at the current offset. */
     void error(unsigned errorNumber, ...);
     void errorWithNotes(UniquePtr<JSErrorNotes> notes, unsigned errorNumber, ...);
 
     /* Report the given error at the given offset. */
     void errorAt(uint32_t offset, unsigned errorNumber, ...);