mirror of
https://github.com/RGBCube/serenity
synced 2025-05-18 18:45: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,15 +118,11 @@ void Heap::mark_live_cells(const HashTable<Cell*>& live_cells)
|
|||
#ifdef HEAP_DEBUG
|
||||
dbg() << "mark_live_cells:";
|
||||
#endif
|
||||
for (auto& block : m_blocks) {
|
||||
block->for_each_cell([&](Cell* cell) {
|
||||
if (live_cells.contains(cell)) {
|
||||
for (auto& cell : live_cells) {
|
||||
#ifdef HEAP_DEBUG
|
||||
dbg() << " ! " << cell;
|
||||
dbg() << " ! " << cell;
|
||||
#endif
|
||||
cell->set_marked(true);
|
||||
}
|
||||
});
|
||||
cell->set_marked(true);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue