mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 10:58:12 +00:00
LibJS: Allow cells to mark null pointers
This simplifies the cell visiting functions by letting them not worry about the pointers they pass to the visitor being null.
This commit is contained in:
parent
1f4e3dd073
commit
1b391d78ae
5 changed files with 16 additions and 13 deletions
|
@ -188,7 +188,7 @@ class MarkingVisitor final : public Cell::Visitor {
|
|||
public:
|
||||
MarkingVisitor() {}
|
||||
|
||||
virtual void visit(Cell* cell)
|
||||
virtual void visit_impl(Cell* cell)
|
||||
{
|
||||
if (cell->is_marked())
|
||||
return;
|
||||
|
@ -206,11 +206,8 @@ void Heap::mark_live_cells(const HashTable<Cell*>& roots)
|
|||
dbg() << "mark_live_cells:";
|
||||
#endif
|
||||
MarkingVisitor visitor;
|
||||
for (auto* root : roots) {
|
||||
if (!root)
|
||||
continue;
|
||||
for (auto* root : roots)
|
||||
visitor.visit(root);
|
||||
}
|
||||
}
|
||||
|
||||
void Heap::sweep_dead_cells()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue