Files
ladybird/Tests/LibJS/Bytecode/expected/nested-for-loop-completion.txt
Andreas Kling eb9432fcb8 LibJS: Preserve source positions in bytecode source maps
Carry full source positions through the Rust bytecode source map so
stack traces and other bytecode-backed source lookups can use them
directly.

This keeps exception-heavy paths from reconstructing line and column
information through SourceCode::range_from_offsets(), which can spend a
lot of time building SourceCode's position cache on first use.

We're trading some space for time here, but I believe it's worth it at
this tag, as this saves ~250ms of main thread time while loading
https://x.com/ on my Linux machine. :^)

Reading the stored Position out of the source map directly also exposed
two things masked by the old range_from_offsets() path: a latent
off-by-one in Lexer::new_at_offset() (its consume() bumped line_column
past the character at offset; only synthesize_binding_pattern() hit it),
and a (1,1) fallback in range_from_offsets() that fired whenever the
queried range reached EOF. Fix the lexer, then rebaseline both the
bytecode dump tests (no more spurious "1:1") and the destructuring AST
tests (binding-pattern identifiers now report their real columns).
2026-04-22 22:34:54 +02:00

46 lines
1.0 KiB
Plaintext

$9814d5bc nested-for-loop-completion.js:4:1
Registers: 9
Blocks: 8
Constants:
[0] = Int32(4)
[1] = Undefined
[2] = Int32(7)
[3] = Int32(1)
[4] = Int32(0)
[5] = Int32(2)
block0:
[ 0] SetGlobal `n`, src:Int32(4)
[ 18] Mov dst:reg5, src:Undefined
[ 28] Jump target:block3
block1:
[ 30] SetGlobal `depth`, src:Int32(0)
[ 48] Mov dst:reg6, src:Undefined
[ 58] Jump target:block6
block2:
[ 60] GetGlobal dst:reg7, `n`
[ 78] Add dst:reg6, lhs:reg7, rhs:Int32(1)
[ 88] SetGlobal `n`, src:reg6
block3:
[ a0] GetGlobal dst:reg6, `n`
[ b8] JumpLessThanEquals lhs:reg6, rhs:Int32(7), true_target:block1, false_target:block4
block4:
[ d0] End value:reg5
block5:
[ d8] GetGlobal dst:reg8, `depth`
[ f0] Add dst:reg7, lhs:reg8, rhs:Int32(2)
[ 100] SetGlobal `depth`, src:reg7
block6:
[ 118] GetGlobal dst:reg7, `depth`
[ 130] JumpLessThanEquals lhs:reg7, rhs:Int32(0), true_target:block5, false_target:block7
block7:
[ 148] Mov dst:reg5, src:reg6
[ 158] Jump target:block2