diff options
| author | Gabriel Schneider <[email protected]> | 2026-11-13 09:28:38 -0300 |
|---|---|---|
| committer | Gabriel Schneider <[email protected]> | 2026-11-13 09:28:38 -0300 |
| commit | 5c0230ea5a77f85de77ad4354788cd6c27aa1ef6 (patch) | |
| tree | e01a903bdee092965b86e118dfaab85c3bd60004 /gui/targets/jit.js | |
| parent | 5a40dca5adb6e9e650f55f3ec6f254a13bf50493 (diff) | |
| download | computeranim-5c0230ea5a77f85de77ad4354788cd6c27aa1ef6.tar.gz computeranim-5c0230ea5a77f85de77ad4354788cd6c27aa1ef6.zip | |
debugger: follow natural V8 deoptimization with adaptive live views
Diffstat (limited to 'gui/targets/jit.js')
| -rw-r--r-- | gui/targets/jit.js | 25 |
1 files changed, 11 insertions, 14 deletions
diff --git a/gui/targets/jit.js b/gui/targets/jit.js index 57a1218..b0ea360 100644 --- a/gui/targets/jit.js +++ b/gui/targets/jit.js @@ -1,16 +1,13 @@ -// Print the optimized function's machine code, then let the native debugger -// install a breakpoint before the next invocation. No V8 inspector required. -function jitWork(n) { - let sum = 0; - for (let i = 0; i < n; i++) { - sum = (sum + (i ^ n)) | 0; - } +// Ordinary warmup: V8 chooses its tiers and schedules optimization itself. +function jitWork(object) { + let sum = object.value; + for (let i = 0; i < 1000; i++) sum = (sum + i) | 0; return sum; } -%PrepareFunctionForOptimization(jitWork); -jitWork(10); -jitWork(20); -%OptimizeFunctionOnNextCall(jitWork); -jitWork(30); -%SystemBreak(); -print(jitWork(10000)); +const same = {value: 7}; +let total = 0; +for (let i = 0; i < 200000; i++) total = (total + jitWork(same)) | 0; +print('warm', total, jitWork(same)); +// A second shape invalidates the optimized property access's map guard. +print('mismatch', jitWork({extra: 1, value: 9})); +print('fallback', jitWork(same)); |
