Bug 1499998 - Part 2: Disable generator and async support for BinAST. r=Yoric
authorTooru Fujisawa <arai_a@mac.com>
Mon, 22 Oct 2018 10:31:29 +0900
changeset 500788 716178d41d26ed49d2f7f86ab12bc0f5c088af7c
parent 500787 c8e1907a781fee3a5311fce566eabe63aa4fe769
child 500789 43d78c2bd006d7cf7d90508519c8aa88be18ab0c
child 501548 081221c69c85d73b0ba0bde99b7128d62d2011fa
push id1864
push userffxbld-merge
push dateMon, 03 Dec 2018 15:51:40 +0000
treeherdermozilla-release@f040763d99ad [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersYoric
bugs1499998
milestone64.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 1499998 - Part 2: Disable generator and async support for BinAST. r=Yoric
js/src/frontend/BinSource-auto.cpp
js/src/frontend/BinSource.yaml
--- a/js/src/frontend/BinSource-auto.cpp
+++ b/js/src/frontend/BinSource-auto.cpp
@@ -3230,19 +3230,23 @@ BinASTParser<Tok>::parseInterfaceEagerFu
 
 #if defined(DEBUG)
     const BinField expected_fields[6] = { BinField::IsAsync, BinField::IsGenerator, BinField::Name, BinField::Length, BinField::Directives, BinField::Contents };
     MOZ_TRY(tokenizer_->checkFields(kind, fields, expected_fields));
 #endif // defined(DEBUG)
     const auto syntax = FunctionSyntaxKind::Statement;
 
     BINJS_MOZ_TRY_DECL(isAsync, tokenizer_->readBool());
-
+    if (isAsync) {
+        return raiseError("Async function is not supported in this preview release");
+    }
     BINJS_MOZ_TRY_DECL(isGenerator, tokenizer_->readBool());
-
+    if (isGenerator) {
+        return raiseError("Generator is not supported in this preview release");
+    }
     BINJS_MOZ_TRY_DECL(name, parseBindingIdentifier());
 
     BINJS_MOZ_TRY_DECL(length, tokenizer_->readUnsignedLong());
 
     BINJS_MOZ_TRY_DECL(directives, parseListOfDirective());
 
     BINJS_MOZ_TRY_DECL(funbox, buildFunctionBox(
         isGenerator ? GeneratorKind::Generator
@@ -3282,19 +3286,23 @@ BinASTParser<Tok>::parseInterfaceEagerFu
 
 #if defined(DEBUG)
     const BinField expected_fields[6] = { BinField::IsAsync, BinField::IsGenerator, BinField::Name, BinField::Length, BinField::Directives, BinField::Contents };
     MOZ_TRY(tokenizer_->checkFields(kind, fields, expected_fields));
 #endif // defined(DEBUG)
     const auto syntax = FunctionSyntaxKind::Expression;
 
     BINJS_MOZ_TRY_DECL(isAsync, tokenizer_->readBool());
-
+    if (isAsync) {
+        return raiseError("Async function is not supported in this preview release");
+    }
     BINJS_MOZ_TRY_DECL(isGenerator, tokenizer_->readBool());
-
+    if (isGenerator) {
+        return raiseError("Generator is not supported in this preview release");
+    }
     BINJS_MOZ_TRY_DECL(name, parseOptionalBindingIdentifier());
 
     BINJS_MOZ_TRY_DECL(length, tokenizer_->readUnsignedLong());
 
     BINJS_MOZ_TRY_DECL(directives, parseListOfDirective());
 
     BINJS_MOZ_TRY_DECL(funbox, buildFunctionBox(
         isGenerator ? GeneratorKind::Generator
@@ -3384,19 +3392,23 @@ BinASTParser<Tok>::parseInterfaceEagerMe
 #if defined(DEBUG)
     const BinField expected_fields[6] = { BinField::IsAsync, BinField::IsGenerator, BinField::Name, BinField::Length, BinField::Directives, BinField::Contents };
     MOZ_TRY(tokenizer_->checkFields(kind, fields, expected_fields));
 #endif // defined(DEBUG)
     const auto syntax = FunctionSyntaxKind::Method;
     const auto accessorType = AccessorType::None;
 
     BINJS_MOZ_TRY_DECL(isAsync, tokenizer_->readBool());
-
+    if (isAsync) {
+        return raiseError("Async function is not supported in this preview release");
+    }
     BINJS_MOZ_TRY_DECL(isGenerator, tokenizer_->readBool());
-
+    if (isGenerator) {
+        return raiseError("Generator is not supported in this preview release");
+    }
     BINJS_MOZ_TRY_DECL(name, parsePropertyName());
 
     BINJS_MOZ_TRY_DECL(length, tokenizer_->readUnsignedLong());
 
     BINJS_MOZ_TRY_DECL(directives, parseListOfDirective());
 
     BINJS_MOZ_TRY_DECL(funbox, buildFunctionBox(
         isGenerator ? GeneratorKind::Generator
@@ -4103,19 +4115,23 @@ BinASTParser<Tok>::parseInterfaceLazyFun
 
 #if defined(DEBUG)
     const BinField expected_fields[7] = { BinField::IsAsync, BinField::IsGenerator, BinField::Name, BinField::Length, BinField::Directives, BinField::ContentsSkip, BinField::Contents };
     MOZ_TRY(tokenizer_->checkFields(kind, fields, expected_fields));
 #endif // defined(DEBUG)
     const auto syntax = FunctionSyntaxKind::Statement;
 
     BINJS_MOZ_TRY_DECL(isAsync, tokenizer_->readBool());
-
+    if (isAsync) {
+        return raiseError("Async function is not supported in this preview release");
+    }
     BINJS_MOZ_TRY_DECL(isGenerator, tokenizer_->readBool());
-
+    if (isGenerator) {
+        return raiseError("Generator is not supported in this preview release");
+    }
     BINJS_MOZ_TRY_DECL(name, parseBindingIdentifier());
 
     BINJS_MOZ_TRY_DECL(length, tokenizer_->readUnsignedLong());
 
     BINJS_MOZ_TRY_DECL(directives, parseListOfDirective());
 
     BINJS_MOZ_TRY_DECL(contentsSkip, tokenizer_->readSkippableSubTree());
     // Don't parse the contents until we delazify.
@@ -4157,19 +4173,23 @@ BinASTParser<Tok>::parseInterfaceLazyFun
 
 #if defined(DEBUG)
     const BinField expected_fields[7] = { BinField::IsAsync, BinField::IsGenerator, BinField::Name, BinField::Length, BinField::Directives, BinField::ContentsSkip, BinField::Contents };
     MOZ_TRY(tokenizer_->checkFields(kind, fields, expected_fields));
 #endif // defined(DEBUG)
     const auto syntax = FunctionSyntaxKind::Expression;
 
     BINJS_MOZ_TRY_DECL(isAsync, tokenizer_->readBool());
-
+    if (isAsync) {
+        return raiseError("Async function is not supported in this preview release");
+    }
     BINJS_MOZ_TRY_DECL(isGenerator, tokenizer_->readBool());
-
+    if (isGenerator) {
+        return raiseError("Generator is not supported in this preview release");
+    }
     BINJS_MOZ_TRY_DECL(name, parseOptionalBindingIdentifier());
 
     BINJS_MOZ_TRY_DECL(length, tokenizer_->readUnsignedLong());
 
     BINJS_MOZ_TRY_DECL(directives, parseListOfDirective());
 
     BINJS_MOZ_TRY_DECL(contentsSkip, tokenizer_->readSkippableSubTree());
     // Don't parse the contents until we delazify.
--- a/js/src/frontend/BinSource.yaml
+++ b/js/src/frontend/BinSource.yaml
@@ -706,16 +706,26 @@ SetterContents:
               BINJS_TRY_DECL(params, new_<ListNode>(ParseNodeKind::ParamsBody, param->pn_pos));
               factory_.addList(params, param);
               MOZ_TRY(checkPositionalParameterIndices(positionalParams, params));
 
 EagerFunctionExpression:
     init: |
         const auto syntax = FunctionSyntaxKind::Expression;
     fields:
+        isGenerator:
+            after: |
+                if (isGenerator) {
+                    return raiseError("Generator is not supported in this preview release");
+                }
+        isAsync:
+            after: |
+                if (isAsync) {
+                    return raiseError("Async function is not supported in this preview release");
+                }
         contents:
             before: |
                 BINJS_MOZ_TRY_DECL(funbox, buildFunctionBox(
                     isGenerator ? GeneratorKind::Generator
                                 : GeneratorKind::NotGenerator,
                     isAsync ? FunctionAsyncKind::AsyncFunction
                             : FunctionAsyncKind::SyncFunction,
                     syntax,
@@ -742,16 +752,26 @@ EagerFunctionExpression:
         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));
 
 LazyFunctionExpression:
     init: |
         const auto syntax = FunctionSyntaxKind::Expression;
     fields:
+        isGenerator:
+            after: |
+                if (isGenerator) {
+                    return raiseError("Generator is not supported in this preview release");
+                }
+        isAsync:
+            after: |
+                if (isAsync) {
+                    return raiseError("Async function is not supported in this preview release");
+                }
         contents:
             block:
                 replace:
                     // Don't parse the contents until we delazify.
     build: |
         BINJS_MOZ_TRY_DECL(funbox, buildFunctionBox(
             isGenerator ? GeneratorKind::Generator
                         : GeneratorKind::NotGenerator,