1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 12:47:45 +00:00

LibJS: Add a way to save/restore the entire execution context stack

This will be used by LibWeb to squirrel away the stack while performing
a microtask checkpoint in some cases. VM will simply consider saved
execution context stacks as GC roots as well.
This commit is contained in:
Andreas Kling 2021-10-03 14:52:53 +02:00
parent 17e56661db
commit 406d3199d0
2 changed files with 31 additions and 10 deletions

View file

@ -280,6 +280,9 @@ public:
ThrowCompletionOr<Value> named_evaluation_if_anonymous_function(GlobalObject& global_object, ASTNode const& expression, FlyString const& name);
void save_execution_context_stack();
void restore_execution_context_stack();
private:
explicit VM(OwnPtr<CustomData>);
@ -302,6 +305,8 @@ private:
Vector<ExecutionContext*> m_execution_context_stack;
Vector<Vector<ExecutionContext*>> m_saved_execution_context_stacks;
Value m_last_value;
ScopeType m_unwind_until { ScopeType::None };
FlyString m_unwind_until_label;