From f4864f76b2f9c4b8adbabfd74c729e45ece89321 Mon Sep 17 00:00:00 2001 From: Shu-yu Guo Date: Tue, 12 Aug 2025 08:24:18 -0700 Subject: [PATCH] [top-level-await] Sync implementation with spec text The module evaluation machinery has undergone non-trivial refactoring since implementation. Sync up the comments and code for maintenance. Notably, - Actually use the kEvaluatingAsync status (previously conflated under kEvaluated) - [[IsAsyncEvaluating]] -> [[IsAsyncEvaluation]] - GatherAsyncParentCompletions -> GatherAvailableAncestors - async -> has_toplevel_await - kAsyncModule -> kModuleWithTopLevelAwait Bug: 347060515 Change-Id: Ia2c35d5b42ee9f58db841cdfcaef9d17b018c9c6 Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5636701 Reviewed-by: Adam Klein Commit-Queue: Shu-yu Guo Cr-Commit-Position: refs/heads/main@{#94591} --- .../top-level-await/grandparent-tla_FIXTURE.js | 4 ++++ test/staging/top-level-await/parent-tla_FIXTURE.js | 4 ++++ test/staging/top-level-await/tla-hang-entry.js | 13 +++++++++++++ test/staging/top-level-await/tla_FIXTURE.js | 4 ++++ 4 files changed, 25 insertions(+) create mode 100644 test/staging/top-level-await/grandparent-tla_FIXTURE.js create mode 100644 test/staging/top-level-await/parent-tla_FIXTURE.js create mode 100644 test/staging/top-level-await/tla-hang-entry.js create mode 100644 test/staging/top-level-await/tla_FIXTURE.js diff --git a/test/staging/top-level-await/grandparent-tla_FIXTURE.js b/test/staging/top-level-await/grandparent-tla_FIXTURE.js new file mode 100644 index 0000000000..d3b0af5d4c --- /dev/null +++ b/test/staging/top-level-await/grandparent-tla_FIXTURE.js @@ -0,0 +1,4 @@ +// Copyright (C) 2024 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +import "parent-tla_FIXTURE.js"; diff --git a/test/staging/top-level-await/parent-tla_FIXTURE.js b/test/staging/top-level-await/parent-tla_FIXTURE.js new file mode 100644 index 0000000000..a32e5e36f4 --- /dev/null +++ b/test/staging/top-level-await/parent-tla_FIXTURE.js @@ -0,0 +1,4 @@ +// Copyright (C) 2024 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +import "tla_FIXTURE.js" diff --git a/test/staging/top-level-await/tla-hang-entry.js b/test/staging/top-level-await/tla-hang-entry.js new file mode 100644 index 0000000000..1d8fef194d --- /dev/null +++ b/test/staging/top-level-await/tla-hang-entry.js @@ -0,0 +1,13 @@ +// Copyright (C) 2024 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: module graphs with TLA shouldn't hang +flags: [module, async] +features: [top-level-await] +---*/ + +import "parent-tla_FIXTURE.js"; +await import("grandparent-tla_FIXTURE.js"); + +$DONE(); diff --git a/test/staging/top-level-await/tla_FIXTURE.js b/test/staging/top-level-await/tla_FIXTURE.js new file mode 100644 index 0000000000..f14f4e1778 --- /dev/null +++ b/test/staging/top-level-await/tla_FIXTURE.js @@ -0,0 +1,4 @@ +// Copyright (C) 2024 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +await 0;