ladybird/Tests/LibJS/Bytecode/expected/block-scoping.txt
Andreas Kling cd7ff16106 LibJS: Emit eager environment coordinates in bytecode
Track bytecode-created declarative bindings while generating code so
most environment-coordinate operands can be emitted eagerly. Dynamic
lookup instructions remain for scopes where eval or object environments
can change resolution at runtime.

This lets the static coordinate bytecode variants run without cached-
vs-uncached branches or eval poison checks, and rebaselines bytecode
output for the newly eager coordinate operands.
2026-05-18 20:35:14 +02:00

128 lines
3.9 KiB
Text

$f9fa6696 block-scoping.js:13:1
Registers: 11
Blocks: 1
Constants:
[0] = Undefined
block0:
[ 0] GetGlobal dst:reg6, `console`
[ 10] GetById dst:reg7, base:reg6, `log` (console.log)
[ 28] GetGlobal dst:reg9, `closureOverBlockScope`
[ 38] Call dst:reg8, callee:reg9, this_value:Undefined, closureOverBlockScope
[ 58] Call dst:reg5, callee:reg7, this_value:reg6, console.log, arguments:[reg8]
[ 80] GetGlobal dst:reg6, `console`
[ 90] GetById dst:reg8, base:reg6, `log` (console.log)
[ a8] GetGlobal dst:reg10, `breakThroughBlockScopes`
[ b8] Call dst:reg9, callee:reg10, this_value:Undefined, breakThroughBlockScopes
[ d8] Call dst:reg7, callee:reg8, this_value:reg6, console.log, arguments:[reg9]
[ 100] End value:reg7
closureOverBlockScope$61104af2 block-scoping.js:2:15
Registers: 10
Blocks: 1
Locals: fns~0
Constants:
[0] = Int32(1)
[1] = Int32(2)
[2] = Int32(0)
block0:
[ 0] GetLexicalEnvironment dst:reg4
[ 8] NewArray dst:fns~0
[ 18] CreateLexicalEnvironment dst:reg5, parent:reg4, capacity:0, is_catch_environment:false
[ 30] CreateMutableBinding environment:reg5, `x`, can_be_deleted:false
[ 40] InitializeLexicalBinding `x`, src:Int32(1)
[ 58] GetById dst:reg7, base:fns~0, `push` (fns.push)
[ 70] Mov dst:reg8, src:fns~0
[ 80] NewFunction dst:reg9, shared_function_data_index:0
[ 98] Call dst:reg6, callee:reg7, this_value:reg8, fns.push, arguments:[reg9]
[ c0] SetLexicalEnvironment environment:reg4
[ c8] CreateLexicalEnvironment dst:reg5, parent:reg4, capacity:0, is_catch_environment:false
[ e0] CreateMutableBinding environment:reg5, `y`, can_be_deleted:false
[ f0] InitializeLexicalBinding `y`, src:Int32(2)
[ 108] GetById dst:reg7, base:fns~0, `push` (fns.push)
[ 120] Mov dst:reg8, src:fns~0
[ 130] NewFunction dst:reg9, shared_function_data_index:1
[ 148] Call dst:reg6, callee:reg7, this_value:reg8, fns.push, arguments:[reg9]
[ 170] SetLexicalEnvironment environment:reg4
[ 178] GetByValue dst:reg6, base:fns~0, property:Int32(0)
[ 190] Call dst:reg5, callee:reg6, this_value:fns~0, fns[0]
[ 1b0] GetByValue dst:reg7, base:fns~0, property:Int32(1)
[ 1c8] Call dst:reg6, callee:reg7, this_value:fns~0, fns[1]
[ 1e8] Add dst:reg7, lhs:reg5, rhs:reg6
[ 1f8] Return value:reg7
$cff4e98a block-scoping.js:5:18
Registers: 6
Blocks: 1
block0:
[ 0] DynamicGetBinding dst:reg5, `x`
[ 10] Return value:reg5
$b7c63ac6 block-scoping.js:9:18
Registers: 6
Blocks: 1
block0:
[ 0] DynamicGetBinding dst:reg5, `y`
[ 10] Return value:reg5
breakThroughBlockScopes$3fb5dfc7 block-scoping.js:16:5
Registers: 8
Blocks: 7
Locals: f~0, i~1, result~2
Constants:
[0] = Undefined
[1] = Int32(0)
[2] = Int32(3)
[3] = Int32(1)
block0:
[ 0] GetLexicalEnvironment dst:reg4
[ 8] Mov2 dst1:result~2, src1:Undefined, dst2:i~1, src2:Int32(0)
[ 20] Jump target:block3
block1:
[ 28] CreateLexicalEnvironment dst:reg5, parent:reg4, capacity:0, is_catch_environment:false
[ 40] CreateMutableBinding environment:reg5, `x`, can_be_deleted:false
[ 50] InitializeLexicalBinding `x`, src:i~1
[ 68] NewFunction dst:f~0, shared_function_data_index:0 (f)
[ 80] GetBinding dst:reg6, `x`
[ 98] JumpGreaterThan lhs:reg6, rhs:Int32(1), true_target:block5, false_target:block6
block2:
[ b0] PostfixIncrement dst:reg5, src:i~1
block3:
[ c0] JumpLessThan lhs:i~1, rhs:Int32(3), true_target:block1, false_target:block4
block4:
[ d8] Call dst:reg5, callee:result~2, this_value:Undefined, result
[ f8] Return value:reg5
block5:
[ 100] Mov dst:result~2, src:f~0
[ 110] SetLexicalEnvironment environment:reg4
[ 118] Jump target:block4
block6:
[ 120] SetLexicalEnvironment environment:reg4
[ 128] Jump target:block2
f$63b62772 block-scoping.js:20:21
Registers: 6
Blocks: 1
block0:
[ 0] DynamicGetBinding dst:reg5, `x`
[ 10] Return value:reg5
3
2