Commit f796f861 authored by Joshua Litt's avatar Joshua Litt Committed by Commit Bot

[async] Fix bug with await in for 'next' position.

While removing dead code, v8 currently removes jump targets, but leaves
suspend points, resulting in bytecode analysis issues. This cl simply
removes the suspend point if the remainder of the block is dead.

Bug: v8:9825
Change-Id: Ib147ca01cf64c695c0316017852d61f52fd10cf4
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1849197
Commit-Queue: Joshua Litt <joshualitt@chromium.org>
Reviewed-by: 's avatarLeszek Swirski <leszeks@chromium.org>
Cr-Commit-Position: refs/heads/master@{#64223}
parent c30740de
......@@ -4010,6 +4010,12 @@ void BytecodeGenerator::VisitCompoundAssignment(CompoundAssignment* expr) {
// in the accumulator. When the generator is resumed, the sent value is loaded
// in the accumulator.
void BytecodeGenerator::BuildSuspendPoint(int position) {
// Because we eliminate jump targets in dead code, we also eliminate resumes
// when the suspend is not emitted because otherwise the below call to Bind
// would start a new basic block and the code would be considered alive.
if (builder()->RemainderOfBlockIsDead()) {
return;
}
const int suspend_id = suspend_count_++;
RegisterList registers = register_allocator()->AllLiveRegisters();
......
// Copyright 2019 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
async function foo() {
for (;;await[]) {
break;
}
}
foo();
......@@ -722,33 +722,4 @@
'*': [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
]
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment