Files
ladybird/Tests/LibJS/Bytecode/expected/const-fold-template-literals.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

107 lines
3.0 KiB
Plaintext

$dc4cd9dd const-fold-template-literals.js:20:1
Registers: 7
Blocks: 1
Constants:
[0] = String("abc")
[1] = String("xyz")
[2] = String("abcxyz")
[3] = String("")
[4] = Undefined
[5] = Int32(1)
[6] = Int32(2)
[7] = Int32(3)
block0:
[ 0] InitializeLexicalBinding `a`, src:String("abcxyz")
[ 18] InitializeLexicalBinding `b`, src:String("abcxyz")
[ 30] InitializeLexicalBinding `c`, src:String("abcxyz")
[ 48] InitializeLexicalBinding `d`, src:String("abcxyz")
[ 60] InitializeLexicalBinding `e`, src:String("abcxyz")
[ 78] InitializeLexicalBinding `f`, src:String("abcxyz")
[ 90] Mov dst:reg5, src:String("abc")
[ a0] ConcatString dst:reg5, src:String("xyz")
[ b0] InitializeLexicalBinding `g`, src:reg5
[ c8] GetGlobal dst:reg6, `prefix`
[ e0] Call dst:reg5, callee:reg6, this_value:Undefined, prefix, arguments:[String("abc")]
[ 108] InitializeLexicalBinding `_prefix`, src:reg5
[ 120] GetGlobal dst:reg6, `suffix`
[ 138] Call dst:reg5, callee:reg6, this_value:Undefined, suffix, arguments:[String("abc")]
[ 160] InitializeLexicalBinding `_suffix`, src:reg5
[ 178] GetGlobal dst:reg6, `tostring`
[ 190] Call dst:reg5, callee:reg6, this_value:Undefined, tostring, arguments:[String("abc")]
[ 1b8] InitializeLexicalBinding `_tostring`, src:reg5
[ 1d0] GetGlobal dst:reg6, `multi`
[ 1e8] Call dst:reg5, callee:reg6, this_value:Undefined, multi, arguments:[Int32(1), Int32(2), Int32(3)]
[ 218] InitializeLexicalBinding `_multi`, src:reg5
[ 230] GetGlobal dst:reg6, `literal`
[ 248] Call dst:reg5, callee:reg6, this_value:Undefined, literal
[ 268] InitializeLexicalBinding `_literal`, src:reg5
[ 280] GetGlobal dst:reg6, `empty`
[ 298] Call dst:reg5, callee:reg6, this_value:Undefined, empty
[ 2b8] InitializeLexicalBinding `_empty`, src:reg5
[ 2d0] End value:Undefined
prefix$f72ec249 const-fold-template-literals.js:2:5
Registers: 6
Blocks: 1
Constants:
[0] = String("prefix-")
block0:
[ 0] Mov dst:reg5, src:String("prefix-")
[ 10] ConcatString dst:reg5, src:arg0
[ 20] Return value:reg5
suffix$5b9fba3e const-fold-template-literals.js:5:5
Registers: 6
Blocks: 1
Constants:
[0] = String("-suffix")
block0:
[ 0] ToString dst:reg5, value:arg0
[ 10] ConcatString dst:reg5, src:String("-suffix")
[ 20] Return value:reg5
tostring$1567fc7c const-fold-template-literals.js:8:5
Registers: 6
Blocks: 1
block0:
[ 0] ToString dst:reg5, value:arg0
[ 10] Return value:reg5
multi$f3ef7824 const-fold-template-literals.js:11:5
Registers: 6
Blocks: 1
block0:
[ 0] ToString dst:reg5, value:arg0
[ 10] ConcatString dst:reg5, src:arg1
[ 20] ConcatString dst:reg5, src:arg2
[ 30] Return value:reg5
literal$c7e85f9e const-fold-template-literals.js:14:5
Registers: 6
Blocks: 1
Constants:
[0] = String("hello world")
block0:
[ 0] Return value:String("hello world")
empty$93602216 const-fold-template-literals.js:17:5
Registers: 5
Blocks: 1
Constants:
[0] = String("")
block0:
[ 0] Return value:String("")