diff --git a/Userland/Libraries/LibJS/Bytecode/Interpreter.cpp b/Userland/Libraries/LibJS/Bytecode/Interpreter.cpp index b768174b9d6..90a6d77dff3 100644 --- a/Userland/Libraries/LibJS/Bytecode/Interpreter.cpp +++ b/Userland/Libraries/LibJS/Bytecode/Interpreter.cpp @@ -474,11 +474,11 @@ Interpreter::ValueAndFrame Interpreter::run_and_return_frame(Executable& executa { dbgln_if(JS_BYTECODE_DEBUG, "Bytecode::Interpreter will run unit {:p}", &executable); - TemporaryChange restore_executable { m_current_executable, &executable }; + TemporaryChange restore_executable { m_current_executable, GCPtr { executable } }; TemporaryChange restore_saved_jump { m_scheduled_jump, static_cast(nullptr) }; - TemporaryChange restore_realm { m_realm, vm().current_realm() }; - TemporaryChange restore_global_object { m_global_object, &m_realm->global_object() }; - TemporaryChange restore_global_declarative_environment { m_global_declarative_environment, &m_realm->global_environment().declarative_record() }; + TemporaryChange restore_realm { m_realm, GCPtr { vm().current_realm() } }; + TemporaryChange restore_global_object { m_global_object, GCPtr { m_realm->global_object() } }; + TemporaryChange restore_global_declarative_environment { m_global_declarative_environment, GCPtr { m_realm->global_environment().declarative_record() } }; VERIFY(!vm().execution_context_stack().is_empty()); diff --git a/Userland/Libraries/LibJS/Bytecode/Interpreter.h b/Userland/Libraries/LibJS/Bytecode/Interpreter.h index ae9f91c5be9..b88f86837af 100644 --- a/Userland/Libraries/LibJS/Bytecode/Interpreter.h +++ b/Userland/Libraries/LibJS/Bytecode/Interpreter.h @@ -125,11 +125,11 @@ private: Vector, CallFrame*>> m_call_frames; Span m_current_call_frame; BasicBlock const* m_scheduled_jump { nullptr }; - Executable* m_current_executable { nullptr }; + GCPtr m_current_executable { nullptr }; BasicBlock const* m_current_block { nullptr }; - Realm* m_realm { nullptr }; - Object* m_global_object { nullptr }; - DeclarativeEnvironment* m_global_declarative_environment { nullptr }; + GCPtr m_realm { nullptr }; + GCPtr m_global_object { nullptr }; + GCPtr m_global_declarative_environment { nullptr }; Optional m_pc {}; }; diff --git a/Userland/Libraries/LibJS/Heap/Heap.cpp b/Userland/Libraries/LibJS/Heap/Heap.cpp index 511724f8e40..36a15473a9a 100644 --- a/Userland/Libraries/LibJS/Heap/Heap.cpp +++ b/Userland/Libraries/LibJS/Heap/Heap.cpp @@ -186,8 +186,8 @@ public: while (!m_work_queue.is_empty()) { auto ptr = reinterpret_cast(&m_work_queue.last()); m_node_being_visited = &m_graph.ensure(ptr); - m_node_being_visited->class_name = m_work_queue.last().class_name(); - m_work_queue.take_last().visit_edges(*this); + m_node_being_visited->class_name = m_work_queue.last()->class_name(); + m_work_queue.take_last()->visit_edges(*this); m_node_being_visited = nullptr; } } @@ -244,7 +244,7 @@ private: }; GraphNode* m_node_being_visited { nullptr }; - Vector m_work_queue; + Vector> m_work_queue; HashMap m_graph; Heap& m_heap; @@ -438,13 +438,13 @@ public: void mark_all_live_cells() { while (!m_work_queue.is_empty()) { - m_work_queue.take_last().visit_edges(*this); + m_work_queue.take_last()->visit_edges(*this); } } private: Heap& m_heap; - Vector m_work_queue; + Vector> m_work_queue; HashTable m_all_live_heap_blocks; FlatPtr m_min_block_address; FlatPtr m_max_block_address; diff --git a/Userland/Libraries/LibJS/Runtime/VM.cpp b/Userland/Libraries/LibJS/Runtime/VM.cpp index 819bd57c139..c751d933064 100644 --- a/Userland/Libraries/LibJS/Runtime/VM.cpp +++ b/Userland/Libraries/LibJS/Runtime/VM.cpp @@ -183,7 +183,7 @@ struct ExecutionContextRootsCollector : public Cell::Visitor { VERIFY_NOT_REACHED(); } - HashTable roots; + HashTable> roots; }; void VM::gather_roots(HashMap& roots) @@ -207,7 +207,7 @@ void VM::gather_roots(HashMap& roots) for (auto const& execution_context : stack) { ExecutionContextRootsCollector visitor; execution_context->visit_edges(visitor); - for (auto* cell : visitor.roots) + for (auto cell : visitor.roots) roots.set(cell, HeapRoot { .type = HeapRoot::Type::VM }); } };