Bug 1498320 - Make StandaloneFunctionCompiler::parse's |MutableHandleFunction fun| argument merely a |HandleFunction|, and make the compile function take its |MutableHandleFunction| argument first, not last. r=tcampbell as part of prior review comments
authorJeff Walden <jwalden@mit.edu>
Thu, 08 Nov 2018 18:45:26 -0800
changeset 446518 280587e10c971805d24c8cf1f2798763159043bb
parent 446517 a005d87f9e929015e7d56f6ae500d29f35fdc4ad
child 446519 d759d8052e768b202e6c1bad29080e3933793d31
push id35042
push useraiakab@mozilla.com
push dateThu, 15 Nov 2018 09:54:38 +0000
treeherdermozilla-central@dca9c72df68b [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerstcampbell
bugs1498320
milestone65.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 1498320 - Make StandaloneFunctionCompiler::parse's |MutableHandleFunction fun| argument merely a |HandleFunction|, and make the compile function take its |MutableHandleFunction| argument first, not last. r=tcampbell as part of prior review comments
js/src/frontend/BytecodeCompiler.cpp
--- a/js/src/frontend/BytecodeCompiler.cpp
+++ b/js/src/frontend/BytecodeCompiler.cpp
@@ -296,22 +296,22 @@ class MOZ_STACK_CLASS frontend::Standalo
     {}
 
     MOZ_MUST_USE bool prepare(StandaloneFunctionInfo& info,
                               const Maybe<uint32_t>& parameterListEnd)
     {
         return createSourceAndParser(info, ParseGoal::Script, parameterListEnd);
     }
 
-    CodeNode* parse(StandaloneFunctionInfo& info, MutableHandleFunction fun,
+    CodeNode* parse(StandaloneFunctionInfo& info, HandleFunction fun,
                     HandleScope enclosingScope, GeneratorKind generatorKind,
                     FunctionAsyncKind asyncKind, const Maybe<uint32_t>& parameterListEnd);
 
-    MOZ_MUST_USE bool compile(StandaloneFunctionInfo& info, CodeNode* parsedFunction,
-                              MutableHandleFunction fun);
+    MOZ_MUST_USE bool compile(MutableHandleFunction fun, StandaloneFunctionInfo& info,
+                              CodeNode* parsedFunction);
 
   private:
     // Create a script for a function with the given toString offsets in source
     // text.
     MOZ_MUST_USE bool createFunctionScript(StandaloneFunctionInfo& info,
                                            uint32_t toStringStart, uint32_t toStringEnd)
     {
         return info.internalCreateScript(toStringStart, toStringEnd, sourceBuffer_.length());
@@ -642,17 +642,17 @@ frontend::ModuleCompiler<Unit>::compile(
 }
 
 // Parse a standalone JS function, which might appear as the value of an
 // event handler attribute in an HTML <INPUT> tag, or in a Function()
 // constructor.
 template<typename Unit>
 CodeNode*
 frontend::StandaloneFunctionCompiler<Unit>::parse(StandaloneFunctionInfo& info,
-                                                  MutableHandleFunction fun,
+                                                  HandleFunction fun,
                                                   HandleScope enclosingScope,
                                                   GeneratorKind generatorKind,
                                                   FunctionAsyncKind asyncKind,
                                                   const Maybe<uint32_t>& parameterListEnd)
 {
     MOZ_ASSERT(fun);
     MOZ_ASSERT(fun->isTenured());
 
@@ -676,19 +676,19 @@ frontend::StandaloneFunctionCompiler<Uni
     } while (!fn);
 
     return &fn->as<CodeNode>();
 }
 
 // Compile a standalone JS function.
 template<typename Unit>
 bool
-frontend::StandaloneFunctionCompiler<Unit>::compile(StandaloneFunctionInfo& info,
-                                                    CodeNode* parsedFunction,
-                                                    MutableHandleFunction fun)
+frontend::StandaloneFunctionCompiler<Unit>::compile(MutableHandleFunction fun,
+                                                    StandaloneFunctionInfo& info,
+                                                    CodeNode* parsedFunction)
 {
     FunctionBox* funbox = parsedFunction->funbox();
     if (funbox->function()->isInterpreted()) {
         MOZ_ASSERT(fun == funbox->function());
 
         if (!createFunctionScript(info, funbox->toStringStart, funbox->toStringEnd)) {
             return false;
         }
@@ -1096,17 +1096,17 @@ frontend::CompileStandaloneFunction(JSCo
 
     RootedScope scope(cx, enclosingScope);
     if (!scope) {
         scope = &cx->global()->emptyGlobalScope();
     }
 
     CodeNode* parsedFunction = compiler.parse(info ,fun, scope, GeneratorKind::NotGenerator,
                                               FunctionAsyncKind::SyncFunction, parameterListEnd);
-    if (!parsedFunction || !compiler.compile(info, parsedFunction, fun)) {
+    if (!parsedFunction || !compiler.compile(fun, info, parsedFunction)) {
         return false;
     }
 
     assertException.reset();
     return true;
 }
 
 bool
@@ -1123,17 +1123,17 @@ frontend::CompileStandaloneGenerator(JSC
     if (!compiler.prepare(info, parameterListEnd)) {
         return false;
     }
 
     RootedScope emptyGlobalScope(cx, &cx->global()->emptyGlobalScope());
     CodeNode* parsedFunction =
         compiler.parse(info, fun, emptyGlobalScope, GeneratorKind::Generator,
                        FunctionAsyncKind::SyncFunction, parameterListEnd);
-    if (!parsedFunction || !compiler.compile(info, parsedFunction, fun)) {
+    if (!parsedFunction || !compiler.compile(fun, info, parsedFunction)) {
         return false;
     }
 
     assertException.reset();
     return true;
 }
 
 bool
@@ -1150,17 +1150,17 @@ frontend::CompileStandaloneAsyncFunction
     if (!compiler.prepare(info, parameterListEnd)) {
         return false;
     }
 
     RootedScope emptyGlobalScope(cx, &cx->global()->emptyGlobalScope());
     CodeNode* parsedFunction =
         compiler.parse(info, fun, emptyGlobalScope, GeneratorKind::NotGenerator,
                        FunctionAsyncKind::AsyncFunction, parameterListEnd);
-    if (!parsedFunction || !compiler.compile(info, parsedFunction, fun)) {
+    if (!parsedFunction || !compiler.compile(fun, info, parsedFunction)) {
         return false;
     }
 
     assertException.reset();
     return true;
 }
 
 bool
@@ -1177,15 +1177,15 @@ frontend::CompileStandaloneAsyncGenerato
     if (!compiler.prepare(info, parameterListEnd)) {
         return false;
     }
 
     RootedScope emptyGlobalScope(cx, &cx->global()->emptyGlobalScope());
     CodeNode* parsedFunction =
         compiler.parse(info, fun, emptyGlobalScope, GeneratorKind::Generator,
                        FunctionAsyncKind::AsyncFunction, parameterListEnd);
-    if (!parsedFunction || !compiler.compile(info, parsedFunction, fun)) {
+    if (!parsedFunction || !compiler.compile(fun, info, parsedFunction)) {
         return false;
     }
 
     assertException.reset();
     return true;
 }