Bug 753615 - Ensure we don't re-enter a GC phase (r=terrence)

This commit is contained in:
Bill McCloskey 2012-05-10 10:29:45 -07:00
Родитель 97ee26bb24
Коммит f8af37ee8f
2 изменённых файлов: 9 добавлений и 2 удалений

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

@ -599,6 +599,9 @@ Statistics::endSlice()
void
Statistics::beginPhase(Phase phase)
{
/* Guard against re-entry */
JS_ASSERT(!phaseStartTimes[phase]);
phaseStartTimes[phase] = PRMJ_Now();
phaseStartFaults[phase] = gc::GetPageFaultCount();
@ -614,6 +617,7 @@ Statistics::endPhase(Phase phase)
int64_t t = PRMJ_Now() - phaseStartTimes[phase];
slices.back().phaseTimes[phase] += t;
phaseTimes[phase] += t;
phaseStartTimes[phase] = 0;
size_t faults = gc::GetPageFaultCount() - phaseStartFaults[phase];
slices.back().phaseFaults[phase] += faults;

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

@ -3449,7 +3449,6 @@ IncrementalMarkSlice(JSRuntime *rt, int64_t budget, JSGCInvocationKind gckind, b
*shouldSweep = false;
if (rt->gcIncrementalState == MARK) {
gcstats::AutoPhase ap(rt->gcStats, gcstats::PHASE_MARK);
SliceBudget sliceBudget(budget);
/* If we needed delayed marking for gray roots, then collect until done. */
@ -3466,7 +3465,11 @@ IncrementalMarkSlice(JSRuntime *rt, int64_t budget, JSGCInvocationKind gckind, b
}
#endif
bool finished = rt->gcMarker.drainMarkStack(sliceBudget);
bool finished;
{
gcstats::AutoPhase ap(rt->gcStats, gcstats::PHASE_MARK);
finished = rt->gcMarker.drainMarkStack(sliceBudget);
}
if (finished) {
JS_ASSERT(rt->gcMarker.isDrained());
if (initialState == MARK && !rt->gcLastMarkSlice && budget != SliceBudget::Unlimited) {