mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-04-26 01:35:08 +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
28 lines
566 B
JavaScript
28 lines
566 B
JavaScript
function continueThroughFinally() {
|
|
let result = 0;
|
|
for (let i = 0; i < 3; i++) {
|
|
try {
|
|
if (i === 1) continue;
|
|
result += i;
|
|
} finally {
|
|
result += 10;
|
|
}
|
|
}
|
|
return result;
|
|
}
|
|
console.log(continueThroughFinally());
|
|
|
|
function breakThroughFinally() {
|
|
let result = 0;
|
|
for (let i = 0; i < 10; i++) {
|
|
try {
|
|
if (i === 2) break;
|
|
result += i;
|
|
} finally {
|
|
result += 100;
|
|
}
|
|
}
|
|
return result;
|
|
}
|
|
console.log(breakThroughFinally());
|