mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-04-26 01:35:08 +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).
44 lines
949 B
Plaintext
44 lines
949 B
Plaintext
$5904f18d const-assignment-no-extra-tdz.js:5:1
|
|
Registers: 9
|
|
Blocks: 4
|
|
Locals: e~0
|
|
Constants:
|
|
[0] = Undefined
|
|
|
|
block0:
|
|
[ 0] GetLexicalEnvironment dst:reg4
|
|
[ 8] Jump target:block3
|
|
|
|
block1:
|
|
[ 10] Catch dst:reg5
|
|
[ 18] SetLexicalEnvironment environment:reg4
|
|
[ 20] Mov3 dst1:e~0, src1:reg5, dst2:reg6, src2:Undefined, dst3:reg7, src3:reg6
|
|
|
|
block2:
|
|
[ 40] End value:reg6
|
|
|
|
block3:
|
|
[ 48] Mov dst:reg5, src:Undefined
|
|
[ 58] GetGlobal dst:reg8, `f`
|
|
[ 70] Call dst:reg6, callee:reg8, this_value:Undefined, f
|
|
[ 90] Mov2 dst1:reg5, src1:reg6, dst2:reg6, src2:reg5
|
|
[ a8] End value:reg6
|
|
|
|
Exception handlers:
|
|
[ 48 .. b0] => handler block1
|
|
|
|
|
|
f$22fe0a32 const-assignment-no-extra-tdz.js:2:5
|
|
Registers: 5
|
|
Blocks: 1
|
|
Locals: x~0
|
|
Constants:
|
|
[0] = Int32(1)
|
|
[1] = Int32(2)
|
|
[2] = Undefined
|
|
|
|
block0:
|
|
[ 0] Mov dst:x~0, src:Int32(1)
|
|
[ 10] ThrowConstAssignment
|
|
[ 18] End value:Undefined
|