summaryrefslogtreecommitdiffstats
path: root/xpcom/base/CycleCollectedJSRuntime.cpp
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-15 03:34:42 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-15 03:34:42 +0000
commitda4c7e7ed675c3bf405668739c3012d140856109 (patch)
treecdd868dba063fecba609a1d819de271f0d51b23e /xpcom/base/CycleCollectedJSRuntime.cpp
parentAdding upstream version 125.0.3. (diff)
downloadfirefox-da4c7e7ed675c3bf405668739c3012d140856109.tar.xz
firefox-da4c7e7ed675c3bf405668739c3012d140856109.zip
Adding upstream version 126.0.upstream/126.0
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'xpcom/base/CycleCollectedJSRuntime.cpp')
-rw-r--r--xpcom/base/CycleCollectedJSRuntime.cpp18
1 files changed, 14 insertions, 4 deletions
diff --git a/xpcom/base/CycleCollectedJSRuntime.cpp b/xpcom/base/CycleCollectedJSRuntime.cpp
index c3f9d56857..6833dee791 100644
--- a/xpcom/base/CycleCollectedJSRuntime.cpp
+++ b/xpcom/base/CycleCollectedJSRuntime.cpp
@@ -1563,17 +1563,27 @@ void CycleCollectedJSRuntime::GarbageCollect(JS::GCOptions aOptions,
void CycleCollectedJSRuntime::JSObjectsTenured() {
JSContext* cx = CycleCollectedJSContext::Get()->Context();
- for (auto iter = mNurseryObjects.Iter(); !iter.Done(); iter.Next()) {
+
+ NurseryObjectsVector objects;
+ std::swap(objects, mNurseryObjects);
+
+ for (auto iter = objects.Iter(); !iter.Done(); iter.Next()) {
nsWrapperCache* cache = iter.Get();
JSObject* wrapper = cache->GetWrapperMaybeDead();
MOZ_DIAGNOSTIC_ASSERT(wrapper);
- if (!JS::ObjectIsTenured(wrapper)) {
+
+ if (!js::gc::IsInsideNursery(wrapper)) {
+ continue;
+ }
+
+ if (js::gc::IsDeadNurseryObject(wrapper)) {
MOZ_ASSERT(!cache->PreservingWrapper());
js::gc::FinalizeDeadNurseryObject(cx, wrapper);
+ continue;
}
- }
- mNurseryObjects.Clear();
+ mNurseryObjects.InfallibleAppend(cache);
+ }
}
void CycleCollectedJSRuntime::NurseryWrapperAdded(nsWrapperCache* aCache) {