diff options
author | Andreas Kling <kling@serenityos.org> | 2022-09-05 14:31:25 +0200 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2022-09-06 00:27:09 +0200 |
commit | 00c8f071923a6d6fbbd4fe989dd6980d3a6b18af (patch) | |
tree | 4b01357deed0a36349d11cb275c66f3f28a673d9 /Userland/Libraries/LibJS/CyclicModule.h | |
parent | cb151321463b133fbdfff57c0ab25da067e66410 (diff) | |
download | serenity-00c8f071923a6d6fbbd4fe989dd6980d3a6b18af.zip |
LibJS: Make Script and Module GC-allocated
This ensures that code currently in any active or saved execution stack
always stays alive.
Diffstat (limited to 'Userland/Libraries/LibJS/CyclicModule.h')
-rw-r--r-- | Userland/Libraries/LibJS/CyclicModule.h | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/Userland/Libraries/LibJS/CyclicModule.h b/Userland/Libraries/LibJS/CyclicModule.h index 2f66b5d977..2c710d51a8 100644 --- a/Userland/Libraries/LibJS/CyclicModule.h +++ b/Userland/Libraries/LibJS/CyclicModule.h @@ -25,6 +25,8 @@ enum class ModuleStatus { // 16.2.1.5 Cyclic Module Records, https://tc39.es/ecma262/#sec-cyclic-module-records class CyclicModule : public Module { + JS_CELL(CyclicModule, Module); + public: // Note: Do not call these methods directly unless you are HostResolveImportedModule. // Badges cannot be used because other hosts must be able to call this (and it is called recursively) @@ -34,6 +36,8 @@ public: protected: CyclicModule(Realm& realm, StringView filename, bool has_top_level_await, Vector<ModuleRequest> requested_modules); + virtual void visit_edges(Cell::Visitor&) override; + virtual ThrowCompletionOr<u32> inner_module_linking(VM& vm, Vector<Module*>& stack, u32 index) override; virtual ThrowCompletionOr<u32> inner_module_evaluation(VM& vm, Vector<Module*>& stack, u32 index) override; @@ -50,7 +54,7 @@ protected: Optional<u32> m_dfs_index; // [[DFSIndex]] Optional<u32> m_dfs_ancestor_index; // [[DFSAncestorIndex]] Vector<ModuleRequest> m_requested_modules; // [[RequestedModules]] - CyclicModule* m_cycle_root; // [[CycleRoot]] + 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]] |