mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 06:57:45 +00:00
LibJS: Mark heap cell values stored in Set instances
This makes sure they dont get garbage collected while stored in a Set.
This commit is contained in:
parent
6a0d1fa259
commit
ad0e3c0e54
2 changed files with 9 additions and 0 deletions
|
@ -34,4 +34,11 @@ Set* Set::typed_this(VM& vm, GlobalObject& global_object)
|
||||||
return static_cast<Set*>(this_object);
|
return static_cast<Set*>(this_object);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Set::visit_edges(Cell::Visitor& visitor)
|
||||||
|
{
|
||||||
|
Object::visit_edges(visitor);
|
||||||
|
for (auto& value : m_values)
|
||||||
|
visitor.visit(value);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -47,6 +47,8 @@ public:
|
||||||
HashTable<Value, ValueTraits>& values() { return m_values; };
|
HashTable<Value, ValueTraits>& values() { return m_values; };
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
virtual void visit_edges(Visitor& visitor) override;
|
||||||
|
|
||||||
HashTable<Value, ValueTraits> m_values; // FIXME: Replace with a HashTable that maintains a linked list of insertion order for correct iteration order
|
HashTable<Value, ValueTraits> m_values; // FIXME: Replace with a HashTable that maintains a linked list of insertion order for correct iteration order
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue