mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-27 12:46:06 +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:
parent
91656d63c7
commit
789d20ebb7
Notes:
sideshowbarker
2024-07-18 17:25:11 +09:00
Author: https://github.com/awesomekling
Commit: 789d20ebb7
4 changed files with 32 additions and 20 deletions
|
@ -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)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue