mirror of
https://github.com/RGBCube/serenity
synced 2025-05-18 14:15:08 +00:00
LibJS: Simplify Heap::mark_live_cells()
Instead of iterating over every single cell, simply iterate over the live cells and mark them from there. Thanks to Blam for suggesting this! :^)
This commit is contained in:
parent
0de2ead0e9
commit
c6e54d2a49
1 changed files with 3 additions and 7 deletions
|
@ -118,16 +118,12 @@ void Heap::mark_live_cells(const HashTable<Cell*>& live_cells)
|
||||||
#ifdef HEAP_DEBUG
|
#ifdef HEAP_DEBUG
|
||||||
dbg() << "mark_live_cells:";
|
dbg() << "mark_live_cells:";
|
||||||
#endif
|
#endif
|
||||||
for (auto& block : m_blocks) {
|
for (auto& cell : live_cells) {
|
||||||
block->for_each_cell([&](Cell* cell) {
|
|
||||||
if (live_cells.contains(cell)) {
|
|
||||||
#ifdef HEAP_DEBUG
|
#ifdef HEAP_DEBUG
|
||||||
dbg() << " ! " << cell;
|
dbg() << " ! " << cell;
|
||||||
#endif
|
#endif
|
||||||
cell->set_marked(true);
|
cell->set_marked(true);
|
||||||
}
|
}
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Heap::sweep_dead_cells()
|
void Heap::sweep_dead_cells()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue