summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibJS/Runtime/VM.cpp
diff options
context:
space:
mode:
authorIdan Horowitz <idan.horowitz@gmail.com>2021-08-15 00:04:00 +0300
committerLinus Groh <mail@linusgroh.de>2021-08-14 22:32:31 +0100
commit04359995a7ff60cb2c889148ad4d823f2dc7203c (patch)
treef4ef5cfc55a47b7fb413ecc01b1e965c70d27443 /Userland/Libraries/LibJS/Runtime/VM.cpp
parentdf176ca2d9310fc5e00503e9e51d911e1fdcf51d (diff)
downloadserenity-04359995a7ff60cb2c889148ad4d823f2dc7203c.zip
LibJS: Exclude FinalizationRegistries with queued cleanup jobs from GC
This is done by just adding them to the list of GC roots, which prevents the VM from trying to run cleanup job of garbage collected registries.
Diffstat (limited to 'Userland/Libraries/LibJS/Runtime/VM.cpp')
-rw-r--r--Userland/Libraries/LibJS/Runtime/VM.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/Userland/Libraries/LibJS/Runtime/VM.cpp b/Userland/Libraries/LibJS/Runtime/VM.cpp
index 048004e61d..f8ebdab071 100644
--- a/Userland/Libraries/LibJS/Runtime/VM.cpp
+++ b/Userland/Libraries/LibJS/Runtime/VM.cpp
@@ -120,6 +120,9 @@ void VM::gather_roots(HashTable<Cell*>& roots)
for (auto* job : m_promise_jobs)
roots.set(job);
+
+ for (auto* finalization_registry : m_finalization_registry_cleanup_jobs)
+ roots.set(finalization_registry);
}
Symbol* VM::get_global_symbol(const String& description)