mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-05-02 20:42:11 +02:00
Replace the saved_lexical_environments stack in ExecutionContextRareData with explicit register-based environment tracking. Environments are now stored in registers and restored via SetLexicalEnvironment, making the environment flow visible in bytecode. Key changes: - Add GetLexicalEnvironment and SetLexicalEnvironment opcodes - CreateLexicalEnvironment takes explicit parent and dst operands - EnterObjectEnvironment stores new environment in a dst register - NewClass takes an explicit class_environment operand - Remove LeaveLexicalEnvironment opcode (instead: SetLexicalEnvironment) - Remove saved_lexical_environments from ExecutionContextRareData - Use a reserved register for the saved lexical environment to avoid dominance issues with lazily-emitted GetLexicalEnvironment
20 lines
861 B
Plaintext
20 lines
861 B
Plaintext
JS bytecode executable ""
|
|
[ 0] 0: GetLexicalEnvironment dst:reg4
|
|
[ 8] GetGlobal dst:reg6, identifier:foo
|
|
[ 18] Call dst:reg5, callee:reg6, this_value:Undefined, foo
|
|
[ 38] End value:reg5
|
|
|
|
JS bytecode executable "foo"
|
|
[ 0] 0: GetLexicalEnvironment dst:reg4
|
|
[ 8] CreateArguments is_immutable:false
|
|
[ 18] GetCalleeAndThisFromEnvironment callee:reg6, this_value:reg7, identifier:eval
|
|
[ 30] CallDirectEval dst:reg5, callee:reg6, this_value:reg7, eval, arguments:[String("var x = 1")]
|
|
[ 58] GetBinding dst:reg6, identifier:Number
|
|
[ 70] CallConstruct dst:reg5, callee:reg6, Number, arguments:[Int32(42)]
|
|
[ 90] Return value:reg5
|
|
|
|
JS bytecode executable "eval"
|
|
[ 0] 0: GetLexicalEnvironment dst:reg4
|
|
[ 8] SetLexicalBinding identifier:x, src:Int32(1)
|
|
[ 20] End value:Undefined
|