summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibJS/CyclicModule.h
diff options
context:
space:
mode:
authorLinus Groh <mail@linusgroh.de>2022-10-02 12:11:30 +0100
committerLinus Groh <mail@linusgroh.de>2022-10-02 23:02:27 +0100
commitfc9d587e3958538fc2fd027c32dbcc0fb251e3f5 (patch)
tree118d6c6513810673f239819219fee60cface19e3 /Userland/Libraries/LibJS/CyclicModule.h
parent0585029c30ce20da06f26d19149d3feccb56ed08 (diff)
downloadserenity-fc9d587e3958538fc2fd027c32dbcc0fb251e3f5.zip
LibJS: Make PromiseCapability GC-allocated
A struct with three raw pointers to other GC'd types is a pretty big liability, let's just turn this into a Cell itself. This comes with the additional benefit of being able to capture it in a lambda effortlessly, without having to create handles for individual members.
Diffstat (limited to 'Userland/Libraries/LibJS/CyclicModule.h')
-rw-r--r--Userland/Libraries/LibJS/CyclicModule.h24
1 files changed, 12 insertions, 12 deletions
diff --git a/Userland/Libraries/LibJS/CyclicModule.h b/Userland/Libraries/LibJS/CyclicModule.h
index 00facbefcb..b610a678fc 100644
--- a/Userland/Libraries/LibJS/CyclicModule.h
+++ b/Userland/Libraries/LibJS/CyclicModule.h
@@ -42,24 +42,24 @@ protected:
virtual ThrowCompletionOr<u32> inner_module_evaluation(VM& vm, Vector<Module*>& stack, u32 index) override;
virtual ThrowCompletionOr<void> initialize_environment(VM& vm);
- virtual ThrowCompletionOr<void> execute_module(VM& vm, Optional<PromiseCapability> capability = {});
+ virtual ThrowCompletionOr<void> execute_module(VM& vm, GCPtr<PromiseCapability> capability = {});
void execute_async_module(VM& vm);
void gather_available_ancestors(Vector<CyclicModule*>& exec_list);
void async_module_execution_fulfilled(VM& vm);
void async_module_execution_rejected(VM& vm, Value error);
- ModuleStatus m_status { ModuleStatus::Unlinked }; // [[Status]]
- ThrowCompletionOr<void> m_evaluation_error; // [[EvaluationError]]
- Optional<u32> m_dfs_index; // [[DFSIndex]]
- Optional<u32> m_dfs_ancestor_index; // [[DFSAncestorIndex]]
- Vector<ModuleRequest> m_requested_modules; // [[RequestedModules]]
- CyclicModule* m_cycle_root { nullptr }; // [[CycleRoot]]
- bool m_has_top_level_await { false }; // [[HasTLA]]
- bool m_async_evaluation { false }; // [[AsyncEvaluation]]
- Optional<PromiseCapability> m_top_level_capability; // [[TopLevelCapability]]
- Vector<CyclicModule*> m_async_parent_modules; // [[AsyncParentModules]]
- Optional<u32> m_pending_async_dependencies; // [[PendingAsyncDependencies]]
+ ModuleStatus m_status { ModuleStatus::Unlinked }; // [[Status]]
+ ThrowCompletionOr<void> m_evaluation_error; // [[EvaluationError]]
+ Optional<u32> m_dfs_index; // [[DFSIndex]]
+ Optional<u32> m_dfs_ancestor_index; // [[DFSAncestorIndex]]
+ Vector<ModuleRequest> m_requested_modules; // [[RequestedModules]]
+ CyclicModule* m_cycle_root { nullptr }; // [[CycleRoot]]
+ bool m_has_top_level_await { false }; // [[HasTLA]]
+ bool m_async_evaluation { false }; // [[AsyncEvaluation]]
+ GCPtr<PromiseCapability> m_top_level_capability; // [[TopLevelCapability]]
+ Vector<CyclicModule*> m_async_parent_modules; // [[AsyncParentModules]]
+ Optional<u32> m_pending_async_dependencies; // [[PendingAsyncDependencies]]
};
}