# Natural V8 deoptimization and stepping measurements Measured 2026-11-13 on Linux 7.2.11-arch1-1, Intel i7-11700, Zig 0.17.0, ReleaseFast debugger; targets are `cc -g -O0` C and unoptimized debug V8. Source is loaded for both. Capture settings are 512 stack bytes, 24 instructions, telescope depth 2, mapping refresh and recording flush at every stop. Continue runs normally between breakpoints; no continuous instruction tracing occurs. ```sh python3 gui/bench/steps.py --d8 /tmp/computeranim-v8-debug-remote/d8 \ --source /tmp/computeranim-v8-source --out /tmp/ztrace-natural-bench-final ``` | 1,000 steady instruction steps | C | Debug V8 / TurboFan JS | | --- | ---: | ---: | | Capture + flush, median | 48.16 µs | 133.16 µs | | Capture + flush, p95 | 75.98 µs | 153.33 µs | | Entire command, median | 55.00 µs | 140.00 µs | | Controller round trip, median | 68.88 µs | 154.44 µs | | Controller round trip, p95 | 105.64 µs | 208.51 µs | | Controller round trip, maximum | 567.93 µs | 539.92 µs | `capture_ns` covers reporting state plus recording flush. `elapsed_ns` covers the whole command, including execution/wait and capture. Round trip additionally includes pipes and the Python driver. Neither includes GUI presentation. Launch through first generated stop and JIT source import took 1,288.73 ms. No CPU isolation or filesystem-cache dropping was used. These are workload measurements, not a release-V8 performance comparison. Per-stop mapping refresh and natural tiering differ from the earlier forced-optimization demonstration; its old figures are not directly comparable. ## Verified transition The ordinary fixture naturally compiled through Maglev and TurboFan. After warming `jitWork` on `{value:7}`, `{extra:1,value:9}` hit its TurboFan wrong-map guard. The generated exit's return PC matched the `rdx` origin argument at `Deoptimizer::New`; unrelated outer-loop bailouts were ignored. Native source resolved at both Deoptimizer::New (`deoptimizer.cc:290`) and Runtime_NotifyDeoptimized (`runtime-compiler.cc`). The guard mapped to JS line 3, `let sum = object.value`. Its shared exit stub mapped to a different JS line, so origin context deliberately uses the guard. | Transition stop | Capture + flush | Entire command | | --- | ---: | ---: | | generated wrong-map exit | 372.09 µs | 1192.34 µs | | Deoptimizer::New | 202.01 µs | 214.16 µs | | Runtime_NotifyDeoptimized | 265.13 µs | 1086.31 µs | | InterpreterEnterAtBytecode | 445.40 µs | 752.09 µs | | Ignition property bytecode handler | 15163.99 µs | 15474.67 µs | The immediate fallback was **Ignition**, confirmed by stopping at `Builtins_InterpreterEnterAtBytecode` and stepping into `Builtins_GetNamedPropertyHandler`. This is actual interpreter dispatch, not an inference from the deoptimizer's frame-reconstruction log. The first handler capture incurred additional symbol/function work, which is why transition costs are reported separately from warmed stepping. The script completed with `mismatch 499509` and `fallback 499507`. Default tiers remain enabled; this does not imply that other V8 builds always resume Ignition. Raw logs, recordings and JSON are in `/tmp/ztrace-natural-bench-final`; the checked-in scripts are the durable reproducer. Addresses/PIDs in those files are session-specific and `/tmp` artifacts are not permanent. ## Source and build provenance - Remote: `chaincli-box`, `/home/goblin/v8-research/v8`. - Revision: `84703f702dca525edd469f3a98d784faa46a02f8`. - d8: `15.2.0 (candidate)`, existing `out/x64.debug-vuln`. - `is_debug=true`, `v8_optimized_debug=false`, `symbol_level=2`, `v8_symbol_level=2`, `use_debug_fission=true`, `target_cpu="x64"`. - Disassembler, object printing, heap verification, slow DCHECKs and backtraces enabled; `use_remoteexec=false`, `use_siso=false`. - Existing remote `BUILD.gn` edits and untracked files were preserved. No engine patch, rebuild, checkout reset or workstation V8 compilation was needed. The component runtime (d8, shared libraries, snapshots and ICU data) is at `/tmp/computeranim-v8-debug-remote`. Matching `src/` and all 2,328 `.dwo` files were copied from the same checkout to `/tmp/computeranim-v8-source` (about 1.9 GiB combined). To retrieve again after verifying the same revision: ```sh rsync -a -e 'ssh -F ~/.ssh/config -o BatchMode=yes' \ chaincli-box:/home/goblin/v8-research/v8/src/ /tmp/computeranim-v8-source/src/ rsync -a --include='*/' --include='*.dwo' --exclude='*' \ -e 'ssh -F ~/.ssh/config -o BatchMode=yes' \ chaincli-box:/home/goblin/v8-research/v8/out/x64.debug-vuln/obj/ \ /tmp/computeranim-v8-source/out/x64.debug-vuln/obj/ ``` This build's skeleton line tables use comp_dir `.` and stripped `../../src` paths. `source-map ../../src /tmp/computeranim-v8-source/src` resolves them through the shared debugger source-prefix interface. Native line resolution was verified; full split-DWARF C++ local-variable inspection was not implemented. ## Verification `gui/test/inspection.py --d8 /tmp/computeranim-v8-debug-remote/d8` passes bounded read-only inspection, unchanged RIP, invalid-count rejection, source-prefix replacement, natural optimization, matching JIT ELF import, native deoptimization stops and actual fallback dispatch. GUI tests cover live stepping/pause/history, source stepping, semantic address navigation, minimap dragging, changed-state animation and lenses. Adaptive tests use 2240×1260, 1440×900 and 800×700 at 60%, 100% and 200%: full 4 GiB mapping navigation with single-row precision, per-pane segment history, pinned refresh at repeated same-PC stops, graph/dim controls and font reset. Independent visual review additionally checks PC/source alignment, pointer hit targets, compact minimaps, lens cycles/collapse and native interaction. The shared renderer/gallery suite passes. The root suite has 87/89 passing tests; the same two pre-existing loader/syscall-format and watch/string assertions fail (25/27 debugger tests). No assertions were weakened. The canvas still lacks a native accessibility tree, and raw hardware Mouse4/5 injection was not tested. ## Final interactive stop The native GUI remains open with d8 PID 2639255 in Linux tracing-stop state at `Deoptimizer::New+4`, RIP `0x7fa19dbe3f74`, on native source line 290. Its `rdx = 0x7fa1e0000ffa` matches the normal `jitWork` TurboFan wrong-map exit's return PC exactly. The retained JS context is the guard at `0x7fa1e0000c14`, `jit.js:3`, not the shared exit stub's line 5. GUI PID 2639214; recording `/tmp/ztrace-gui-2639214-392301809642450.ztrace`, moment 8. This session used ordinary default tiering and symbolic native breakpoints. The complete fallback transition was verified separately by the benchmark above, so the interactive target can remain at the requested deoptimization entry. The independent native review passed after exercising graph/source toggling, all four opacity settings, and Follow. It restored source/live/follow at 100% without executing the target. Screenshot: `/tmp/ztrace-ui-review/native-final-reviewed.jpg`. Native font-shortcut injection was unavailable through the automation tool's punctuation grammar; the actual headless key handler passed the nine size/zoom combinations. ## Native zoom and restart follow-up The original headless size tests missed a native resize feedback loop: `canvas()` also changes the window dimensions. Dividing the window size by font zoom and passing it back to `canvas()` repeatedly enlarged the window when zoomed out. The GUI now keeps the canvas at the actual window size and scales drawing, clipping and pointer coordinates independently. No renderer-library changes were needed. `test/restart.py --native` verifies the actual SDL window/backing stays 800×700 through 60–200% zoom and repeated zoom key presses, including scaled button hits and tiny-overlay lens close controls. Headless checks run in the GUI suite; native checks are explicit because they require a display. Restart is available through the toolbar arrow, Shift-r, and `restart`. Tests cover exited, running and stopped targets; each launch creates a fresh recording, retains the same executable/arguments, and leaves no previous target running. Breakpoints and JIT symbols reset because process addresses may change. The reboot cleared the historical `/tmp` artifacts listed above. The same V8 revision's runtime, source and all split DWARF artifacts have been restored into `.ws/v8-debug/`, an ignored persistent workspace cache. Historical timing results remain as reported; the fresh UI regression does not remeasure V8 stepping cost. ## Executable lenses, memory formats and popup rendering Executable mappings now open shared disassembly rows in lenses. Wheel browsing keeps the original focus bright and surrounding rows dim; Shift-wheel scrolls the chain. Live lenses fetch bounded windows; historical lenses never request current bytes. Right-click sends stack mappings to stack and other addresses to memory. Memory controls render little-endian 1/2/4/8-byte values in hexadecimal, unsigned, signed and floating-point forms. Matching addresses use shared, staggered background highlights instead of cross-pane arrows. Native review caught two issues before completion: the backdrop initially ran only in headless capture, and full-precision 64-bit floats exceeded their column width. The shared host now uses a native GPU canvas plus one reused lens snapshot; float columns reserve enough room for extreme positive and negative values. The final popup keeps an opaque reading surface and limits refraction to a 16-pixel edge band, following the user's readability feedback. Verification: GUI suite (including `test/lenses.py`), shared-renderer suite, independent native lens/format review, native restart tests and repeated 60–200% zoom with open lenses. Window/backing sizes stayed fixed. The native review used DBL_MAX/DBL_MIN and signed/unsigned 64-bit extrema, not only small sample values. The renderer dependency is Sketchbook `409c1ac`; unrelated pending work in that checkout was preserved. V8 stepping/capture timings were not remeasured for these rendering-only changes. Final live session after the opaque-popup change: GUI PID17379, d8 PID17420, recording `/tmp/ztrace-gui-17379-8471380224093.ztrace`. Generated wrong-map exit `0x7f4c80c01fb6` was captured before continuing to `Deoptimizer::New+4` at `0x7f4ce1be3f74` (`deoptimizer.cc:290`). Its `rdx` was exactly `0x7f4c80c01fba`, the printed wrong-map return for the naturally optimized `jitWork`. Origin context and the executable lens use guard `0x7f4c80c01bd4`. The target remains stopped; lens inspection only captures bytes and instructions. Hexdump pointer follow-up: shared byte/grouped-integer rows now expose the full pointer span to both mouse buttons, including 8-bit display and zero padding. Native/headless checks cover 8/16/32/64-bit groups, recursive byte-view lenses, and a stack pointer stored in data. GUI and shared-renderer suites pass. The updated native session (GUI20122, d8 20207) remains at `Deoptimizer::New+4` `0x7f24dbbe3f74`, with wrong-map origin `0x7f247ac00ffa` and JS guard `0x7f247ac00c14`; recording `/tmp/ztrace-gui-20122-9224949592653.ztrace`. A native 8-bit hexdump click opened the saved-stack-pointer lens successfully. Stack offsets now expose their storage addresses to the shared hover/click path. Hex bytes no longer have persistent group backgrounds. Disassembly brackets link simple 64-bit effective addresses, including LEA, only from registers at the selected moment's PC; RIP-relative and absolute addresses also work on other rows. The shared renderer suppresses links when the complete bracket is not displayed. Native and headless checks cover hover, both buttons, indexed operands, future register operands staying inactive, and historical inspection. The GUI suite passes with `-j1`; the shared-renderer suite exits successfully, including gallery comparisons (its usual headless Vulkan warnings remain). Independent code and screenshot review found no blocking issues. V8 timings were not remeasured. Reloaded live session: GUI25666, d8 25705, recording `/tmp/ztrace-gui-25666-14341833166407.ztrace`. The target is stopped at `Deoptimizer::New+4`, `0x7f99e5be3f74`, on `deoptimizer.cc:290`. `rdx = 0x7f9984c00ffa` exactly matches the naturally optimized `jitWork` wrong-map exit return; originating JS context uses guard `0x7f9984c00c14` at `jit.js:3`. ## 2026-11-13: hints, frame timing and Tracy Register-value hints on the right of disassembly now share address hover and left/right-click behavior, using the displayed register width. Tests also caught and corrected the `di`/`bp`/`sp` and low-byte register aliases. Scalar hints remain inactive. Scroll reveals now finish exactly 200 ms after the latest target change, with a cubic ease-out and continuous retargeting; large address jumps still snap. Tracy is optional in Sketchbook and the GUI (`-Dtracy=CHECKOUT`), following Pardes's minimal Zig binding. Disabled builds omit the client. Host zones cover input, commands, frame construction, painting and presentation; GUI zones split panes, minimaps, recording refresh and overlays. `gui/bench/frames.py` captures a native session and exports the input script, trace, CSV and percentile summary. The main hitch was Vulkan allocation cleanup. Temporary SDL probes separated swapchain acquisition, submission, presentation and cleanup: freeing dedicated transfer-buffer allocations cost 25–48 ms in affected frames. The existing Sketchbook SDL patch already disables relocation. The same patch now allows small transfer buffers to share aligned allocations; mapped pointers retain their resource offsets. The patch fails if either expected source fragment changes. The probe sources were restored; no experimental renderer or shape cache ships. ASCII text also reuses white coverage masks across ink/opacity changes, while Unicode keeps painted glyphs, including emoji. Measured on this workstation (i7-11700, RTX 3050, native Vulkan, ReleaseFast, VSync, Tracy 0.13.4), excluding the first two seconds of cold loading: | Native scenario | Median frame interval | p95 | p99 | Maximum | | --- | ---: | ---: | ---: | ---: | | Original interaction script, before | 16.67 ms | 21.53 ms | 107.56 ms | 130.36 ms | | Same script, final renderer | 16.67 ms | 18.15 ms | 20.56 ms | 38.56 ms | | Reproducible harness, 2240×1260 / 100% | 16.67 ms | 18.47 ms | 21.79 ms | 37.11 ms | | Reproducible harness, 1440×900 / 100% | 16.65 ms | 18.24 ms | 19.53 ms | 22.83 ms | | Reproducible harness, 800×700 / 200% | 16.66 ms | 18.23 ms | 20.03 ms | 33.39 ms | The harness verifies 20 actual instruction steps while scrolling and opening lenses. Presentation in the final matching-script run stayed below 15.13 ms. These are CPU wall timings, including VSync/driver waits, not GPU timestamps. The result is approximately 60 Hz through ordinary interaction, not a guarantee that every frame meets 16.67 ms: cold font/source loading and occasional scheduling or stop-refresh frames still exceed it. Captures and the discarded probes remain under `/tmp/ztrace-perf/`; rerun the checked-in harness for durable new captures. Final checks passed: the GUI suite, shared canim renderer suite, Sketchbook suite, native hint/lens interactions, restart, fixed-backing 60–200% zoom and font-cache pixel tests. Independent code and native screenshot review found no remaining issues. The committed Sketchbook files also build in isolation from the checkout's unrelated pending GPU refactor. Normal GUI builds contain no Tracy client symbols. Sketchbook changes are committed as `d307463`. A fresh 1,000-step source-enabled benchmark (`steps.py`) measured capture median / p95 of 45.98 / 62.28 µs for C and 150.78 / 245.49 µs inside optimized `jitWork`. Controller round trips measured 62.43 / 94.60 µs and 180.00 / 288.76 µs respectively. This run naturally compiled through Maglev and TurboFan, then verified `wrong map` at the generated exit, `Deoptimizer::New`, `Runtime_NotifyDeoptimized`, and `Builtins_InterpreterEnterAtBytecode`, followed by the Ignition named-property bytecode handler. Its observed fallback was Ignition; default tiers were unchanged. Transition capture costs are separate: generated exit 351.74 µs, deoptimizer entry 224.82 µs, notification 245.63 µs, interpreter entry 404.48 µs, and first property handler 14.16 ms (including that handler's first capture/source work). Launch, natural warmup, initial symbols and first generated stop together took 1.295 s. Results and recordings are in `/tmp/ztrace-perf/steps/`. Final restored live session: GUI PID45357, d8 PID46062, recording `/tmp/ztrace-gui-45357-18763846210612.ztrace`. Generated wrong-map exit `0x7f4062dc0ff6` was captured before stopping at `Deoptimizer::New+4`, `0x7f4004be3f74`, on `deoptimizer.cc:290`. Its `rdx = 0x7f4062dc0ffa` exactly matches the printed wrong-map return for naturally optimized `jitWork`. Originating JS context uses guard `0x7f4062dc0c14` at `jit.js:3`. The native window remains at that live stop with C++ and JS context visible.