Executed problem
The private CPU profiler installs Context.profile_statement_hook. On current main (f9ed7030), that changes execution rather than observing it:
Context.interpreter()publishes nojit_ownerwheneverprofile_statement_hook != null;vm.statementHooksRequireBytecode()rejects native entry and optimizer OSR for the same hook;- the existing
vm: optimizer executes multiple iterations after a hot backedgetest explicitly proves that adding a profile hook leavesoptimizer_native_attemptsunchanged and refuses both OSR and entry execution.
The profiler therefore cannot satisfy #501's inspector/native agreement requirement: collected inspector samples necessarily describe bytecode/tree execution even when the same workload normally runs in baseline or optimizer code.
Scope
- Keep debugger and host-statement hooks on the current exact bytecode path.
- Allow the observation-only CPU profile hook to retain baseline and optimizer eligibility.
- Sample managed baseline execution at its existing exact checkpoint island using the published bytecode offset and statement registry.
- Preserve exact source URL, script, line, column, activation chain, sampling interval, and profile output schemas.
- Let optimizer checkpoint/side-exit paths resume through the ordinary exact bytecode statement boundary; do not create profiler-only optimizer codegen.
- Preserve disabled-profile hot paths and native step/budget/GC/termination semantics.
Acceptance
- A focused native-tier witness records profile samples while baseline/optimizer execution counters remain nonzero on supported hosts.
- Native checkpoint samples carry the exact source statement selected by the checkpoint bytecode offset.
- Debugger and host hooks still refuse native execution.
- Existing Home/Bun CPU-profile fixtures, native forced-on/off differentials, and unsuppressed TSan coverage pass.
- Documentation states that profiling observes the active tier and identifies the checkpoint sampling boundary without overstating timer precision.
Guardrails
No profiler-only codegen, periodic signal thread, guessed PC/source mapping, forced deoptimization on every statement, disabled JIT during profiling, or output-schema change.