mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 04:07:44 +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
4 changed files with 32 additions and 20 deletions
|
@ -47,11 +47,11 @@ void HeapBlock::deallocate(Cell* cell)
|
|||
{
|
||||
VERIFY(is_valid_cell_pointer(cell));
|
||||
VERIFY(!m_freelist || is_valid_cell_pointer(m_freelist));
|
||||
VERIFY(cell->is_live());
|
||||
VERIFY(cell->state() == Cell::State::Live);
|
||||
VERIFY(!cell->is_marked());
|
||||
cell->~Cell();
|
||||
auto* freelist_entry = new (cell) FreelistEntry();
|
||||
freelist_entry->set_live(false);
|
||||
freelist_entry->set_state(Cell::State::Dead);
|
||||
freelist_entry->next = m_freelist;
|
||||
m_freelist = freelist_entry;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue