mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-10-04 23:29:52 +00:00
LibJS: Cleanup unwind state when transferring control out of a finalizer
This does two things: * Clear exceptions when transferring control out of a finalizer Otherwise they would resurface at the end of the next finalizer (see test the new test case), or at the end of a function * Pop one scheduled jump when transferring control out of a finalizer This removes one old FIXME
This commit is contained in:
parent
27b238d9af
commit
ada5027163
Notes:
sideshowbarker
2024-07-17 06:38:11 +09:00
Author: https://github.com/Hendiadyoin1
Commit: ada5027163
Pull-request: https://github.com/SerenityOS/serenity/pull/23927
Reviewed-by: https://github.com/ADKaster
8 changed files with 65 additions and 6 deletions
|
@ -2443,7 +2443,11 @@ Bytecode::CodeGenerationErrorOr<Optional<Bytecode::Operand>> TryStatement::gener
|
|||
auto& finalizer_block = generator.make_block();
|
||||
generator.switch_to_basic_block(finalizer_block);
|
||||
generator.emit<Bytecode::Op::LeaveUnwindContext>();
|
||||
|
||||
generator.start_boundary(Bytecode::Generator::BlockBoundaryType::LeaveFinally);
|
||||
(void)TRY(m_finalizer->generate_bytecode(generator));
|
||||
generator.end_boundary(Bytecode::Generator::BlockBoundaryType::LeaveFinally);
|
||||
|
||||
if (!generator.is_current_block_terminated()) {
|
||||
next_block = &generator.make_block();
|
||||
auto next_target = Bytecode::Label { *next_block };
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue