mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-04-21 20:15:17 +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
Notes:
sideshowbarker
2024-07-19 08:48:43 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/c6e54d2a49c
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
Reference in a new issue