mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-05-11 01:22:43 +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).
155 lines
4.9 KiB
Plaintext
155 lines
4.9 KiB
Plaintext
$01a3b494 indexed-append-guards.js:16:1
|
|
Registers: 11
|
|
Blocks: 7
|
|
Constants:
|
|
[0] = String("use strict")
|
|
[1] = Int32(0)
|
|
[2] = Int32(1)
|
|
[3] = Undefined
|
|
[4] = String("Indexed object append mutated")
|
|
[5] = String("length")
|
|
[6] = Bool(false)
|
|
[7] = Int32(2)
|
|
[8] = String("Array length changed")
|
|
[9] = String("Array append mutated")
|
|
|
|
block0:
|
|
[ 0] GetGlobal dst:reg6, `Object`
|
|
[ 18] GetById dst:reg7, base:reg6, `preventExtensions` (Object.preventExtensions)
|
|
[ 38] NewObject dst:reg8
|
|
[ 48] ToPrimitiveWithStringHint dst:Int32(0), value:Int32(0)
|
|
[ 58] PutByValue base:reg8, property:Int32(0), src:Int32(1), kind:Own
|
|
[ 70] Call dst:reg5, callee:reg7, this_value:reg6, Object.preventExtensions, arguments:[reg8]
|
|
[ 98] InitializeLexicalBinding `object`, src:reg5
|
|
[ b0] GetGlobal dst:reg7, `expect_type_error`
|
|
[ c8] NewFunction dst:reg6, shared_function_data_index:0
|
|
[ e0] Call dst:reg5, callee:reg7, this_value:Undefined, expect_type_error, arguments:[reg6]
|
|
[ 108] GetGlobal dst:reg7, `object`
|
|
[ 120] GetByValue dst:reg6, base:reg7, property:Int32(1) (object[Int32(1)])
|
|
[ 138] StrictlyInequals dst:reg7, lhs:reg6, rhs:Undefined
|
|
[ 148] Mov dst:reg6, src:Undefined
|
|
[ 158] JumpFalse condition:reg7, target:block2
|
|
|
|
block1:
|
|
[ 168] GetGlobal dst:reg9, `Error`
|
|
[ 180] CallConstruct dst:reg8, callee:reg9, Error, arguments:[String("Indexed object append mutated")]
|
|
[ 1a0] Throw src:reg8
|
|
|
|
block2:
|
|
[ 1a8] NewPrimitiveArray dst:reg5, elements:[1, 2]
|
|
[ 1c8] InitializeLexicalBinding `array`, src:reg5
|
|
[ 1e0] GetGlobal dst:reg7, `Object`
|
|
[ 1f8] GetById dst:reg8, base:reg7, `defineProperty` (Object.defineProperty)
|
|
[ 218] GetGlobal dst:reg9, `array`
|
|
[ 230] NewObject dst:reg10
|
|
[ 240] InitObjectLiteralProperty object:reg10, `writable`, src:Bool(false), shape_cache_index:0, property_slot:0
|
|
[ 258] CacheObjectShape object:reg10
|
|
[ 268] Call dst:reg5, callee:reg8, this_value:reg7, Object.defineProperty, arguments:[reg9, String("length"), reg10]
|
|
[ 298] GetGlobal dst:reg8, `expect_type_error`
|
|
[ 2b0] NewFunction dst:reg7, shared_function_data_index:1
|
|
[ 2c8] Call dst:reg6, callee:reg8, this_value:Undefined, expect_type_error, arguments:[reg7]
|
|
[ 2f0] GetGlobal dst:reg5, `array`
|
|
[ 308] GetLength dst:reg8, base:reg5 (array.length)
|
|
[ 320] StrictlyInequals dst:reg5, lhs:reg8, rhs:Int32(2)
|
|
[ 330] Mov dst:reg8, src:Undefined
|
|
[ 340] JumpFalse condition:reg5, target:block4
|
|
|
|
block3:
|
|
[ 350] GetGlobal dst:reg10, `Error`
|
|
[ 368] CallConstruct dst:reg7, callee:reg10, Error, arguments:[String("Array length changed")]
|
|
[ 388] Throw src:reg7
|
|
|
|
block4:
|
|
[ 390] GetGlobal dst:reg6, `array`
|
|
[ 3a8] GetByValue dst:reg5, base:reg6, property:Int32(2) (array[Int32(2)])
|
|
[ 3c0] StrictlyInequals dst:reg6, lhs:reg5, rhs:Undefined
|
|
[ 3d0] Mov dst:reg5, src:Undefined
|
|
[ 3e0] JumpFalse condition:reg6, target:block6
|
|
|
|
block5:
|
|
[ 3f0] GetGlobal dst:reg10, `Error`
|
|
[ 408] CallConstruct dst:reg7, callee:reg10, Error, arguments:[String("Array append mutated")]
|
|
[ 428] Throw src:reg7
|
|
|
|
block6:
|
|
[ 430] End value:reg5
|
|
|
|
|
|
expect_type_error$f42c6af9 indexed-append-guards.js:4:5
|
|
Registers: 9
|
|
Blocks: 8
|
|
Locals: error~0, did_throw~1
|
|
Constants:
|
|
[0] = Bool(false)
|
|
[1] = Bool(true)
|
|
[2] = Undefined
|
|
[3] = String("Expected TypeError")
|
|
|
|
block0:
|
|
[ 0] GetLexicalEnvironment dst:reg4
|
|
[ 8] Mov dst:did_throw~1, src:Bool(false)
|
|
[ 18] Jump target:block5
|
|
|
|
block1:
|
|
[ 20] Catch dst:reg5
|
|
[ 28] SetLexicalEnvironment environment:reg4
|
|
[ 30] Mov dst:error~0, src:reg5
|
|
[ 40] GetGlobal dst:reg7, `TypeError`
|
|
[ 58] InstanceOf dst:reg8, lhs:error~0, rhs:reg7
|
|
[ 68] Not dst:reg6, src:reg8
|
|
[ 78] JumpFalse condition:reg6, target:block3
|
|
|
|
block2:
|
|
[ 88] Throw src:error~0
|
|
|
|
block3:
|
|
[ 90] Mov dst:did_throw~1, src:Bool(true)
|
|
|
|
block4:
|
|
[ a0] Not dst:reg5, src:did_throw~1
|
|
[ b0] JumpIf condition:reg5, true_target:block6, false_target:block7
|
|
|
|
block5:
|
|
[ c0] Call dst:reg5, callee:arg0, this_value:Undefined, callback
|
|
[ e0] Jump target:block4
|
|
|
|
block6:
|
|
[ e8] GetGlobal dst:reg8, `Error`
|
|
[ 100] CallConstruct dst:reg6, callee:reg8, Error, arguments:[String("Expected TypeError")]
|
|
[ 120] Throw src:reg6
|
|
|
|
block7:
|
|
[ 128] End value:Undefined
|
|
|
|
Exception handlers:
|
|
[ c0 .. e8] => handler block1
|
|
|
|
|
|
$58e01468 indexed-append-guards.js:18:5
|
|
Registers: 6
|
|
Blocks: 1
|
|
Constants:
|
|
[0] = Int32(1)
|
|
[1] = Int32(2)
|
|
[2] = Undefined
|
|
|
|
block0:
|
|
[ 0] GetGlobal dst:reg5, `object`
|
|
[ 18] PutByValue base:reg5, property:Int32(1), src:Int32(2), kind:Normal (object[Int32(1)])
|
|
[ 30] End value:Undefined
|
|
|
|
|
|
$19fab4ff indexed-append-guards.js:26:5
|
|
Registers: 8
|
|
Blocks: 1
|
|
Constants:
|
|
[0] = Int32(3)
|
|
[1] = Undefined
|
|
|
|
block0:
|
|
[ 0] GetGlobal dst:reg5, `array`
|
|
[ 18] GetGlobal dst:reg6, `array`
|
|
[ 30] GetLength dst:reg7, base:reg6 (array.length)
|
|
[ 48] PutByValue base:reg5, property:reg7, src:Int32(3), kind:Normal (array[reg7])
|
|
[ 60] End value:Undefined
|