Bug 779172 - GC: Incremental zeal modes interact badly with BudgetIncrementalGC r=billm

--HG--
extra : rebase_source : 520eeff0ecb498a8e04e974c8640d4c46bcb34a9
This commit is contained in:
Jon Coppeard 2012-08-02 10:54:30 +01:00
parent 0774a86832
commit 260a9e3e73

View File

@ -3879,22 +3879,26 @@ IncrementalCollectSlice(JSRuntime *rt,
int zeal = 0; int zeal = 0;
#ifdef JS_GC_ZEAL #ifdef JS_GC_ZEAL
if (reason == gcreason::DEBUG_GC) { if (reason == gcreason::DEBUG_GC && budget != SliceBudget::Unlimited) {
/* /*
* Do the collection type specified by zeal mode only if the collection * Do the incremental collection type specified by zeal mode if the
* was triggered by RunDebugGC(). * collection was triggered by RunDebugGC() and incremental GC has not
* been cancelled by ResetIncrementalGC.
*/ */
zeal = rt->gcZeal(); zeal = rt->gcZeal();
JS_ASSERT_IF(zeal == ZealIncrementalMarkAllThenFinish ||
zeal == ZealIncrementalRootsThenFinish,
budget == SliceBudget::Unlimited);
} }
#endif #endif
bool isIncremental = rt->gcIncrementalState != NO_INCREMENTAL || bool isIncremental = rt->gcIncrementalState != NO_INCREMENTAL ||
budget != SliceBudget::Unlimited || budget != SliceBudget::Unlimited;
zeal == ZealIncrementalRootsThenFinish ||
zeal == ZealIncrementalMarkAllThenFinish; if (zeal == ZealIncrementalRootsThenFinish || zeal == ZealIncrementalMarkAllThenFinish) {
/*
* Yields between slices occurs at predetermined points in these
* modes. sliceBudget is not used.
*/
sliceBudget.reset();
}
if (rt->gcIncrementalState == NO_INCREMENTAL) { if (rt->gcIncrementalState == NO_INCREMENTAL) {
rt->gcIncrementalState = MARK_ROOTS; rt->gcIncrementalState = MARK_ROOTS;
@ -4504,7 +4508,8 @@ RunDebugGC(JSContext *cx)
rt->gcIncrementalLimit *= 2; rt->gcIncrementalLimit *= 2;
budget = SliceBudget::WorkBudget(rt->gcIncrementalLimit); budget = SliceBudget::WorkBudget(rt->gcIncrementalLimit);
} else { } else {
budget = SliceBudget::Unlimited; // This triggers incremental GC but is actually ignored by IncrementalMarkSlice.
budget = SliceBudget::WorkBudget(1);
} }
Collect(rt, true, budget, GC_NORMAL, gcreason::DEBUG_GC); Collect(rt, true, budget, GC_NORMAL, gcreason::DEBUG_GC);