diff options
Diffstat (limited to 'js/src/vm/Realm.cpp')
-rw-r--r-- | js/src/vm/Realm.cpp | 10 |
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 |