summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibJS/Runtime/FinalizationRegistry.h
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2021-10-02 16:35:55 +0200
committerAndreas Kling <kling@serenityos.org>2021-10-02 16:39:28 +0200
commit6a1b82df2b9c176c46be3fd89ad78184a5a4f55c (patch)
tree288ff50f216094ba6d393d7001dee036a92a2df3 /Userland/Libraries/LibJS/Runtime/FinalizationRegistry.h
parentf290c59dd82b3ae59bdb7c10bd7026788b879b8d (diff)
downloadserenity-6a1b82df2b9c176c46be3fd89ad78184a5a4f55c.zip
LibJS: Put zombie cell tracking code behind a compile-time flag
Since this is a debug-only feature, let's not have it impact GC marking performance when you don't need it.
Diffstat (limited to 'Userland/Libraries/LibJS/Runtime/FinalizationRegistry.h')
-rw-r--r--Userland/Libraries/LibJS/Runtime/FinalizationRegistry.h8
1 files changed, 7 insertions, 1 deletions
diff --git a/Userland/Libraries/LibJS/Runtime/FinalizationRegistry.h b/Userland/Libraries/LibJS/Runtime/FinalizationRegistry.h
index 6affdcd6a3..681df05c3b 100644
--- a/Userland/Libraries/LibJS/Runtime/FinalizationRegistry.h
+++ b/Userland/Libraries/LibJS/Runtime/FinalizationRegistry.h
@@ -34,7 +34,13 @@ public:
private:
virtual void visit_edges(Visitor& visitor) override;
- virtual void did_become_zombie() override { deregister(); }
+
+#ifdef JS_TRACK_ZOMBIE_CELLS
+ virtual void did_become_zombie() override
+ {
+ deregister();
+ }
+#endif
FunctionObject* m_cleanup_callback { nullptr };