diff --git a/Libraries/LibJS/Heap/Heap.cpp b/Libraries/LibJS/Heap/Heap.cpp index 9f9cb02c154ecc510e67e2fcfc1541d5ceb7de25..a4a131fe5cd8ed49d0c11bb12ff5cc5f6bfd91ce 100644 --- a/Libraries/LibJS/Heap/Heap.cpp +++ b/Libraries/LibJS/Heap/Heap.cpp @@ -105,9 +105,7 @@ void Heap::collect_garbage(CollectionType collection_type, bool print_report) void Heap::gather_roots(HashTable& roots) { - if (auto* interpreter = vm().interpreter_if_exists()) - interpreter->gather_roots({}, roots); - + vm().gather_roots(roots); gather_conservative_roots(roots); for (auto* handle : m_handles) diff --git a/Libraries/LibJS/Interpreter.cpp b/Libraries/LibJS/Interpreter.cpp index 3165c8dd47949f47eadfd5cc5ceb7e222bb46922..56386e9ea5be21f5ca8da58ebdef18d1af8d4d2a 100644 --- a/Libraries/LibJS/Interpreter.cpp +++ b/Libraries/LibJS/Interpreter.cpp @@ -223,7 +223,7 @@ Symbol* Interpreter::get_global_symbol(const String& description) return new_global_symbol; } -void Interpreter::gather_roots(Badge, HashTable& roots) +void Interpreter::gather_roots(HashTable& roots) { roots.set(m_exception); diff --git a/Libraries/LibJS/Interpreter.h b/Libraries/LibJS/Interpreter.h index b356adfbede069edb507933967e18f7bc64cb2f7..86a90bdc514345b5d49918311ff06ee70195f27d 100644 --- a/Libraries/LibJS/Interpreter.h +++ b/Libraries/LibJS/Interpreter.h @@ -135,7 +135,7 @@ public: Symbol* get_global_symbol(const String& description); - void gather_roots(Badge, HashTable&); + void gather_roots(HashTable&); void enter_scope(const ScopeNode&, ArgumentVector, ScopeType, GlobalObject&); void exit_scope(const ScopeNode&); diff --git a/Libraries/LibJS/Runtime/VM.cpp b/Libraries/LibJS/Runtime/VM.cpp index 41b1e46ec4572fdbbd811861d668c5fdc9fa4a06..3a221d986281c4e4ef19cd2f6d48d2736e08f640 100644 --- a/Libraries/LibJS/Runtime/VM.cpp +++ b/Libraries/LibJS/Runtime/VM.cpp @@ -82,4 +82,10 @@ VM::InterpreterScope::~InterpreterScope() m_interpreter.vm().pop_interpreter(m_interpreter); } +void VM::gather_roots(HashTable& roots) +{ + for (auto* interpreter : m_interpreters) + interpreter->gather_roots(roots); +} + } diff --git a/Libraries/LibJS/Runtime/VM.h b/Libraries/LibJS/Runtime/VM.h index d2623982197455ea20dda9220e5736c98d9a0724..dd1b333cc0a3dd0d92b69fc04d2bc6aacd2410db 100644 --- a/Libraries/LibJS/Runtime/VM.h +++ b/Libraries/LibJS/Runtime/VM.h @@ -53,6 +53,8 @@ public: Interpreter& m_interpreter; }; + void gather_roots(HashTable&); + private: VM();