mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-05-12 01:46:46 +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).
15 lines
381 B
Plaintext
15 lines
381 B
Plaintext
$87cdcfb6 numeric-property-key.js:4:1
|
|
Registers: 6
|
|
Blocks: 1
|
|
Constants:
|
|
[0] = Int32(20)
|
|
[1] = Int32(3)
|
|
[2] = Undefined
|
|
|
|
block0:
|
|
[ 0] NewObject dst:reg5
|
|
[ 10] ToPrimitiveWithStringHint dst:Int32(20), value:Int32(20)
|
|
[ 20] PutByValue base:reg5, property:Int32(20), src:Int32(3), kind:Own
|
|
[ 38] SetGlobal `obj`, src:reg5
|
|
[ 50] End value:Undefined
|