[v24.x] deps: V8: backport d259a9e2ead7#63865
Open
GuillaumeLagrange wants to merge 1 commit into
Open
Conversation
Original commit message:
[maglev] Add source position collection
This change adds support for collecting source positions in Maglev for
profiling. It wires a SourcePositionTableBuilder through the code
generator and uses the existing source positions from the graph
labeller.
Fixed: 436575053
Change-Id: I64fa1e8829b036e498fa1d756c996716d16fb2a8
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/6897146
Reviewed-by: Victor Gomes <victorgomes@chromium.org>
Auto-Submit: Leszek Swirski <leszeks@chromium.org>
Commit-Queue: Leszek Swirski <leszeks@chromium.org>
Cr-Commit-Position: refs/heads/main@{#102119}
Before this change Maglev attached an empty source position table to its
generated Code objects (set_empty_source_position_table()). As a result,
when profiling with `--perf-prof --interpreted-frames-native-stack`
(linux perf / samply), Maglev-optimized frames carried no line/inlining
information in the jitdump, so inlined call chains were lost in the
resulting flamegraphs (baseline and TurboFan code were unaffected). This
backport restores per-pc source positions for Maglev code, matching V8
>= 15.x and newer Node.js.
The change is gated on collect_source_positions() (enabled by
--detailed-line-info / profiling); the steady-state generated machine
code is unchanged and there is no extra cost when not profiling.
Adaptations for V8 13.6 (node): the graph-labeller creation in
MaglevCompiler::Compile is added as a separate condition because node's
13.6 tree creates the labeller in a differently-shaped block than
upstream; the rest is a direct cherry-pick.
Refs: v8/v8@d259a9e
Fixes: nodejs#63816
Collaborator
|
Review requested:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Backports v8/v8@d259a9e to the V8 13.6 tree.
Changes only impact when running with profiling enabled.
Fixes: #63816
Adaptation
One deviation from a straight cherry-pick: upstream adds
collect_source_positions()to a single graph-labeller condition inMaglevCompiler::Compile. The 13.6 tree builds the labeller in a differently shaped block, so the condition is added separately. Noted inline.Profiling with samply
Before this change, Maglev (
+) frames resolve to a function name with no line detail. After, samples inside Maglev code map to their source lines and the inlined functions they came from.Example
loop.js
When running this script, here's the before and after flamegraphs recorded with samply for convenience, but similar results can be achieved with perf + folding scripts.
Before
After