Skip to content

build: enable V8 Sparkplug+ with short builtin calls - #67300

Open
gurgunday wants to merge 1 commit into
nodejs:mainfrom
gurgunday:build-sparkplug-plus
Open

gurgunday wants to merge 1 commit into
nodejs:mainfrom
gurgunday:build-sparkplug-plus

Conversation

@gurgunday

@gurgunday gurgunday commented Nov 6, 2026 •

Copy link
Copy Markdown
Member

Sparkplug+ patches calls in Sparkplug baseline code to typed builtins based on the feedback it observes. V8 compiles it in only when V8_ENABLE_SPARKPLUG_PLUS is defined, which its gn build does on x64 arm64 and loong64

Sparkplug+ became the default in V8 15.4, which is Chrome 154

For more information on Sparkplug+: https://youtu.be/LpJ79MxplUk?t=2638


V8 only uses Sparkplug+ when short builtin calls are enabled because it patches pc-relative calls. Therefore this PR enables it only when short builtin calls are enabled, which Node does by default on x64

On arm64 and loong64, V8 only allows short builtin calls with pointer compression, which Node doesn't use so I left it out

Also, this PR's combination of short builtin calls and Sparkplug+ without pointer compression is already tested upstream


What benefits from Sparkplug+

  • Code called somewhere between a dozen and a few hundred times
  • Code that stays in Sparkplug for other reasons:
    • while waiting for a background Maglev compile to finish
    • after being deoptimized, before re-optimizing
    • functions Maglev won't compile

Within those functions, Sparkplug+ speeds up the patched operations:

  • arithmetic (+, *, bitwise)
  • comparisons (===, <)
  • unary operations
  • named property loads (obj.x)

Each patch replaces a generic stub with one specialized for the types actually seen

@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

Review requested:

  • @nodejs/gyp
  • @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. tools Issues and PRs related to the tools directory. v8 engine Issues and PRs related to the V8 dependency. labels Nov 6, 2026
@gurgunday
gurgunday marked this pull request as ready for review November 6, 2026 12:32
@gurgunday
gurgunday requested a review from joyeecheung November 6, 2026 16:47
@gurgunday gurgunday added the needs-benchmark-ci PRs that need a benchmark CI run. label Nov 6, 2026
Sparkplug+ patches calls in Sparkplug baseline code to typed builtins
based on the feedback it observes. V8 compiles it in only when
V8_ENABLE_SPARKPLUG_PLUS is defined, which its gn build does on x64,
arm64 and loong64. Node's gyp files never defined it, so
--sparkplug-plus was a read-only flag fixed to false.

V8 only uses Sparkplug+ when short builtin calls are enabled, because
it patches pc-relative calls. Enable it on those architectures when
short builtin calls are enabled, which Node does by default on x64,
and add --v8-disable-sparkplug-plus to opt out.

Assisted-by: Claude Code
Signed-off-by: Gürgün Dayıoğlu <hey@gurgun.day>
@gurgunday
gurgunday force-pushed the build-sparkplug-plus branch from 4524aa1 to 21eaf37 Compare November 10, 2026 23:08
@legendecas legendecas added the request-ci Add this label to start a Jenkins CI on a PR. Only starts once the PR has an approving review. label Nov 14, 2026
@github-actions github-actions Bot removed the request-ci Add this label to start a Jenkins CI on a PR. Only starts once the PR has an approving review. label Nov 14, 2026
@nodejs-github-bot

This comment was marked as outdated.

@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

@gurgunday gurgunday added the notable-change PRs with changes that should be highlighted in changelogs. label Nov 14, 2026
@github-actions

Copy link
Copy Markdown
Contributor

The notable-change PRs with changes that should be highlighted in changelogs. label has been added by @gurgunday.

Please suggest a text for the release notes if you'd like to include a more detailed summary, then proceed to update the PR description with the text or a link to the notable change suggested text comment. Otherwise, the commit will be placed in the Other Notable Changes section.

@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

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-benchmark-ci PRs that need a benchmark CI run. needs-ci PRs that need a full CI run. notable-change PRs with changes that should be highlighted in changelogs. tools Issues and PRs related to the tools directory. v8 engine Issues and PRs related to the V8 dependency.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants