mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-05-05 06:32:30 +02:00
LibJS: Replace implicit environment stack with explicit registers
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
This commit is contained in:
committed by
Andreas Kling
parent
0f69eac657
commit
7f89158d20
Notes:
github-actions[bot]
2026-02-09 15:38:17 +00:00
Author: https://github.com/awesomekling Commit: https://github.com/LadybirdBrowser/ladybird/commit/7f89158d206 Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/7846
25
Tests/LibJS/Bytecode/input/try-catch-scoping.js
Normal file
25
Tests/LibJS/Bytecode/input/try-catch-scoping.js
Normal file
@@ -0,0 +1,25 @@
|
||||
function tryCatchWithBlocks() {
|
||||
let x = 1;
|
||||
try {
|
||||
let y = 2;
|
||||
throw y;
|
||||
} catch (e) {
|
||||
let z = 3;
|
||||
console.log(x + e + z);
|
||||
}
|
||||
}
|
||||
tryCatchWithBlocks();
|
||||
|
||||
function tryCatchFinallyWithBlocks() {
|
||||
let x = 1;
|
||||
try {
|
||||
let y = 2;
|
||||
throw y;
|
||||
} catch (e) {
|
||||
console.log(e);
|
||||
} finally {
|
||||
let z = 3;
|
||||
console.log(z);
|
||||
}
|
||||
}
|
||||
tryCatchFinallyWithBlocks();
|
||||
Reference in New Issue
Block a user