Bug 1296639 - Remove SpiderMonkey's periodic full GC r=sfink

This commit is contained in:
Jon Coppeard 2016-08-22 11:14:24 +01:00
Родитель 13c30aacfd
Коммит 187d91a66e
4 изменённых файлов: 6 добавлений и 55 удалений

Просмотреть файл

@ -65,7 +65,7 @@ namespace JS {
D(EVICT_NURSERY) \
D(FULL_STORE_BUFFER) \
D(SHARED_MEMORY_LIMIT) \
D(PERIODIC_FULL_GC) \
D(UNUSED1) \
D(INCREMENTAL_TOO_SLOW) \
D(ABORT_GC) \
\

Просмотреть файл

@ -459,14 +459,6 @@ class GCSchedulingTunables
* -> Responsiveness is proportional to t[marking] + t[sweeping].
* -> size[retained] is proportional only to GC allocations.
*
* PERIODIC_FULL_GC
* ----------------
* When we return to the event loop and it has been 20 seconds since we've
* done a GC, we start an incremenal, all-zones, shrinking GC.
*
* Assumptions:
* -> Our triggers are incomplete.
*
* ALLOC_TRIGGER (non-incremental)
* -------------------------------
* If we do not return to the event loop before getting all the way to our
@ -623,8 +615,7 @@ class GCRuntime
void maybeAllocTriggerZoneGC(Zone* zone, const AutoLockGC& lock);
// The return value indicates if we were able to do the GC.
bool triggerZoneGC(Zone* zone, JS::gcreason::Reason reason);
MOZ_MUST_USE bool maybeGC(Zone* zone);
void maybePeriodicFullGC();
void maybeGC(Zone* zone);
void minorGC(JS::gcreason::Reason reason,
gcstats::Phase phase = gcstats::PHASE_MINOR_GC) JS_HAZ_GC_CALL;
void evictNursery(JS::gcreason::Reason reason = JS::gcreason::EVICT_NURSERY) {
@ -1072,7 +1063,6 @@ class GCRuntime
private:
bool chunkAllocationSinceLastGC;
int64_t nextFullGCTime;
int64_t lastGCTime;
JSGCMode mode;

Просмотреть файл

@ -1339,8 +1339,7 @@ JS_PUBLIC_API(void)
JS_MaybeGC(JSContext* cx)
{
GCRuntime& gc = cx->runtime()->gc;
if (!gc.maybeGC(cx->zone()))
gc.maybePeriodicFullGC();
gc.maybeGC(cx->zone());
}
JS_PUBLIC_API(void)

Просмотреть файл

@ -249,9 +249,6 @@ using mozilla::Swap;
using JS::AutoGCRooter;
/* Perform a Full GC every 20 seconds if MaybeGC is called */
static const uint64_t GC_IDLE_FULL_SPAN = 20 * 1000 * 1000;
/* Increase the IGC marking slice time if we are in highFrequencyGC mode. */
static const int IGC_MARK_SLICE_MULTIPLIER = 2;
@ -807,7 +804,6 @@ GCRuntime::GCRuntime(JSRuntime* rt) :
numArenasFreeCommitted(0),
verifyPreData(nullptr),
chunkAllocationSinceLastGC(false),
nextFullGCTime(0),
lastGCTime(PRMJ_Now()),
mode(JSGC_MODE_INCREMENTAL),
numActiveZoneIters(0),
@ -3039,7 +3035,7 @@ GCRuntime::triggerZoneGC(Zone* zone, JS::gcreason::Reason reason)
return true;
}
bool
void
GCRuntime::maybeGC(Zone* zone)
{
MOZ_ASSERT(CurrentThreadCanAccessRuntime(rt));
@ -3048,12 +3044,12 @@ GCRuntime::maybeGC(Zone* zone)
if (hasZealMode(ZealMode::Alloc) || hasZealMode(ZealMode::Poke)) {
JS::PrepareForFullGC(rt->contextFromMainThread());
gc(GC_NORMAL, JS::gcreason::DEBUG_GC);
return true;
return;
}
#endif
if (gcIfRequested())
return true;
return;
if (zone->usage.gcBytes() > 1024 * 1024 &&
zone->usage.gcBytes() >= zone->threshold.allocTrigger(schedulingState.inHighFrequencyGCMode()) &&
@ -3062,37 +3058,7 @@ GCRuntime::maybeGC(Zone* zone)
{
PrepareZoneForGC(zone);
startGC(GC_NORMAL, JS::gcreason::EAGER_ALLOC_TRIGGER);
return true;
}
return false;
}
void
GCRuntime::maybePeriodicFullGC()
{
/*
* Trigger a periodic full GC.
*
* This is a source of non-determinism, but is not called from the shell.
*
* Access to the counters and, on 32 bit, setting gcNextFullGCTime below
* is not atomic and a race condition could trigger or suppress the GC. We
* tolerate this.
*/
#ifndef JS_MORE_DETERMINISTIC
int64_t now = PRMJ_Now();
if (nextFullGCTime && nextFullGCTime <= now && !isIncrementalGCInProgress()) {
if (chunkAllocationSinceLastGC ||
numArenasFreeCommitted > decommitThreshold)
{
JS::PrepareForFullGC(rt->contextFromMainThread());
startGC(GC_SHRINK, JS::gcreason::PERIODIC_FULL_GC);
} else {
nextFullGCTime = now + GC_IDLE_FULL_SPAN;
}
}
#endif
}
// Do all possible decommit immediately from the current thread without
@ -6141,10 +6107,6 @@ GCRuntime::gcCycle(bool nonincrementalByAPI, SliceBudget& budget, JS::gcreason::
incrementalCollectSlice(budget, reason, session.lock);
#ifndef JS_MORE_DETERMINISTIC
nextFullGCTime = PRMJ_Now() + GC_IDLE_FULL_SPAN;
#endif
chunkAllocationSinceLastGC = false;
#ifdef JS_GC_ZEAL