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:
parent
475f1b6083
commit
9f06e130a2
4 changed files with 26 additions and 10 deletions
11
Userland/Libraries/LibJS/Tests/try-return-finally.js
Normal file
11
Userland/Libraries/LibJS/Tests/try-return-finally.js
Normal 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);
|
||||
});
|
Loading…
Add table
Add a link
Reference in a new issue