1cb05f1ff4
This implements the behavior discussed and specified here: https://github.com/tc39/ecma262/issues/1461 https://github.com/tc39/ecma262/pull/1470 As part of making this change, I realized that we didn't actually toggle the behavior between the optimized and unoptimized version based on the --harmony-await-optimization flag at all and just the unoptimized version by default. This patch removes the unoptimized version and uses the optimized version as the default. The other builtins that use this flag are not touched as part of this CL, they will be updated separately. Bug: v8:8998 Change-Id: I315e1b39dda91d0127b5e567986485d713eaa78d Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1525872 Commit-Queue: Sathya Gunasekaran <gsathya@chromium.org> Reviewed-by: Maya Lekova <mslekova@chromium.org> Cr-Commit-Position: refs/heads/master@{#60310}
30 lines
693 B
JavaScript
30 lines
693 B
JavaScript
// 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.
|
|
//
|
|
// Flags: --allow-natives-syntax
|
|
|
|
let actual = [];
|
|
|
|
async function f() {
|
|
var p = Promise.resolve(0);
|
|
Object.defineProperty(p, "constructor", {
|
|
get() {
|
|
throw new Error();
|
|
}
|
|
});
|
|
actual.push("start");
|
|
for await (var x of [p]);
|
|
actual.push("never reached");
|
|
}
|
|
|
|
Promise.resolve(0)
|
|
.then(() => actual.push("tick 1"))
|
|
.then(() => actual.push("tick 2"))
|
|
|
|
f().catch(() => actual.push("catch"));
|
|
|
|
%PerformMicrotaskCheckpoint();
|
|
|
|
assertSame(["start", "tick 1", "tick 2", "catch"].join(), actual.join());
|