@@ -3244,7 +3244,7 @@ GCRuntime::triggerGC(JS::gcreason::Reason reason)
32443244 if (JS::CurrentThreadIsHeapCollecting ())
32453245 return false ;
32463246
3247- JS::PrepareForFullGC (rt->activeContextFromOwnThread ());
3247+ JS::PrepareForFullGC (rt->mainContextFromOwnThread ());
32483248 requestMajorGC (reason);
32493249 return true ;
32503250}
@@ -3341,7 +3341,7 @@ GCRuntime::maybeGC(Zone* zone)
33413341
33423342#ifdef JS_GC_ZEAL
33433343 if (hasZealMode (ZealMode::Alloc) || hasZealMode (ZealMode::RootsChange)) {
3344- JS::PrepareForFullGC (rt->activeContextFromOwnThread ());
3344+ JS::PrepareForFullGC (rt->mainContextFromOwnThread ());
33453345 gc (GC_NORMAL , JS ::gcreason::DEBUG_GC );
33463346 return ;
33473347 }
@@ -3966,11 +3966,10 @@ GCRuntime::purgeRuntime()
39663966 zone->functionToStringCache ().purge ();
39673967 }
39683968
3969- for (const CooperatingContext& target : rt->cooperatingContexts ()) {
3970- freeUnusedLifoBlocksAfterSweeping (&target.context ()->tempLifoAlloc ());
3971- target.context ()->interpreterStack ().purge (rt);
3972- target.context ()->frontendCollectionPool ().purge ();
3973- }
3969+ JSContext* cx = rt->mainContextFromOwnThread ();
3970+ freeUnusedLifoBlocksAfterSweeping (&cx->tempLifoAlloc ());
3971+ cx->interpreterStack ().purge (rt);
3972+ cx->frontendCollectionPool ().purge ();
39743973
39753974 rt->caches ().purge ();
39763975
@@ -7020,8 +7019,7 @@ GCRuntime::incrementalCollectSlice(SliceBudget& budget, JS::gcreason::Reason rea
70207019 MOZ_FALLTHROUGH ;
70217020
70227021 case State::Mark:
7023- for (const CooperatingContext& target : rt->cooperatingContexts ())
7024- AutoGCRooter::traceAllWrappers (target, &marker);
7022+ AutoGCRooter::traceAllWrappers (rt->mainContextFromOwnThread (), &marker);
70257023
70267024 /* If we needed delayed marking for gray roots, then collect until done. */
70277025 if (isIncremental && !hasValidGrayRootsBuffer ()) {
@@ -7468,7 +7466,7 @@ GCRuntime::maybeDoCycleCollection()
74687466 }
74697467 double grayFraction = double (compartmentsGray) / double (compartmentsTotal);
74707468 if (grayFraction > ExcessiveGrayCompartments || compartmentsGray > LimitGrayCompartments)
7471- callDoCycleCollectionCallback (rt->activeContextFromOwnThread ());
7469+ callDoCycleCollectionCallback (rt->mainContextFromOwnThread ());
74727470}
74737471
74747472void
@@ -7556,7 +7554,7 @@ GCRuntime::collect(bool nonincrementalByAPI, SliceBudget budget, JS::gcreason::R
75567554 repeat = true ;
75577555 } else if (rootsRemoved && IsShutdownGC (reason)) {
75587556 /* Need to re-schedule all zones for GC. */
7559- JS::PrepareForFullGC (rt->activeContextFromOwnThread ());
7557+ JS::PrepareForFullGC (rt->mainContextFromOwnThread ());
75607558 repeat = true ;
75617559 reason = JS ::gcreason::ROOTS_REMOVED ;
75627560 } else if (shouldRepeatForDeadZone (reason)) {
@@ -7672,7 +7670,7 @@ GCRuntime::startDebugGC(JSGCInvocationKind gckind, SliceBudget& budget)
76727670{
76737671 MOZ_ASSERT (!isIncrementalGCInProgress ());
76747672 if (!ZonesSelected (rt))
7675- JS::PrepareForFullGC (rt->activeContextFromOwnThread ());
7673+ JS::PrepareForFullGC (rt->mainContextFromOwnThread ());
76767674 invocationKind = gckind;
76777675 collect (false , budget, JS ::gcreason::DEBUG_GC );
76787676}
@@ -7682,7 +7680,7 @@ GCRuntime::debugGCSlice(SliceBudget& budget)
76827680{
76837681 MOZ_ASSERT (isIncrementalGCInProgress ());
76847682 if (!ZonesSelected (rt))
7685- JS::PrepareForIncrementalGC (rt->activeContextFromOwnThread ());
7683+ JS::PrepareForIncrementalGC (rt->mainContextFromOwnThread ());
76867684 collect (false , budget, JS ::gcreason::DEBUG_GC );
76877685}
76887686
@@ -7691,7 +7689,7 @@ void
76917689js::PrepareForDebugGC (JSRuntime* rt)
76927690{
76937691 if (!ZonesSelected (rt))
7694- JS::PrepareForFullGC (rt->activeContextFromOwnThread ());
7692+ JS::PrepareForFullGC (rt->mainContextFromOwnThread ());
76957693}
76967694
76977695void
@@ -7864,10 +7862,7 @@ js::NewCompartment(JSContext* cx, JSPrincipals* principals,
78647862 break ;
78657863 }
78667864
7867- if (group) {
7868- // Take over ownership of the group while we create the compartment/zone.
7869- group->enter (cx);
7870- } else {
7865+ if (!group) {
78717866 MOZ_ASSERT (!zone);
78727867 group = cx->new_ <ZoneGroup>(rt);
78737868 if (!group)
@@ -7937,13 +7932,11 @@ js::NewCompartment(JSContext* cx, JSPrincipals* principals,
79377932 if (zoneSpec == JS ::SystemZone || zoneSpec == JS ::NewZoneInSystemZoneGroup) {
79387933 MOZ_RELEASE_ASSERT (!rt->gc .systemZoneGroup );
79397934 rt->gc .systemZoneGroup = group;
7940- group->setUseExclusiveLocking ();
79417935 }
79427936 }
79437937
79447938 zoneHolder.forget ();
79457939 groupHolder.forget ();
7946- group->leave ();
79477940 return compartment.forget ();
79487941}
79497942
@@ -7969,7 +7962,7 @@ GCRuntime::mergeCompartments(JSCompartment* source, JSCompartment* target)
79697962 MOZ_ASSERT (source->zone ()->compartments ().length () == 1 );
79707963 MOZ_ASSERT (source->zone ()->group ()->zones ().length () == 1 );
79717964
7972- JSContext* cx = rt->activeContextFromOwnThread ();
7965+ JSContext* cx = rt->mainContextFromOwnThread ();
79737966
79747967 MOZ_ASSERT (!source->zone ()->wasGCStarted ());
79757968 JS ::AutoAssertNoGC nogc (cx);
@@ -8232,7 +8225,6 @@ js::ReleaseAllJITCode(FreeOp* fop)
82328225{
82338226 js::CancelOffThreadIonCompile (fop->runtime ());
82348227
8235- JSRuntime::AutoProhibitActiveContextChange apacc (fop->runtime ());
82368228 for (ZonesIter zone (fop->runtime (), SkipAtoms); !zone.done (); zone.next ()) {
82378229 zone->setPreservingCode (false );
82388230 zone->discardJitCode (fop);
0 commit comments