[top-level-await] Support top level for-await.
Trivial changes to the parser to allow parsing for-await. Unfortunately, these tests uncovered a stress bug related to using await in for loops(see v8:9825). Bug: v8:9817, v8:9825 Change-Id: Ie699c85389e94b834a22dc1fb2f9970fc37fcdd3 Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1848434 Reviewed-by: Georg Neis <neis@chromium.org> Commit-Queue: Joshua Litt <joshualitt@chromium.org> Cr-Commit-Position: refs/heads/master@{#64193}
This commit is contained in:
parent
db5afff86e
commit
0243ada1a8
@ -944,7 +944,10 @@ class ParserBase {
|
||||
bool is_resumable() const {
|
||||
return IsResumableFunction(function_state_->kind());
|
||||
}
|
||||
|
||||
bool is_await_allowed() const {
|
||||
return is_async_function() || (allow_harmony_top_level_await() &&
|
||||
IsModule(function_state_->kind()));
|
||||
}
|
||||
const PendingCompilationErrorHandler* pending_error_handler() const {
|
||||
return pending_error_handler_;
|
||||
}
|
||||
@ -3083,9 +3086,7 @@ ParserBase<Impl>::ParseUnaryExpression() {
|
||||
|
||||
Token::Value op = peek();
|
||||
if (Token::IsUnaryOrCountOp(op)) return ParseUnaryOrPrefixExpression();
|
||||
if ((is_async_function() || (allow_harmony_top_level_await() &&
|
||||
IsModule(function_state_->kind()))) &&
|
||||
op == Token::AWAIT) {
|
||||
if (is_await_allowed() && op == Token::AWAIT) {
|
||||
return ParseAwaitExpression();
|
||||
}
|
||||
return ParsePostfixExpression();
|
||||
@ -4934,7 +4935,7 @@ typename ParserBase<Impl>::StatementT ParserBase<Impl>::ParseStatement(
|
||||
case Token::WHILE:
|
||||
return ParseWhileStatement(labels, own_labels);
|
||||
case Token::FOR:
|
||||
if (V8_UNLIKELY(is_async_function() && PeekAhead() == Token::AWAIT)) {
|
||||
if (V8_UNLIKELY(is_await_allowed() && PeekAhead() == Token::AWAIT)) {
|
||||
return ParseForAwaitStatement(labels, own_labels);
|
||||
}
|
||||
return ParseForStatement(labels, own_labels);
|
||||
@ -5994,7 +5995,7 @@ typename ParserBase<Impl>::StatementT ParserBase<Impl>::ParseForAwaitStatement(
|
||||
ZonePtrList<const AstRawString>* labels,
|
||||
ZonePtrList<const AstRawString>* own_labels) {
|
||||
// for await '(' ForDeclaration of AssignmentExpression ')'
|
||||
DCHECK(is_async_function());
|
||||
DCHECK(is_await_allowed());
|
||||
typename FunctionState::LoopScope loop_scope(function_state_);
|
||||
|
||||
int stmt_pos = peek_position();
|
||||
|
@ -549,32 +549,6 @@
|
||||
'built-ins/String/prototype/matchAll/flags-undefined-throws': [FAIL],
|
||||
'built-ins/String/prototype/matchAll/flags-nonglobal-throws': [FAIL],
|
||||
|
||||
# https://bugs.chromium.org/p/v8/issues/detail?id=9817
|
||||
'language/module-code/top-level-await/syntax/for-await-await-expr-array-literal': [SKIP],
|
||||
'language/module-code/top-level-await/syntax/for-await-await-expr-func-expression': [SKIP],
|
||||
'language/module-code/top-level-await/syntax/for-await-await-expr-literal-string': [SKIP],
|
||||
'language/module-code/top-level-await/syntax/for-await-await-expr-identifier': [SKIP],
|
||||
'language/module-code/top-level-await/syntax/for-await-await-expr-literal-number': [SKIP],
|
||||
'language/module-code/top-level-await/syntax/for-await-await-expr-null': [SKIP],
|
||||
'language/module-code/top-level-await/syntax/for-await-await-expr-nested': [SKIP],
|
||||
'language/module-code/top-level-await/syntax/for-await-await-expr-obj-literal': [SKIP],
|
||||
'language/module-code/top-level-await/syntax/for-await-await-expr-regexp': [SKIP],
|
||||
'language/module-code/top-level-await/syntax/for-await-await-expr-new-expr': [SKIP],
|
||||
'language/module-code/top-level-await/syntax/for-await-await-expr-this': [SKIP],
|
||||
'language/module-code/top-level-await/syntax/for-await-await-expr-template-literal': [SKIP],
|
||||
'language/module-code/top-level-await/syntax/for-await-expr-array-literal': [SKIP],
|
||||
'language/module-code/top-level-await/syntax/for-await-expr-func-expression': [SKIP],
|
||||
'language/module-code/top-level-await/syntax/for-await-expr-literal-string': [SKIP],
|
||||
'language/module-code/top-level-await/syntax/for-await-expr-identifier': [SKIP],
|
||||
'language/module-code/top-level-await/syntax/for-await-expr-literal-number': [SKIP],
|
||||
'language/module-code/top-level-await/syntax/for-await-expr-null': [SKIP],
|
||||
'language/module-code/top-level-await/syntax/for-await-expr-nested': [SKIP],
|
||||
'language/module-code/top-level-await/syntax/for-await-expr-obj-literal': [SKIP],
|
||||
'language/module-code/top-level-await/syntax/for-await-expr-regexp': [SKIP],
|
||||
'language/module-code/top-level-await/syntax/for-await-expr-new-expr': [SKIP],
|
||||
'language/module-code/top-level-await/syntax/for-await-expr-this': [SKIP],
|
||||
'language/module-code/top-level-await/syntax/for-await-expr-template-literal': [SKIP],
|
||||
|
||||
# https://bugs.chromium.org/p/v8/issues/detail?id=9818
|
||||
'built-ins/AsyncFunction/proto-from-ctor-realm': [FAIL],
|
||||
|
||||
@ -742,4 +716,33 @@
|
||||
'*': [SKIP],
|
||||
}], # variant == jitless and not embedded_builtins
|
||||
|
||||
##############################################################################
|
||||
['variant == stress', {
|
||||
# https://bugs.chromium.org/p/v8/issues/detail?id=9817
|
||||
'language/module-code/top-level-await/syntax/for-await-await-expr-array-literal': [SKIP],
|
||||
'language/module-code/top-level-await/syntax/for-await-await-expr-func-expression': [SKIP],
|
||||
'language/module-code/top-level-await/syntax/for-await-await-expr-literal-string': [SKIP],
|
||||
'language/module-code/top-level-await/syntax/for-await-await-expr-identifier': [SKIP],
|
||||
'language/module-code/top-level-await/syntax/for-await-await-expr-literal-number': [SKIP],
|
||||
'language/module-code/top-level-await/syntax/for-await-await-expr-null': [SKIP],
|
||||
'language/module-code/top-level-await/syntax/for-await-await-expr-nested': [SKIP],
|
||||
'language/module-code/top-level-await/syntax/for-await-await-expr-obj-literal': [SKIP],
|
||||
'language/module-code/top-level-await/syntax/for-await-await-expr-regexp': [SKIP],
|
||||
'language/module-code/top-level-await/syntax/for-await-await-expr-new-expr': [SKIP],
|
||||
'language/module-code/top-level-await/syntax/for-await-await-expr-this': [SKIP],
|
||||
'language/module-code/top-level-await/syntax/for-await-await-expr-template-literal': [SKIP],
|
||||
'language/module-code/top-level-await/syntax/for-await-expr-array-literal': [SKIP],
|
||||
'language/module-code/top-level-await/syntax/for-await-expr-func-expression': [SKIP],
|
||||
'language/module-code/top-level-await/syntax/for-await-expr-literal-string': [SKIP],
|
||||
'language/module-code/top-level-await/syntax/for-await-expr-identifier': [SKIP],
|
||||
'language/module-code/top-level-await/syntax/for-await-expr-literal-number': [SKIP],
|
||||
'language/module-code/top-level-await/syntax/for-await-expr-null': [SKIP],
|
||||
'language/module-code/top-level-await/syntax/for-await-expr-nested': [SKIP],
|
||||
'language/module-code/top-level-await/syntax/for-await-expr-obj-literal': [SKIP],
|
||||
'language/module-code/top-level-await/syntax/for-await-expr-regexp': [SKIP],
|
||||
'language/module-code/top-level-await/syntax/for-await-expr-new-expr': [SKIP],
|
||||
'language/module-code/top-level-await/syntax/for-await-expr-this': [SKIP],
|
||||
'language/module-code/top-level-await/syntax/for-await-expr-template-literal': [SKIP],
|
||||
}], # variant == stress
|
||||
|
||||
]
|
||||
|
Loading…
Reference in New Issue
Block a user