fix(runtime): apply source maps to CPU profiler output#32634
Merged
bartlomieju merged 3 commits intodenoland:mainfrom Mar 15, 2026
Merged
fix(runtime): apply source maps to CPU profiler output#32634bartlomieju merged 3 commits intodenoland:mainfrom
bartlomieju merged 3 commits intodenoland:mainfrom
Conversation
The `--cpu-prof` flag was reporting transpiled JavaScript line numbers instead of original TypeScript source positions. This applies source maps to the profile's call frames before writing, reusing the existing SourceMapper infrastructure from deno_core. Closes denoland#32626 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Main refactored runtime/cpu_profiler.rs into runtime/cpu_profiler/ module directory. Applied the source map changes from this PR to the new mod.rs. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
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.
Summary
--cpu-profreports original TypeScript line/column numbers instead of transpiled JavaScript positionsSourceMapperinfrastructure fromdeno_core(same one used for error stack traces)SourceMapperandSourceMapApplicationfromdeno_coreand adds aJsRuntime::source_mapper()accessorCloses #32626
Test plan
tests/specs/cpu_prof/source_map/that profiles a TypeScript file and verifies the output has.tsURLs with valid source-mapped line numbersconst enum(which gets erased during transpilation) — line numbers correctly point to original.tssource positions🤖 Generated with Claude Code