Skip to content

wasm: enable JSPI - #59941

Closed
guybedford wants to merge 1 commit into
nodejs:mainfrom
guybedford:jspi
Closed

wasm: enable JSPI#59941
guybedford wants to merge 1 commit into
nodejs:mainfrom
guybedford:jspi

Conversation

@guybedford

Copy link
Copy Markdown
Contributor

This enables the WebAssembly JS Promise Integration Stage 4 WebAssembly proposal which is currently shipped in Chrome.

A new Wasm test is also included to verify that it works correctly.

@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

Review requested:

  • @nodejs/startup
@nodejs-github-bot nodejs-github-bot added c++ Issues and PRs that require attention from people who are familiar with C++. needs-ci PRs that need a full CI run. labels Sep 20, 2025

@jasnell jasnell left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lgtm but the test could use a comment that explains the expectations a bit as most folks aren't familiar with jspi yet and won't have much context.

@richardlau richardlau added semver-minor PRs that contain new features and should be released in the next minor version. dont-land-on-v20.x dont-land-on-v22.x PRs that should not land on the v22.x-staging branch and should not be released in v22.x. dont-land-on-v24.x PRs that should not land on the v24.x-staging branch and should not be released in v24.x. labels Sep 20, 2025
@codecov

codecov Bot commented Sep 20, 2025

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 88.44%. Comparing base (4612c79) to head (e2d1d28).
⚠️ Report is 18 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #59941      +/-   ##
==========================================
+ Coverage   88.25%   88.44%   +0.19%     
==========================================
  Files         703      703              
  Lines      207412   207402      -10     
  Branches    39893    39991      +98     
==========================================
+ Hits       183052   183445     +393     
+ Misses      16313    15930     -383     
+ Partials     8047     8027      -20     
Files with missing lines Coverage Δ
src/node.cc 75.80% <100.00%> (+0.03%) ⬆️

... and 41 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.
@guybedford

Copy link
Copy Markdown
Contributor Author

Sure, I've added some more documentation to the test.

guybedford added a commit that referenced this pull request Sep 23, 2025
PR-URL: #59941
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
@guybedford

Copy link
Copy Markdown
Contributor Author

Landed in 4396cf2.

@guybedford guybedford closed this Sep 23, 2025
@guybedford
guybedford deleted the jspi branch September 23, 2025 01:13
guybedford added a commit to guybedford/node that referenced this pull request Aug 7, 2026
PR-URL: nodejs#59941
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
aduh95 pushed a commit to guybedford/node that referenced this pull request Aug 13, 2026
PR-URL: nodejs#59941
Backport-PR-URL: nodejs#65123
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
nodejs-github-bot added a commit that referenced this pull request Aug 21, 2026
Notable changes:

async_hooks:
  * (SEMVER-MINOR) add using scopes to AsyncLocalStorage (Stephen Belanger) #61674
benchmark:
  * (SEMVER-MINOR) add benchmarks for experimental stream/iter (James M Snell) #62066
buffer:
  * (SEMVER-MINOR) add end parameter (Robert Nagy) #62390
crypto:
  * update root certificates to NSS 3.125 (Node.js GitHub Bot) #64746
doc:
  * add MikeMcC399 as collaborator (Mike McCready) #64656
lib,permission:
  * (SEMVER-MINOR) add permission.drop (Rafael Gonzaga) #62672
loader:
  * (SEMVER-MINOR) implement package maps (Maël Nison) #62239
src,permission:
  * (SEMVER-MINOR) add --permission-audit (RafaelGSS) #61869
stream:
  * (SEMVER-MINOR) add stream/iter Implementation (James M Snell) #62066
test:
  * (SEMVER-MINOR) add tests for experimental stream/iter implementation (James M Snell) #62066
test_runner:
  * (SEMVER-MINOR) add context.log() and test:log event (Moshe Atlow) #64389
  * (SEMVER-MINOR) report `entryFile` in `TestStream` events (Moshe Atlow) #64309
wasm:
  * (SEMVER-MINOR) enable JSPI (Guy Bedford) #59941

PR-URL: #65461
aduh95 pushed a commit that referenced this pull request Aug 22, 2026
Notable changes:

async_hooks:
  * (SEMVER-MINOR) add `using` scopes to `AsyncLocalStorage` (Stephen Belanger) #61674
benchmark:
buffer:
  * (SEMVER-MINOR) add `end` parameter (Robert Nagy) #62390
crypto:
  * update root certificates to NSS 3.125 (Node.js GitHub Bot) #64746
doc:
  * add MikeMcC399 as collaborator (Mike McCready) #64656
lib,permission:
  * (SEMVER-MINOR) add `permission.drop` (Rafael Gonzaga) #62672
loader:
  * (SEMVER-MINOR) implement package maps (Maël Nison) #62239
src,permission:
  * (SEMVER-MINOR) add `--permission-audit` (RafaelGSS) #61869
stream:
  * (SEMVER-MINOR) implement `node:stream/iter` (James M Snell) #62066
test_runner:
  * (SEMVER-MINOR) add `context.log()` and `test:log` event (Moshe Atlow) #64389
  * (SEMVER-MINOR) report `entryFile` in `TestStream` events (Moshe Atlow) #64309
wasm:
  * (SEMVER-MINOR) enable JSPI (Guy Bedford) #59941

PR-URL: #65461
aduh95 pushed a commit that referenced this pull request Aug 26, 2026
Notable changes:

async_hooks:
  * (SEMVER-MINOR) add `using` scopes to `AsyncLocalStorage` (Stephen Belanger) #61674
benchmark:
buffer:
  * (SEMVER-MINOR) add `end` parameter (Robert Nagy) #62390
crypto:
  * update root certificates to NSS 3.125 (Node.js GitHub Bot) #64746
doc:
  * add MikeMcC399 as collaborator (Mike McCready) #64656
lib,permission:
  * (SEMVER-MINOR) add `permission.drop` (Rafael Gonzaga) #62672
loader:
  * (SEMVER-MINOR) implement package maps (Maël Nison) #62239
src,permission:
  * (SEMVER-MINOR) add `--permission-audit` (RafaelGSS) #61869
stream:
  * (SEMVER-MINOR) implement `node:stream/iter` (James M Snell) #62066
test_runner:
  * (SEMVER-MINOR) add `context.log()` and `test:log` event (Moshe Atlow) #64389
  * (SEMVER-MINOR) report `entryFile` in `TestStream` events (Moshe Atlow) #64309
wasm:
  * (SEMVER-MINOR) enable JSPI (Guy Bedford) #59941

PR-URL: #65461
jkleinsc added a commit to electron/electron that referenced this pull request Aug 28, 2026
jkleinsc added a commit to electron/electron that referenced this pull request Aug 28, 2026
MarshallOfSound added a commit to electron/electron that referenced this pull request Aug 29, 2026
Node.js v24.20.0 passes --experimental-wasm-jspi unconditionally, but
Chromium's V8 shipped JSPI and removed the flag, so node_mksnapshot
aborts with 'bad option'. Add the same patch as the main-branch roll.

Ref: nodejs/node#59941
Ref: https://chromium-review.googlesource.com/c/v8/v8/+/6937664
MarshallOfSound added a commit to electron/electron that referenced this pull request Aug 29, 2026
Node.js v24.20.0 passes --experimental-wasm-jspi unconditionally, but
Chromium's V8 shipped JSPI and removed the flag, so node_mksnapshot
aborts with 'bad option'. Add the same patch as the main-branch roll.

Ref: nodejs/node#59941
Ref: https://chromium-review.googlesource.com/c/v8/v8/+/6937664
MarshallOfSound added a commit to electron/electron that referenced this pull request Aug 29, 2026
Node.js v24.20.0 backported JSPI enablement, which unconditionally
passes --experimental-wasm-jspi to V8. Chromium's V8 removed that
flag (JSPI is always on), so node_mksnapshot aborts with
"bad option". Drop the argument in a new patch, matching main.

Ref: nodejs/node#59941
Ref: https://chromium-review.googlesource.com/c/v8/v8/+/6937664
MarshallOfSound pushed a commit to electron/electron that referenced this pull request Aug 29, 2026
* chore: bump node in DEPS to v24.20.0

* chore: remove upstreamed patches

Co-Authored-By: GitHub Copilot <copilot@github.com>

* chore: update patches (trivial only)

Co-Authored-By: GitHub Copilot <copilot@github.com>

* fix(patch): split OpenSSL 3, BoringSSL, and legacy backends

Ref: nodejs/node#64211

Co-Authored-By: GitHub Copilot <copilot@github.com>

* fix(patch): update sqlite to 3.53.4

Ref: nodejs/node#64745

Co-Authored-By: GitHub Copilot <copilot@github.com>

* fix(patch): do not pass removed JSPI V8 flag

Ref: nodejs/node#59941
Ref: https://chromium-review.googlesource.com/c/v8/v8/+/6937664

Co-Authored-By: GitHub Copilot <copilot@github.com>

* chore: update filenames.auto.gni

---------

Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com>
Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>
Co-authored-by: GitHub Copilot <copilot@github.com>
MarshallOfSound added a commit to electron/electron that referenced this pull request Aug 29, 2026
Node.js v24.20.0 passes --experimental-wasm-jspi unconditionally, but
Chromium's V8 shipped JSPI and removed the flag, so node_mksnapshot
aborts with 'bad option'. Add the same patch as the main-branch roll.

Ref: nodejs/node#59941
Ref: https://chromium-review.googlesource.com/c/v8/v8/+/6937664
ckerr pushed a commit to electron/electron that referenced this pull request Sep 1, 2026
Node.js v24.20.0 passes --experimental-wasm-jspi unconditionally, but
Chromium's V8 shipped JSPI and removed the flag, so node_mksnapshot
aborts with 'bad option'. Add the same patch as the main-branch roll.

Ref: nodejs/node#59941
Ref: https://chromium-review.googlesource.com/c/v8/v8/+/6937664
ckerr pushed a commit to electron/electron that referenced this pull request Sep 1, 2026
Node.js v24.20.0 backported JSPI enablement, which unconditionally
passes --experimental-wasm-jspi to V8. Chromium's V8 removed that
flag (JSPI is always on), so node_mksnapshot aborts with
"bad option". Drop the argument in a new patch, matching main.

Ref: nodejs/node#59941
Ref: https://chromium-review.googlesource.com/c/v8/v8/+/6937664
ckerr pushed a commit to electron/electron that referenced this pull request Sep 1, 2026
Node.js v24.20.0 passes --experimental-wasm-jspi unconditionally, but
Chromium's V8 shipped JSPI and removed the flag, so node_mksnapshot
aborts with 'bad option'. Add the same patch as the main-branch roll.

Ref: nodejs/node#59941
Ref: https://chromium-review.googlesource.com/c/v8/v8/+/6937664
MarshallOfSound added a commit to electron/electron that referenced this pull request Sep 1, 2026
* chore: bump node in DEPS to v24.20.0

* fix(patch): implement package maps in the ESM resolver

Upstream added join to the path imports in resolve.js, which
overlaps the import line this patch rewrites to pull in
toNamespacedPath.

Ref: nodejs/node#62239

* chore: remove upstreamed patches

Both landed in v24.20.0.

Ref: nodejs/node#61999
Ref: nodejs/node#64271

* chore: update patches (trivial only)

* fix(patch): preserve RSA-PSS legacy pubkey DER

Upstream added ReadASN1Element to ncrypto.cc but only calls it from
the OpenSSL 3 provider branch, so under BoringSSL it is an unused
function and -Werror fails the build. Guard the definition with the
same NCRYPTO_USE_OPENSSL3_PROVIDER condition as its callers.

Ref: nodejs/node#64547

* fix(patch): update sqlite to 3.53.4

The sqlite update introduced an unsigned/signed comparison in
rbuDeltaApply that trips -Wsign-compare under -Werror. Extend the
existing sign-compare patch to cast lenDelta, which is never negative
at that point, to unsigned int.

Ref: nodejs/node#64745

* fix: do not pass removed JSPI V8 flag

Node.js v24.20.0 passes --experimental-wasm-jspi unconditionally, but
Chromium's V8 shipped JSPI and removed the flag, so node_mksnapshot
aborts with 'bad option'. Add the same patch as the main-branch roll.

Ref: nodejs/node#59941
Ref: https://chromium-review.googlesource.com/c/v8/v8/+/6937664

* chore: update filenames.auto.gni

---------

Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com>
Co-authored-by: Sam Attard <sattard@anthropic.com>
MarshallOfSound added a commit to electron/electron that referenced this pull request Sep 1, 2026
* chore: bump node in DEPS to v24.20.0

* chore: remove upstreamed patches

Both patches are backports that landed in Node.js v24.20.0.

Ref: nodejs/node#61999
Ref: nodejs/node#64271

* fix(patch): implement package maps in the ESM resolver

Upstream rewrote packageResolve() to branch on hasPackageMap() and
added join to the path imports, which shifted the context around the
electron: specifier shortcut and the legacyMainResolve imports.

Ref: nodejs/node#62239

* chore: update patches (trivial only)

* fix(patch): split OpenSSL 3, BoringSSL, and legacy backends

Upstream added an ASN.1 helper, ReadASN1Element, whose only callers
live under NCRYPTO_USE_OPENSSL3_PROVIDER. With BoringSSL that macro
is 0, so the helper is unused and fails -Werror=unused-function.
Guard the definition with the same macro as its callers.

Ref: nodejs/node#64211

* chore: update filenames.auto.gni

Node.js v24.20.0 replaced src/quic/logstream.h with
src/quic/session_manager.h.

* fix(patch): update sqlite to 3.53.4

The new sqlite amalgamation compares 'unsigned int cnt' against
'int lenDelta' in rbuDeltaApply, which fails -Werror=sign-compare.
Extend the existing sqlite sign-compare patch to cast that operand
too.

Ref: nodejs/node#64745

* fix(patch): do not pass removed JSPI V8 flag

Node.js v24.20.0 backported JSPI enablement, which unconditionally
passes --experimental-wasm-jspi to V8. Chromium's V8 removed that
flag (JSPI is always on), so node_mksnapshot aborts with
"bad option". Drop the argument in a new patch, matching main.

Ref: nodejs/node#59941
Ref: https://chromium-review.googlesource.com/c/v8/v8/+/6937664

---------

Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com>
Co-authored-by: Sam Attard <sattard@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

c++ Issues and PRs that require attention from people who are familiar with C++. dont-land-on-v22.x PRs that should not land on the v22.x-staging branch and should not be released in v22.x. dont-land-on-v24.x PRs that should not land on the v24.x-staging branch and should not be released in v24.x. needs-ci PRs that need a full CI run. semver-minor PRs that contain new features and should be released in the next minor version.

6 participants