1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 07:37:35 +00:00

LibJS/Bytecode: Keep saved return value in call frame register

This fixes an issue where returning inside a `try` block and then
calling a function inside `finally` would clobber the saved return
value from the `try` block.

Note that we didn't need to change the base of register allocation,
since it was already 1 too high.

With this fixed, https://microsoft.com/edge loads in bytecode mode. :^)

Thanks to Luke for reducing the issue!
This commit is contained in:
Andreas Kling 2023-07-21 17:30:07 +02:00
parent 475f1b6083
commit 9f06e130a2
4 changed files with 26 additions and 10 deletions

View file

@ -0,0 +1,11 @@
test("return from try followed by finally with function call inside", () => {
let value = (() => {
try {
return 1;
} finally {
(() => {})();
}
})();
expect(value).toBe(1);
});