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:
Andreas Kling 2020-03-09 22:11:22 +01:00
commit 05c80cac20
Notes: sideshowbarker 2024-07-19 08:47:47 +09:00
5 changed files with 24 additions and 51 deletions

View file

@ -44,7 +44,7 @@ public:
virtual bool is_function() const { return false; }
virtual const char* class_name() const override { return "Object"; }
virtual void visit_graph(Cell::Visitor&) override;
virtual void visit_children(Cell::Visitor&) override;
private:
HashMap<String, Value> m_properties;