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

Revert "LibJS: Remove "uprooting" mechanism from garbage collector"

This reverts commit 6232ad3a0d.

Unfortunately this introduced some flakiness on CI, so it wasn't
quite this simple.
This commit is contained in:
Andreas Kling 2023-07-22 06:53:22 +02:00
parent a2955501d3
commit 1768d70823
6 changed files with 65 additions and 28 deletions

View file

@ -276,6 +276,11 @@ void Heap::mark_live_cells(HashTable<Cell*> const& roots)
bytecode_interpreter->visit_edges(visitor);
visitor.mark_all_live_cells();
for (auto& inverse_root : m_uprooted_cells)
inverse_root->set_marked(false);
m_uprooted_cells.clear();
}
bool Heap::cell_must_survive_garbage_collection(Cell const& cell)
@ -422,6 +427,11 @@ void Heap::undefer_gc(Badge<DeferGC>)
}
}
void Heap::uproot_cell(Cell* cell)
{
m_uprooted_cells.append(cell);
}
void register_safe_function_closure(void* base, size_t size)
{
if (!s_custom_ranges_for_conservative_scan) {

View file

@ -76,6 +76,8 @@ public:
BlockAllocator& block_allocator() { return m_block_allocator; }
void uproot_cell(Cell* cell);
private:
static bool cell_must_survive_garbage_collection(Cell const&);
@ -110,6 +112,8 @@ private:
MarkedVectorBase::List m_marked_vectors;
WeakContainer::List m_weak_containers;
Vector<GCPtr<Cell>> m_uprooted_cells;
BlockAllocator m_block_allocator;
size_t m_gc_deferrals { 0 };