Bug 721579 - Remove rt->gcTriggerBytes and rt->gcLastBytes (r=igor)

This commit is contained in:
Bill McCloskey 2012-02-10 18:32:25 -08:00
Родитель 20ce6b700a
Коммит 6e1d0e4dc3
3 изменённых файлов: 3 добавлений и 43 удалений

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

@ -720,8 +720,6 @@ JSRuntime::JSRuntime()
gcUserAvailableChunkListHead(NULL),
gcKeepAtoms(0),
gcBytes(0),
gcTriggerBytes(0),
gcLastBytes(0),
gcMaxBytes(0),
gcMaxMallocBytes(0),
gcNumArenasFreeCommitted(0),

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

@ -284,8 +284,6 @@ struct JSRuntime : js::RuntimeFriendFields
js::GCLocks gcLocksHash;
jsrefcount gcKeepAtoms;
size_t gcBytes;
size_t gcTriggerBytes;
size_t gcLastBytes;
size_t gcMaxBytes;
size_t gcMaxMallocBytes;
@ -540,9 +538,6 @@ struct JSRuntime : js::RuntimeFriendFields
JSRuntime *thisFromCtor() { return this; }
void setGCLastBytes(size_t lastBytes, JSGCInvocationKind gckind);
void reduceGCTriggerBytes(size_t amount);
/*
* Call the system malloc while checking for GC memory pressure and
* reporting OOM error when cx is not null. We will not GC from here.

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

@ -784,10 +784,8 @@ Chunk::releaseArena(ArenaHeader *aheader)
JS_ASSERT(rt->gcBytes >= ArenaSize);
JS_ASSERT(comp->gcBytes >= ArenaSize);
#ifdef JS_THREADSAFE
if (rt->gcHelperThread.sweeping()) {
rt->reduceGCTriggerBytes(GC_HEAP_GROWTH_FACTOR * ArenaSize);
if (rt->gcHelperThread.sweeping())
comp->reduceGCTriggerBytes(GC_HEAP_GROWTH_FACTOR * ArenaSize);
}
#endif
rt->gcBytes -= ArenaSize;
comp->gcBytes -= ArenaSize;
@ -893,12 +891,6 @@ js_InitGC(JSRuntime *rt, uint32_t maxbytes)
rt->gcMaxBytes = maxbytes;
rt->setGCMaxMallocBytes(maxbytes);
/*
* The assigned value prevents GC from running when GC memory is too low
* (during JS engine start).
*/
rt->setGCLastBytes(8192, GC_NORMAL);
rt->gcJitReleaseTime = PRMJ_Now() + JIT_SCRIPT_RELEASE_TYPES_INTERVAL;
return true;
}
@ -1355,25 +1347,6 @@ js_MapGCRoots(JSRuntime *rt, JSGCRootMapFun map, void *data)
return ct;
}
void
JSRuntime::setGCLastBytes(size_t lastBytes, JSGCInvocationKind gckind)
{
gcLastBytes = lastBytes;
size_t base = gckind == GC_SHRINK ? lastBytes : Max(lastBytes, GC_ALLOCATION_THRESHOLD);
float trigger = float(base) * GC_HEAP_GROWTH_FACTOR;
gcTriggerBytes = size_t(Min(float(gcMaxBytes), trigger));
}
void
JSRuntime::reduceGCTriggerBytes(size_t amount) {
JS_ASSERT(amount > 0);
JS_ASSERT(gcTriggerBytes - amount >= 0);
if (gcTriggerBytes - amount < GC_ALLOCATION_THRESHOLD * GC_HEAP_GROWTH_FACTOR)
return;
gcTriggerBytes -= amount;
}
void
JSCompartment::setGCLastBytes(size_t lastBytes, JSGCInvocationKind gckind)
{
@ -1385,7 +1358,8 @@ JSCompartment::setGCLastBytes(size_t lastBytes, JSGCInvocationKind gckind)
}
void
JSCompartment::reduceGCTriggerBytes(size_t amount) {
JSCompartment::reduceGCTriggerBytes(size_t amount)
{
JS_ASSERT(amount > 0);
JS_ASSERT(gcTriggerBytes - amount >= 0);
if (gcTriggerBytes - amount < GC_ALLOCATION_THRESHOLD * GC_HEAP_GROWTH_FACTOR)
@ -2159,12 +2133,6 @@ TriggerCompartmentGC(JSCompartment *comp, gcreason::Reason reason)
return;
}
if (rt->gcBytes > 8192 && rt->gcBytes >= 3 * (rt->gcTriggerBytes / 2)) {
/* If we're using significantly more than our quota, do a full GC. */
TriggerGC(rt, reason);
return;
}
/*
* Trigger the GC when it is safe to call an operation callback on any
* thread.
@ -2952,7 +2920,6 @@ GCCycle(JSContext *cx, JSCompartment *comp, JSGCInvocationKind gckind)
#endif
rt->gcMarkAndSweep = false;
rt->setGCLastBytes(rt->gcBytes, gckind);
rt->gcCurrentCompartment = NULL;
for (CompartmentsIter c(rt); !c.done(); c.next())