1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 15:38:10 +00:00

LibJS: Make the GC marking phase cycle-proof

Don't visit cells that are already marked. This prevents the marking
phase from looping forever when two cells refer to each other.

Also do the marking directly from the CellVisitor, removing another
unnecessary phase of the collector. :^)
This commit is contained in:
Andreas Kling 2020-03-09 22:11:22 +01:00
parent 70a3e738f5
commit 05c80cac20
5 changed files with 24 additions and 51 deletions

View file

@ -57,7 +57,6 @@ private:
Cell* allocate_cell(size_t);
void collect_roots(HashTable<Cell*>&);
void visit_live_cells(const HashTable<Cell*>& roots, HashTable<Cell*>& live_cells);
void mark_live_cells(const HashTable<Cell*>& live_cells);
void sweep_dead_cells();