From 6a1b82df2b9c176c46be3fd89ad78184a5a4f55c Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Sat, 2 Oct 2021 16:35:55 +0200 Subject: 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. --- Userland/Libraries/LibJS/Runtime/FinalizationRegistry.h | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'Userland/Libraries/LibJS/Runtime/FinalizationRegistry.h') 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 }; -- cgit v1.2.3