summaryrefslogtreecommitdiffstats
path: root/js/src/vm/Realm.cpp
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 01:13:27 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 01:13:27 +0000
commit40a355a42d4a9444dc753c04c6608dade2f06a23 (patch)
tree871fc667d2de662f171103ce5ec067014ef85e61 /js/src/vm/Realm.cpp
parentAdding upstream version 124.0.1. (diff)
downloadfirefox-40a355a42d4a9444dc753c04c6608dade2f06a23.tar.xz
firefox-40a355a42d4a9444dc753c04c6608dade2f06a23.zip
Adding upstream version 125.0.1.upstream/125.0.1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'js/src/vm/Realm.cpp')
-rw-r--r--js/src/vm/Realm.cpp10
1 files changed, 8 insertions, 2 deletions
diff --git a/js/src/vm/Realm.cpp b/js/src/vm/Realm.cpp
index d2ad39f3db..4e3eba5677 100644
--- a/js/src/vm/Realm.cpp
+++ b/js/src/vm/Realm.cpp
@@ -237,11 +237,17 @@ void Realm::traceRoots(JSTracer* trc,
// The global is never nursery allocated, so we don't need to
// trace it when doing a minor collection.
//
- // If a realm is on-stack, we mark its global so that
- // JSContext::global() remains valid.
+ // If a realm is on-stack, we mark its global so that JSContext::global()
+ // remains valid.
if (shouldTraceGlobal() && global_) {
TraceRoot(trc, global_.unbarrieredAddress(), "on-stack realm global");
}
+
+ // If the realm is still being initialized we set a flag so that it doesn't
+ // get deleted, since there may be GC things that contain pointers to it.
+ if (shouldTraceGlobal() && initializingGlobal_) {
+ allocatedDuringIncrementalGC_ = true;
+ }
}
// Nothing below here needs to be treated as a root if we aren't marking