mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 15:38:10 +00:00
LibJS: Make the GC marking phase cycle-proof
Don't visit cells that are already marked. This prevents the marking phase from looping forever when two cells refer to each other. Also do the marking directly from the CellVisitor, removing another unnecessary phase of the collector. :^)
This commit is contained in:
parent
70a3e738f5
commit
05c80cac20
5 changed files with 24 additions and 51 deletions
|
@ -44,13 +44,10 @@ public:
|
|||
|
||||
class Visitor {
|
||||
public:
|
||||
virtual void did_visit(Cell*) = 0;
|
||||
virtual void visit(Cell*) = 0;
|
||||
};
|
||||
|
||||
virtual void visit_graph(Visitor& visitor)
|
||||
{
|
||||
visitor.did_visit(this);
|
||||
}
|
||||
virtual void visit_children(Visitor&) {}
|
||||
|
||||
private:
|
||||
bool m_mark { false };
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue