1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 23:47:45 +00:00

LibJS: Replace Cell live bit with a cell state

So far we only have two states: Live and Dead. In the future, we can
add additional states to support incremental sweeping and/or multi-
stage cell destruction.
This commit is contained in:
Andreas Kling 2021-05-25 18:35:27 +02:00
parent 91656d63c7
commit 789d20ebb7
4 changed files with 32 additions and 20 deletions

View file

@ -48,6 +48,15 @@ public:
callback(cell(i));
}
template<Cell::State state, typename Callback>
void for_each_cell_in_state(Callback callback)
{
for_each_cell([&](auto* cell) {
if (cell->state() == state)
callback(cell);
});
}
Heap& heap() { return m_heap; }
static HeapBlock* from_cell(const Cell* cell)