mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 15:57:45 +00:00
test-js: Add a mark_as_garbage method to force GC to collect that object
This should fix the flaky tests of test-js. It also fixes the tests when running with the -g flag since the values will not be garbage collected too soon.
This commit is contained in:
parent
3373090993
commit
43b17f27a3
6 changed files with 71 additions and 12 deletions
|
@ -191,9 +191,15 @@ public:
|
|||
void Heap::mark_live_cells(const HashTable<Cell*>& roots)
|
||||
{
|
||||
dbgln_if(HEAP_DEBUG, "mark_live_cells:");
|
||||
|
||||
MarkingVisitor visitor;
|
||||
for (auto* root : roots)
|
||||
visitor.visit(root);
|
||||
|
||||
for (auto& inverse_root : m_uprooted_cells)
|
||||
inverse_root->set_marked(false);
|
||||
|
||||
m_uprooted_cells.clear();
|
||||
}
|
||||
|
||||
void Heap::sweep_dead_cells(bool print_report, const Core::ElapsedTimer& measurement_timer)
|
||||
|
@ -327,4 +333,9 @@ void Heap::undefer_gc(Badge<DeferGC>)
|
|||
}
|
||||
}
|
||||
|
||||
void Heap::uproot_cell(Cell* cell)
|
||||
{
|
||||
m_uprooted_cells.append(cell);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue