mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-26 09:30:24 +00:00
LibJS: Leave unwind contexts on enter of finally blocks in Bytecode
Before we were doing so while exiting the catch-block, but not when exiting the try-block. This now centralizes the responsibility to exit the unwind context to the finalizer, ignoring return/break/continue. This makes it easier to handle the return case in a future commit.
This commit is contained in:
parent
c500647eee
commit
fc332be2e5
Notes:
sideshowbarker
2024-07-17 20:22:04 +09:00
Author: https://github.com/Hendiadyoin1 Commit: https://github.com/SerenityOS/serenity/commit/fc332be2e5 Pull-request: https://github.com/SerenityOS/serenity/pull/16055 Reviewed-by: https://github.com/alimpfard Reviewed-by: https://github.com/linusg
1 changed files with 1 additions and 1 deletions
|
@ -1927,6 +1927,7 @@ Bytecode::CodeGenerationErrorOr<void> TryStatement::generate_bytecode(Bytecode::
|
|||
if (m_finalizer) {
|
||||
auto& finalizer_block = generator.make_block();
|
||||
generator.switch_to_basic_block(finalizer_block);
|
||||
generator.emit<Bytecode::Op::LeaveUnwindContext>();
|
||||
TRY(m_finalizer->generate_bytecode(generator));
|
||||
if (!generator.is_current_block_terminated()) {
|
||||
next_block = &generator.make_block();
|
||||
|
@ -1964,7 +1965,6 @@ Bytecode::CodeGenerationErrorOr<void> TryStatement::generate_bytecode(Bytecode::
|
|||
|
||||
if (!generator.is_current_block_terminated()) {
|
||||
if (m_finalizer) {
|
||||
generator.emit<Bytecode::Op::LeaveUnwindContext>();
|
||||
generator.emit<Bytecode::Op::Jump>(finalizer_target);
|
||||
} else {
|
||||
VERIFY(!next_block);
|
||||
|
|
Loading…
Reference in a new issue