Skip to content

deps: V8: cherry-pick b3a92f0effa5 - #67750

Draft
szegedi wants to merge 1 commit into
nodejs:mainfrom
szegedi:v8-cherry-pick-b3a92f0effa5
Draft

szegedi wants to merge 1 commit into
nodejs:mainfrom
szegedi:v8-cherry-pick-b3a92f0effa5

Conversation

@szegedi

@szegedi szegedi commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor

Cherry-picks v8/v8@b3a92f0 ("[profiler] Move SampleContextExtractor to a CpuProfiler setter") from V8 upstream.

V8 15.8, which main currently uses, already contains the earlier commit (v8/v8@155cd72) that added SampleContextExtractor as a per-profile option in CpuProfilingOptions. However, the extractor is actually bound to the events processor shared by all profiles of a CpuProfiler, so the per-profile API did not behave as documented. The upstream follow-up, which first ships in V8 15.9, removes the extractor from CpuProfilingOptions and adds CpuProfiler::SetSampleContextExtractor instead.

Floating this patch means Node.js never ships the per-profile shape of this API, including in v27 alphas that pick up V8 15.8. It becomes redundant once main updates to V8 15.9 or later. This would unblock progress on #63163, which is the original source of the V8 code for both commits, that I got upstreamed.

Notes:

  • The patch applies cleanly, and the deps/v8 diff is identical to the upstream commit.
  • v8_embedder_string is bumped to -node.5.
  • This reverts the CpuProfilingOptions constructor to its pre-15.8 signature, which changes V8's public API/ABI. Nothing in Node.js core uses SampleContextExtractor.

Original commit message:

    [profiler] Move SampleContextExtractor to a CpuProfiler setter

    The SampleContextExtractor was passed per profile in
    CpuProfilingOptions, but it is bound to the events processor that all
    profiles of a CpuProfiler share, taken from the profile that starts the
    processor. A profile started while another was active therefore
    silently had its extractor ignored, a profile started without an
    extractor still received the other profile's sample contexts, and the
    extractor kept being invoked after the profile that installed it had
    stopped. None of this matched the documented per-profile contract of
    CpuProfile::GetSampleContext.

    Make the API reflect the actual binding instead: remove the extractor
    from CpuProfilingOptions and install it with
    CpuProfiler::SetSampleContextExtractor instead which, like
    SetSamplingInterval and SetUsePreciseSampling, must be called while no
    profiles are being recorded. Every profile recorded by the CpuProfiler
    receives its sample contexts, and embedders wanting different extractors
    can use a separate CpuProfiler for each.

    This changes the CpuProfilingOptions constructor back to its signature
    before the extractor was added.

    Bug: 572878256
    Change-Id: I73b0e7c3c2744c7fbaf72b95074a4ae0e8d0f855
    Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/8579337
    Reviewed-by: Camillo Bruni <cbruni@chromium.org>
    Commit-Queue: Olivier Flückiger <olivf@chromium.org>
    Reviewed-by: Leszek Swirski <leszeks@chromium.org>
    Cr-Commit-Position: refs/heads/main@{#111365}

Refs: v8/v8@b3a92f0
Assisted-by: Claude
Signed-off-by: Attila Szegedi <attila.szegedi@datadoghq.com>
@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

Review requested:

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

@github-actions

Copy link
Copy Markdown
Contributor

Hi! This pull request changes deps/v8 on the main branch without updating the V8 version, so you are likely submitting a backport of individual V8 patches.

In general we recommend waiting for a V8 patch to be included in the next V8 major version update instead of fast-tracking it, since individual backports add audit cost and can delay the major update.

A patch may be backported to main when at least one of these criteria applies:

  • It fixes a build issue on a platform or toolchain supported on main.
  • It fixes a security issue.
  • It unblocks a pending V8 update, for example by adjusting how the Node.js code uses a V8 API so that it works with the future update.

If the patch has demonstrated real-world urgency and impact that justifies landing it before the next V8 major version update, it's recommended to backport it to the release staging branches like v<MAJOR>.x-staging (see Criteria for backporting to decide what release line to target) instead of main.

Please explain in the pull request description which of these criteria applies. Otherwise, consider closing this pull request and waiting for the next V8 update instead of fast-tracking a backport. See Backporting patches to main for details.

@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 Nov 24, 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