mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-06-11 10:18:15 +09:00
LibJS: Replace the custom unwind mechanism with completions :^)
This includes: - Parsing proper LabelledStatements with try_parse_labelled_statement() - Removing LabelableStatement - Implementing the LoopEvaluation semantics via loop_evaluation() in each IterationStatement subclass; and IterationStatement evaluation via {For,ForIn,ForOf,ForAwaitOf,While,DoWhile}Statement::execute() - Updating ReturnStatement, BreakStatement and ContinueStatement to return the appropriate completion types - Basically reimplementing TryStatement and SwitchStatement according to the spec, using completions - Honoring result completion types in AsyncBlockStart and OrdinaryCallEvaluateBody - Removing any uses of the VM unwind mechanism - most importantly, VM::throw_exception() now exclusively sets an exception and no longer triggers any unwinding mechanism. However, we already did a good job updating all of LibWeb and userland applications to not use it, and the few remaining uses elsewhere don't rely on unwinding AFAICT.
This commit is contained in:
parent
eed764e1dd
commit
9d0d3affd4
Notes:
sideshowbarker
2024-07-17 21:34:00 +09:00
Author: https://github.com/linusg
Commit: 9d0d3affd4
Pull-request: https://github.com/SerenityOS/serenity/pull/11602
Reviewed-by: https://github.com/davidot ✅
16 changed files with 512 additions and 279 deletions
|
@ -62,10 +62,6 @@ void Interpreter::run(GlobalObject& global_object, const Program& program)
|
|||
auto completion = program.execute(*this, global_object);
|
||||
vm.set_last_value(Badge<Interpreter> {}, completion.value().value_or(js_undefined()));
|
||||
|
||||
// FIXME: We unconditionally stop the unwind here this should be done using completions leaving
|
||||
// the VM in a cleaner state after executing. For example it does still store the exception.
|
||||
vm.stop_unwind();
|
||||
|
||||
// At this point we may have already run any queued promise jobs via on_call_stack_emptied,
|
||||
// in which case this is a no-op.
|
||||
vm.run_queued_promise_jobs();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue