mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-05-01 12:07:14 +02:00
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).
51 lines
1.1 KiB
Plaintext
51 lines
1.1 KiB
Plaintext
$b4733eed invalid-lhs-assignment-no-dead-code.js:8:1
|
|
Registers: 10
|
|
Blocks: 4
|
|
Constants:
|
|
[0] = Undefined
|
|
|
|
block0:
|
|
[ 0] GetLexicalEnvironment dst:reg4
|
|
[ 8] Jump target:block3
|
|
|
|
block1:
|
|
[ 10] Catch dst:reg5
|
|
[ 18] SetLexicalEnvironment environment:reg4
|
|
[ 20] Mov2 dst1:reg6, src1:Undefined, dst2:reg7, src2:reg6
|
|
|
|
block2:
|
|
[ 38] End value:reg6
|
|
|
|
block3:
|
|
[ 40] Mov dst:reg5, src:Undefined
|
|
[ 50] GetGlobal dst:reg8, `f`
|
|
[ 68] NewFunction dst:reg9, shared_function_data_index:0
|
|
[ 80] Call dst:reg6, callee:reg8, this_value:Undefined, f, arguments:[reg9]
|
|
[ a8] Mov2 dst1:reg5, src1:reg6, dst2:reg6, src2:reg5
|
|
[ c0] End value:reg6
|
|
|
|
Exception handlers:
|
|
[ 40 .. c8] => handler block1
|
|
|
|
|
|
f$36570247 invalid-lhs-assignment-no-dead-code.js:5:6
|
|
Registers: 6
|
|
Blocks: 1
|
|
Constants:
|
|
[0] = Undefined
|
|
|
|
block0:
|
|
[ 0] Call dst:reg5, callee:arg0, this_value:Undefined, x
|
|
[ 20] NewReferenceError dst:reg5, Invalid left-hand side in assignment
|
|
[ 30] Throw src:reg5
|
|
|
|
|
|
$811c9dc5
|
|
Registers: 5
|
|
Blocks: 1
|
|
Constants:
|
|
[0] = Undefined
|
|
|
|
block0:
|
|
[ 0] End value:Undefined
|