LibJS: Fix some GCVerifier warnings

This commit is contained in:
Matthew Olsson 2024-04-05 13:47:41 -07:00 committed by Andreas Kling
parent f3096bd4a1
commit 8b8ada292e
4 changed files with 15 additions and 15 deletions

View file

@ -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<BasicBlock const*>(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());

View file

@ -125,11 +125,11 @@ private:
Vector<Variant<NonnullOwnPtr<CallFrame>, CallFrame*>> m_call_frames;
Span<Value> m_current_call_frame;
BasicBlock const* m_scheduled_jump { nullptr };
Executable* m_current_executable { nullptr };
GCPtr<Executable> 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<Realm> m_realm { nullptr };
GCPtr<Object> m_global_object { nullptr };
GCPtr<DeclarativeEnvironment> m_global_declarative_environment { nullptr };
Optional<InstructionStreamIterator&> m_pc {};
};

View file

@ -186,8 +186,8 @@ public:
while (!m_work_queue.is_empty()) {
auto ptr = reinterpret_cast<FlatPtr>(&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<Cell&> m_work_queue;
Vector<NonnullGCPtr<Cell>> m_work_queue;
HashMap<FlatPtr, GraphNode> 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<Cell&> m_work_queue;
Vector<NonnullGCPtr<Cell>> m_work_queue;
HashTable<HeapBlock*> m_all_live_heap_blocks;
FlatPtr m_min_block_address;
FlatPtr m_max_block_address;

View file

@ -183,7 +183,7 @@ struct ExecutionContextRootsCollector : public Cell::Visitor {
VERIFY_NOT_REACHED();
}
HashTable<Cell*> roots;
HashTable<GCPtr<Cell>> roots;
};
void VM::gather_roots(HashMap<Cell*, HeapRoot>& roots)
@ -207,7 +207,7 @@ void VM::gather_roots(HashMap<Cell*, HeapRoot>& 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 });
}
};