mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 15:48:12 +00:00
LibJS: Implement basic conservative garbage collection
We now scan the stack and CPU registers for potential pointers into the GC heap, and include any valid Cell pointers in the set of roots. This works pretty well but we'll also need to solve marking of things passed to native functions, since those are currently in Vector<Value> and the Vector storage is on the heap (not scanned.)
This commit is contained in:
parent
ad92a1e4bc
commit
ab404a2f88
3 changed files with 81 additions and 2 deletions
|
@ -59,9 +59,12 @@ private:
|
|||
Cell* allocate_cell(size_t);
|
||||
|
||||
void gather_roots(HashTable<Cell*>&);
|
||||
void gather_conservative_roots(HashTable<Cell*>&);
|
||||
void mark_live_cells(const HashTable<Cell*>& live_cells);
|
||||
void sweep_dead_cells();
|
||||
|
||||
Cell* cell_from_possible_pointer(FlatPtr);
|
||||
|
||||
Interpreter& m_interpreter;
|
||||
Vector<NonnullOwnPtr<HeapBlock>> m_blocks;
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue