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.
84 lines
2.4 KiB
Text
84 lines
2.4 KiB
Text
$9e4f55e8 switch-scoping.js:15:1
|
|
Registers: 11
|
|
Blocks: 1
|
|
Constants:
|
|
[0] = Undefined
|
|
[1] = Int32(1)
|
|
[2] = Int32(2)
|
|
|
|
block0:
|
|
[ 0] GetGlobal dst:reg6, `console`
|
|
[ 10] GetById dst:reg7, base:reg6, `log` (console.log)
|
|
[ 28] GetGlobal dst:reg9, `switchWithBlockDecl`
|
|
[ 38] Call dst:reg8, callee:reg9, this_value:Undefined, switchWithBlockDecl, arguments:[Int32(1)]
|
|
[ 60] Call dst:reg5, callee:reg7, this_value:reg6, console.log, arguments:[reg8]
|
|
[ 88] GetGlobal dst:reg6, `console`
|
|
[ 98] GetById dst:reg8, base:reg6, `log` (console.log)
|
|
[ b0] GetGlobal dst:reg10, `switchWithBlockDecl`
|
|
[ c0] Call dst:reg9, callee:reg10, this_value:Undefined, switchWithBlockDecl, arguments:[Int32(2)]
|
|
[ e8] Call dst:reg7, callee:reg8, this_value:reg6, console.log, arguments:[reg9]
|
|
[ 110] End value:reg7
|
|
|
|
|
|
switchWithBlockDecl$ba88cf0a switch-scoping.js:2:5
|
|
Registers: 7
|
|
Blocks: 6
|
|
Locals: result~0
|
|
Constants:
|
|
[0] = Undefined
|
|
[1] = Int32(1)
|
|
[2] = Int32(2)
|
|
[3] = String("one")
|
|
[4] = String("two")
|
|
|
|
block0:
|
|
[ 0] GetLexicalEnvironment dst:reg4
|
|
[ 8] Mov dst:result~0, src:Undefined
|
|
[ 18] CreateLexicalEnvironment dst:reg5, parent:reg4, capacity:0, is_catch_environment:false
|
|
[ 30] CreateMutableBinding environment:reg5, `a`, can_be_deleted:false
|
|
[ 40] CreateMutableBinding environment:reg5, `b`, can_be_deleted:false
|
|
[ 50] JumpStrictlyEquals lhs:Int32(1), rhs:arg0, true_target:block3, false_target:block1
|
|
|
|
block1:
|
|
[ 68] JumpStrictlyEquals lhs:Int32(2), rhs:arg0, true_target:block4, false_target:block2
|
|
|
|
block2:
|
|
[ 80] Jump target:block5
|
|
|
|
block3:
|
|
[ 88] InitializeLexicalBinding `a`, src:String("one")
|
|
[ a0] NewFunction dst:reg6, shared_function_data_index:0 (result)
|
|
[ b8] Mov dst:result~0, src:reg6
|
|
[ c8] Jump target:block5
|
|
|
|
block4:
|
|
[ d0] InitializeLexicalBinding `b`, src:String("two")
|
|
[ e8] NewFunction dst:reg6, shared_function_data_index:1 (result)
|
|
[ 100] Mov dst:result~0, src:reg6
|
|
|
|
block5:
|
|
[ 110] SetLexicalEnvironment environment:reg4
|
|
[ 118] Call dst:reg5, callee:result~0, this_value:Undefined, result
|
|
[ 138] Return value:reg5
|
|
|
|
|
|
result$bf9aaf34 switch-scoping.js:6:22
|
|
Registers: 6
|
|
Blocks: 1
|
|
|
|
block0:
|
|
[ 0] DynamicGetBinding dst:reg5, `a`
|
|
[ 10] Return value:reg5
|
|
|
|
|
|
result$8921e678 switch-scoping.js:10:22
|
|
Registers: 6
|
|
Blocks: 1
|
|
|
|
block0:
|
|
[ 0] DynamicGetBinding dst:reg5, `b`
|
|
[ 10] Return value:reg5
|
|
|
|
|
|
"one"
|
|
"two"
|