mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-05-05 06:32:30 +02:00
LibJS: Drop dead entry GetLexicalEnvironment loads
Teach the Rust bytecode generator to treat the synthetic entry GetLexicalEnvironment as a removable prologue load. We still model reg4 as the saved entry lexical environment during codegen, but assemble() now deletes that load when no emitted instruction refers to the saved environment register. This keeps the semantics of unwinding and environment restoration intact while letting empty functions and other simple bodies start at their first real instruction.
This commit is contained in:
committed by
Andreas Kling
parent
88d4d1b1a6
commit
3a08f7b95f
Notes:
github-actions[bot]
2026-04-13 16:31:04 +00:00
Author: https://github.com/awesomekling Commit: https://github.com/LadybirdBrowser/ladybird/commit/3a08f7b95f8 Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/8891 Reviewed-by: https://github.com/shannonbooth
@@ -5,10 +5,9 @@ $e6445d4a eval-same-function.js:10:1
|
||||
[0] = Undefined
|
||||
|
||||
block0:
|
||||
[ 0] GetLexicalEnvironment dst:reg4
|
||||
[ 8] GetGlobal dst:reg6, `foo`
|
||||
[ 20] Call dst:reg5, callee:reg6, this_value:Undefined, foo
|
||||
[ 40] End value:reg5
|
||||
[ 0] GetGlobal dst:reg6, `foo`
|
||||
[ 18] Call dst:reg5, callee:reg6, this_value:Undefined, foo
|
||||
[ 38] End value:reg5
|
||||
|
||||
|
||||
foo$a4ff2c4f eval-same-function.js:6:9
|
||||
@@ -20,13 +19,12 @@ foo$a4ff2c4f eval-same-function.js:6:9
|
||||
[2] = Int32(42)
|
||||
|
||||
block0:
|
||||
[ 0] GetLexicalEnvironment dst:reg4
|
||||
[ 8] CreateArguments is_immutable:false
|
||||
[ 18] GetCalleeAndThisFromEnvironment callee:reg6, this_value:reg7, `eval`
|
||||
[ 30] CallDirectEval dst:reg5, callee:reg6, this_value:reg7, eval, arguments:[String("var x = 1")]
|
||||
[ 58] GetBinding dst:reg6, `Number`
|
||||
[ 70] CallConstruct dst:reg5, callee:reg6, Number, arguments:[Int32(42)]
|
||||
[ 90] Return value:reg5
|
||||
[ 0] CreateArguments is_immutable:false
|
||||
[ 10] GetCalleeAndThisFromEnvironment callee:reg6, this_value:reg7, `eval`
|
||||
[ 28] CallDirectEval dst:reg5, callee:reg6, this_value:reg7, eval, arguments:[String("var x = 1")]
|
||||
[ 50] GetBinding dst:reg6, `Number`
|
||||
[ 68] CallConstruct dst:reg5, callee:reg6, Number, arguments:[Int32(42)]
|
||||
[ 88] Return value:reg5
|
||||
|
||||
|
||||
eval$3c61584c line 1, column 1
|
||||
@@ -37,6 +35,5 @@ eval$3c61584c line 1, column 1
|
||||
[1] = Undefined
|
||||
|
||||
block0:
|
||||
[ 0] GetLexicalEnvironment dst:reg4
|
||||
[ 8] SetLexicalBinding `x`, src:Int32(1)
|
||||
[ 20] End value:Undefined
|
||||
[ 0] SetLexicalBinding `x`, src:Int32(1)
|
||||
[ 18] End value:Undefined
|
||||
|
||||
Reference in New Issue
Block a user