Skip to content

deps: V8: cherry-pick 5f8109fccf06 and 7bd6db9dfd8a - #66190

Open
guybedford wants to merge 1 commit into
nodejs:mainfrom
guybedford:v8-wasm-compile-options
Open

guybedford wants to merge 1 commit into
nodejs:mainfrom
guybedford:v8-wasm-compile-options

Conversation

@guybedford

Copy link
Copy Markdown
Contributor

Backports the WasmModuleObject::CompileOptions API from V8 main (already landed upstream) so that Node.js can compile and deserialize WebAssembly modules with compile-time imports (builtins, importedStringConstants) through the embedder API, and pass those options to WasmModuleCompilation when deserializing cached compiled code.

The two upstream commits are squashed since the second replaces the struct introduced by the first. Adapted to the pre-std::span API (MemorySpan) and the TRACE_EVENT0 macro of V8 14.6, and includes the optional source_url parameter of WasmEngine::SyncCompile from upstream c0f790f1379 that the second commit depends on. Upstream unittests are carried over.

Refs: v8/v8@5f8109f
Refs: v8/v8@7bd6db9

Original commit messages:

    [wasm] Add WasmModuleObject::Compile overload with compile-time imports

    Expose a public API to compile a Wasm module with compile-time imports
    with a flag type for the builtins and a specifier name for imported
    string constants.

    The existing single-argument WasmModuleObject::Compile is refactored to
    delegate to a shared helper, and a new overload accepts a CompileTimeImports
    struct mirroring the `{ builtins, importedStringConstants }` constructor
    options.

    Bug: v8:14179
    Change-Id: I9877e8ea4d620152e98954c948ff9dc5eeb6577c
    Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/7970437
    Reviewed-by: Leszek Swirski <leszeks@chromium.org>
    Commit-Queue: Jakob Kummerow <jkummerow@chromium.org>
    Reviewed-by: Jakob Kummerow <jkummerow@chromium.org>
    Cr-Commit-Position: refs/heads/main@{#108394}

    [wasm] Generalize WasmModuleObject::Compile options with source URL

    Replaces the recently-added WasmModuleObject::CompileTimeImports struct
    with a CompileOptions struct carrying the compile-time import options
    plus a new source_url option, threading through to the existing
    source_url handling of SyncCompile for the script URL. This allows
    embedders compiling modules synchronously from bytes to attach a
    meaningful URL, as already possible for streaming compilation via
    WasmStreaming::SetUrl, for use in stack traces and developer tooling.

    Refactoring now to a single options struct mirrors the JS
    `WebAssembly.Module(bytes, compileOptions)` API, while enabling
    future compatibility.

    Change-Id: I4052f4a97e072467c00082df388e2eb4cb504cf6
    Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/8127096
    Commit-Queue: Dan Carney <dcarney@chromium.org>
    Reviewed-by: Dan Carney <dcarney@chromium.org>
    Reviewed-by: Leszek Swirski <leszeks@chromium.org>
    Reviewed-by: Jakob Kummerow <jkummerow@chromium.org>
    Cr-Commit-Position: refs/heads/main@{#109045}

The two commits are squashed since the second replaces the struct
introduced by the first. Adapted to MemorySpan (pre-std::span API) and
includes the optional source_url parameter of WasmEngine::SyncCompile
from c0f790f1379 that the second commit depends on.

Refs: v8/v8@5f8109f
Refs: v8/v8@7bd6db9
@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

Review requested:

  • @nodejs/gyp
  • @nodejs/security-wg
  • @nodejs/v8-update

@nodejs-github-bot nodejs-github-bot added build Issues and PRs related to Node.js builds or CI infrastructure. needs-ci PRs that need a full CI run. v8 engine Issues and PRs related to the V8 dependency. labels Sep 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

build Issues and PRs related to Node.js builds or CI infrastructure. needs-ci PRs that need a full CI run. v8 engine Issues and PRs related to the V8 dependency.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants