Bug 1144920 - Move gray buffer clearing out of GCMarker; r=jonco

This commit is contained in:
Terrence Cole 2015-03-19 08:51:12 -07:00
parent b2f8da5c1c
commit d9aa475dc5
3 changed files with 12 additions and 3 deletions

View File

@ -1037,8 +1037,16 @@ class GCRuntime
};
GrayBufferState grayBufferState;
bool hasBufferedGrayRoots() const { return grayBufferState == GrayBufferState::Okay; }
// Clear each zone's gray buffers, but do not change the current state.
void resetBufferedGrayRoots() const;
// Reset the gray buffering state to Unused.
void clearBufferedGrayRoots() {
grayBufferState = GrayBufferState::Unused;
resetBufferedGrayRoots();
}
/*
* The gray bits can become invalid if UnmarkGray overflows the stack. A
* full GC will reset this bit, since it fills in all the gray bits.

View File

@ -554,9 +554,6 @@ GCMarker::stop()
/* Free non-ballast stack memory. */
stack.reset();
runtime()->gc.resetBufferedGrayRoots();
runtime()->gc.grayBufferState = GCRuntime::GrayBufferState::Unused;
}
void
@ -650,6 +647,8 @@ GCMarker::checkZone(void *p)
void
GCRuntime::resetBufferedGrayRoots() const
{
MOZ_ASSERT(grayBufferState != GrayBufferState::Okay,
"Do not clear the gray buffers unless we are Failed or becoming Unused");
for (GCZonesIter zone(rt); !zone.done(); zone.next())
zone->gcGrayRoots.clearAndFree();
}

View File

@ -5373,6 +5373,7 @@ GCRuntime::finishCollection(JS::gcreason::Reason reason)
{
MOZ_ASSERT(marker.isDrained());
marker.stop();
clearBufferedGrayRoots();
uint64_t currentTime = PRMJ_Now();
schedulingState.updateHighFrequencyMode(lastGCTime, currentTime, tunables);
@ -5496,6 +5497,7 @@ GCRuntime::resetIncrementalGC(const char *reason)
marker.reset();
marker.stop();
clearBufferedGrayRoots();
for (GCCompartmentsIter c(rt); !c.done(); c.next())
ResetGrayList(c);