mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 17:58:12 +00:00
LibJS: Generate unwind chains for break in Bytecode
This uses a newly added instruction `ScheduleJump` This instruction tells the finally proceeding it, that instead of jumping to it's next block it should jump to the designated block.
This commit is contained in:
parent
495ba53e46
commit
f5376cb282
9 changed files with 123 additions and 19 deletions
|
@ -59,6 +59,12 @@ public:
|
|||
{
|
||||
m_pending_jump = &label.block();
|
||||
}
|
||||
void schedule_jump(Label const& label)
|
||||
{
|
||||
m_scheduled_jump = &label.block();
|
||||
VERIFY(unwind_contexts().last().finalizer);
|
||||
jump(Label { *unwind_contexts().last().finalizer });
|
||||
}
|
||||
void do_return(Value return_value) { m_return_value = return_value; }
|
||||
|
||||
void enter_unwind_context(Optional<Label> handler_target, Optional<Label> finalizer_target);
|
||||
|
@ -102,6 +108,7 @@ private:
|
|||
Realm& m_realm;
|
||||
Vector<Variant<NonnullOwnPtr<RegisterWindow>, RegisterWindow*>> m_register_windows;
|
||||
Optional<BasicBlock const*> m_pending_jump;
|
||||
BasicBlock const* m_scheduled_jump { nullptr };
|
||||
Value m_return_value;
|
||||
Handle<Value> m_saved_return_value;
|
||||
Executable const* m_current_executable { nullptr };
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue