Bug 1456416 - Make EagerGetter/EagerSetter create their scope earlier;r=arai
authorDavid Teller <dteller@mozilla.com>
Tue, 24 Apr 2018 13:16:51 +0200
changeset 472813 93311fa8576201ff0dfaa8b2ae0a1b67485004b4
parent 472812 26dd1f51eaf4e3aa0a4faad0846ba3cb712c2825
child 472814 5ea81be0d0285cbcebb752a03fa3309eadbeaac6
push id1728
push userjlund@mozilla.com
push dateMon, 18 Jun 2018 21:12:27 +0000
treeherdermozilla-release@c296fde26f5f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersarai
bugs1456416
milestone61.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 1456416 - Make EagerGetter/EagerSetter create their scope earlier;r=arai MozReview-Commit-ID: 2RlO4wUp5F2
js/src/frontend/BinSource-auto.cpp
js/src/frontend/BinSource.webidl_
js/src/frontend/BinSource.yaml
--- a/js/src/frontend/BinSource-auto.cpp
+++ b/js/src/frontend/BinSource-auto.cpp
@@ -4725,18 +4725,18 @@ BinASTParser<Tok>::parseInterfaceEagerFu
     BINJS_TRY_VAR(body, factory_.newLexicalScope(*lexicalScopeData, body));
     BINJS_MOZ_TRY_DECL(result, buildFunction(start, kind, name, params, body, funbox));
     return result;
 }
 
 
 /*
  interface EagerGetter : Node {
+    PropertyName name;
     AssertedVarScope? bodyScope;
-    PropertyName name;
     FunctionBody body;
  }
 */
 template<typename Tok> JS::Result<ParseNode*>
 BinASTParser<Tok>::parseEagerGetter()
 {
     BinKind kind;
     BinFields fields(cx_);
@@ -4754,45 +4754,45 @@ BinASTParser<Tok>::parseEagerGetter()
 template<typename Tok> JS::Result<ParseNode*>
 BinASTParser<Tok>::parseInterfaceEagerGetter(const size_t start, const BinKind kind, const BinFields& fields)
 {
     MOZ_ASSERT(kind == BinKind::EagerGetter);
     CheckRecursionLimit(cx_);
 
 
 #if defined(DEBUG)
-    const BinField expected_fields[3] = { BinField::BodyScope, BinField::Name, BinField::Body };
+    const BinField expected_fields[3] = { BinField::Name, BinField::BodyScope, BinField::Body };
     MOZ_TRY(tokenizer_->checkFields(kind, fields, expected_fields));
 #endif // defined(DEBUG)
 
 
 
 
-    MOZ_TRY(parseOptionalAssertedVarScope());
-
-
-
-
     BINJS_MOZ_TRY_DECL(name, parsePropertyName());
-
-
     BINJS_MOZ_TRY_DECL(funbox, buildFunctionBox(
         GeneratorKind::NotGenerator,
         FunctionAsyncKind::SyncFunction,
-        FunctionSyntaxKind::Getter, name));
+        FunctionSyntaxKind::Getter, /* name = */ nullptr));
 
     // Push a new ParseContext. It will be used to parse `scope`, the arguments, the function.
     BinParseContext funpc(cx_, this, funbox, /* newDirectives = */ nullptr);
     BINJS_TRY(funpc.init());
     parseContext_->functionScope().useAsVarScope(parseContext_);
     MOZ_ASSERT(parseContext_->isFunctionBox());
 
     ParseContext::Scope lexicalScope(cx_, parseContext_, usedNames_);
     BINJS_TRY(lexicalScope.init(parseContext_));
 
+
+
+    MOZ_TRY(parseOptionalAssertedVarScope());
+
+
+
+
     BINJS_MOZ_TRY_DECL(body, parseFunctionBody());
 
 
     ParseNode* params = new_<ListNode>(ParseNodeKind::ParamsBody, tokenizer_->pos(start));
     BINJS_MOZ_TRY_DECL(method, buildFunction(start, kind, name, params, body, funbox));
     BINJS_TRY_DECL(result, factory_.newObjectMethodOrPropertyDefinition(name, method, AccessorType::Getter));
     return result;
 }
@@ -4929,46 +4929,46 @@ BinASTParser<Tok>::parseInterfaceEagerSe
     const BinField expected_fields[5] = { BinField::Name, BinField::ParameterScope, BinField::BodyScope, BinField::Param, BinField::Body };
     MOZ_TRY(tokenizer_->checkFields(kind, fields, expected_fields));
 #endif // defined(DEBUG)
 
 
 
 
     BINJS_MOZ_TRY_DECL(name, parsePropertyName());
-
+    BINJS_MOZ_TRY_DECL(funbox, buildFunctionBox(
+        GeneratorKind::NotGenerator,
+        FunctionAsyncKind::SyncFunction,
+        FunctionSyntaxKind::Setter, /* name = */ nullptr));
+
+    // Push a new ParseContext. It will be used to parse `scope`, the arguments, the function.
+    BinParseContext funpc(cx_, this, funbox, /* newDirectives = */ nullptr);
+    BINJS_TRY(funpc.init());
+    parseContext_->functionScope().useAsVarScope(parseContext_);
+    MOZ_ASSERT(parseContext_->isFunctionBox());
+
+    ParseContext::Scope lexicalScope(cx_, parseContext_, usedNames_);
+    BINJS_TRY(lexicalScope.init(parseContext_));
 
 
 
     MOZ_TRY(parseOptionalAssertedParameterScope());
 
 
 
 
     MOZ_TRY(parseOptionalAssertedVarScope());
 
 
 
 
     BINJS_MOZ_TRY_DECL(param, parseParameter());
 
 
-    BINJS_MOZ_TRY_DECL(funbox, buildFunctionBox(
-        GeneratorKind::NotGenerator,
-        FunctionAsyncKind::SyncFunction,
-        FunctionSyntaxKind::Setter, name));
-
-    // Push a new ParseContext. It will be used to parse `scope`, the arguments, the function.
-    BinParseContext funpc(cx_, this, funbox, /* newDirectives = */ nullptr);
-    BINJS_TRY(funpc.init());
-    parseContext_->functionScope().useAsVarScope(parseContext_);
-    MOZ_ASSERT(parseContext_->isFunctionBox());
-
-    ParseContext::Scope lexicalScope(cx_, parseContext_, usedNames_);
-    BINJS_TRY(lexicalScope.init(parseContext_));
+
 
     BINJS_MOZ_TRY_DECL(body, parseFunctionBody());
 
 
     ParseNode* params = new_<ListNode>(ParseNodeKind::ParamsBody, param->pn_pos);
     factory_.addList(params, param);
     BINJS_MOZ_TRY_DECL(method, buildFunction(start, kind, name, params, body, funbox));
     BINJS_TRY_DECL(result, factory_.newObjectMethodOrPropertyDefinition(name, method, AccessorType::Setter));
--- a/js/src/frontend/BinSource.webidl_
+++ b/js/src/frontend/BinSource.webidl_
@@ -437,18 +437,18 @@ interface EagerMethod : Node {
 };
 
 [Skippable] interface SkippableMethod : Node {
   attribute EagerMethod skipped;
 };
 
 // `get PropertyName ( ) { FunctionBody }`
 interface EagerGetter : Node {
+  attribute PropertyName name;
   attribute AssertedVarScope? bodyScope;
-  attribute PropertyName name;
   attribute FunctionBody body;
 };
 
 [Skippable] interface SkippableGetter : Node {
   attribute EagerGetter skipped;
 };
 
 // `set PropertyName ( PropertySetParameterList ) { FunctionBody }`
--- a/js/src/frontend/BinSource.yaml
+++ b/js/src/frontend/BinSource.yaml
@@ -556,22 +556,22 @@ EagerFunctionExpression:
                 BINJS_TRY(lexicalScope.init(parseContext_));
     build: |
         BINJS_TRY_DECL(lexicalScopeData, NewLexicalScopeData(cx_, lexicalScope, alloc_, parseContext_));
         BINJS_TRY_VAR(body, factory_.newLexicalScope(*lexicalScopeData, body));
         BINJS_MOZ_TRY_DECL(result, buildFunction(start, kind, name, params, body, funbox));
 
 EagerGetter:
     fields:
-        body:
-            before: |
+        name:
+            after: |
                 BINJS_MOZ_TRY_DECL(funbox, buildFunctionBox(
                     GeneratorKind::NotGenerator,
                     FunctionAsyncKind::SyncFunction,
-                    FunctionSyntaxKind::Getter, name));
+                    FunctionSyntaxKind::Getter, /* name = */ nullptr));
 
                 // Push a new ParseContext. It will be used to parse `scope`, the arguments, the function.
                 BinParseContext funpc(cx_, this, funbox, /* newDirectives = */ nullptr);
                 BINJS_TRY(funpc.init());
                 parseContext_->functionScope().useAsVarScope(parseContext_);
                 MOZ_ASSERT(parseContext_->isFunctionBox());
 
                 ParseContext::Scope lexicalScope(cx_, parseContext_, usedNames_);
@@ -586,22 +586,22 @@ EagerMethod:
         const auto syntax = FunctionSyntaxKind::Method;
     inherits: EagerFunctionExpression
     build: |
         BINJS_MOZ_TRY_DECL(method, buildFunction(start, kind, name, params, body, funbox));
         BINJS_TRY_DECL(result, factory_.newObjectMethodOrPropertyDefinition(name, method, AccessorType::None));
 
 EagerSetter:
     fields:
-        body:
-            before: |
+        name:
+            after: |
                 BINJS_MOZ_TRY_DECL(funbox, buildFunctionBox(
                     GeneratorKind::NotGenerator,
                     FunctionAsyncKind::SyncFunction,
-                    FunctionSyntaxKind::Setter, name));
+                    FunctionSyntaxKind::Setter, /* name = */ nullptr));
 
                 // Push a new ParseContext. It will be used to parse `scope`, the arguments, the function.
                 BinParseContext funpc(cx_, this, funbox, /* newDirectives = */ nullptr);
                 BINJS_TRY(funpc.init());
                 parseContext_->functionScope().useAsVarScope(parseContext_);
                 MOZ_ASSERT(parseContext_->isFunctionBox());
 
                 ParseContext::Scope lexicalScope(cx_, parseContext_, usedNames_);