summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibJS/Runtime/Set.cpp
diff options
context:
space:
mode:
authorIdan Horowitz <idan.horowitz@gmail.com>2021-06-09 18:01:06 +0300
committerLinus Groh <mail@linusgroh.de>2021-06-09 17:05:53 +0100
commitad0e3c0e548070554f92367721303ac1dc16dbfc (patch)
tree2045524adcfeea9abb54e0c7090d0025d50ebab4 /Userland/Libraries/LibJS/Runtime/Set.cpp
parent6a0d1fa2598e4546ee121331a71241d519627979 (diff)
downloadserenity-ad0e3c0e548070554f92367721303ac1dc16dbfc.zip
LibJS: Mark heap cell values stored in Set instances
This makes sure they dont get garbage collected while stored in a Set.
Diffstat (limited to 'Userland/Libraries/LibJS/Runtime/Set.cpp')
-rw-r--r--Userland/Libraries/LibJS/Runtime/Set.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/Userland/Libraries/LibJS/Runtime/Set.cpp b/Userland/Libraries/LibJS/Runtime/Set.cpp
index f0cc7be803..4cb42f215f 100644
--- a/Userland/Libraries/LibJS/Runtime/Set.cpp
+++ b/Userland/Libraries/LibJS/Runtime/Set.cpp
@@ -34,4 +34,11 @@ Set* Set::typed_this(VM& vm, GlobalObject& global_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);
+}
+
}