diff --git a/common.gypi b/common.gypi index 902d69c6272fb7..1e05129315c2de 100644 --- a/common.gypi +++ b/common.gypi @@ -36,7 +36,7 @@ # Reset this number to 0 on major V8 upgrades. # Increment by one for each non-official patch applied to deps/v8. - 'v8_embedder_string': '-node.28', + 'v8_embedder_string': '-node.29', ##### V8 defaults for Node.js ##### diff --git a/deps/v8/src/common/globals.h b/deps/v8/src/common/globals.h index 4309b7023476ca..70b17ab6495a71 100644 --- a/deps/v8/src/common/globals.h +++ b/deps/v8/src/common/globals.h @@ -334,6 +334,9 @@ constexpr int kUC16Size = sizeof(uc16); // NOLINT // 128 bit SIMD value size. constexpr int kSimd128Size = 16; +// Maximum ordinal used for tracking asynchronous module evaluation order. +constexpr unsigned kMaxModuleAsyncEvaluatingOrdinal = (1 << 30) - 1; + // FUNCTION_ADDR(f) gets the address of a C function f. #define FUNCTION_ADDR(f) (reinterpret_cast(f)) diff --git a/deps/v8/src/diagnostics/objects-debug.cc b/deps/v8/src/diagnostics/objects-debug.cc index 6df2aec1ed3dba..698b92c6162fe1 100644 --- a/deps/v8/src/diagnostics/objects-debug.cc +++ b/deps/v8/src/diagnostics/objects-debug.cc @@ -1351,7 +1351,8 @@ void SourceTextModule::SourceTextModuleVerify(Isolate* isolate) { (status() == kPreInstantiating && code().IsSharedFunctionInfo()) || (status() == kUninstantiated && code().IsSharedFunctionInfo())); CHECK(top_level_capability().IsUndefined() && !AsyncParentModuleCount() && - !pending_async_dependencies() && !async_evaluating()); + !pending_async_dependencies()); + CHECK(!IsAsyncEvaluating()); } CHECK_EQ(requested_modules().length(), info().module_requests().length()); diff --git a/deps/v8/src/diagnostics/objects-printer.cc b/deps/v8/src/diagnostics/objects-printer.cc index 74aee11d4ce53b..e23c4674f84251 100644 --- a/deps/v8/src/diagnostics/objects-printer.cc +++ b/deps/v8/src/diagnostics/objects-printer.cc @@ -1622,6 +1622,7 @@ void SourceTextModule::SourceTextModulePrint(std::ostream& os) { // NOLINT os << "\n - script: " << Brief(script()); os << "\n - import_meta: " << Brief(import_meta()); os << "\n - cycle_root: " << Brief(cycle_root()); + os << "\n - async_evaluating_ordinal: " << async_evaluating_ordinal(); os << "\n"; } diff --git a/deps/v8/src/execution/isolate-inl.h b/deps/v8/src/execution/isolate-inl.h index 163ab4ea8cbfca..e39852f2a842bf 100644 --- a/deps/v8/src/execution/isolate-inl.h +++ b/deps/v8/src/execution/isolate-inl.h @@ -12,6 +12,7 @@ #include "src/objects/property-cell.h" #include "src/objects/regexp-match-info.h" #include "src/objects/shared-function-info.h" +#include "src/objects/source-text-module.h" namespace v8 { namespace internal { @@ -117,6 +118,36 @@ Isolate::ExceptionScope::~ExceptionScope() { isolate_->set_pending_exception(*pending_exception_); } +void Isolate::DidFinishModuleAsyncEvaluation(unsigned ordinal) { + // To address overflow, the ordinal is reset when the async module with the + // largest vended ordinal finishes evaluating. Modules are evaluated in + // ascending order of their async_evaluating_ordinal. + // + // While the specification imposes a global total ordering, the intention is + // that for each async module, all its parents are totally ordered by when + // they first had their [[AsyncEvaluating]] bit set. + // + // The module with largest vended ordinal finishes evaluating implies that the + // async dependency as well as all other modules in that module's graph + // depending on async dependencies are finished evaluating. + // + // If the async dependency participates in other module graphs (e.g. via + // dynamic import, or other