Backed out changeset 6a96e15c810c (bug 1093307) for ggc bustage on a CLOSED TREE

This commit is contained in:
Wes Kocher 2014-11-10 14:40:59 -08:00
parent 717bf55f6a
commit c7d648224f
2 changed files with 6 additions and 38 deletions

View File

@ -498,7 +498,7 @@ class GCRuntime
* Must be called either during the GC or with the GC lock taken.
*/
Chunk *expireEmptyChunkPool(bool shrinkBuffers, const AutoLockGC &lock);
void freeEmptyChunks(JSRuntime *rt, const AutoLockGC &lock);
void freeEmptyChunks(JSRuntime *rt);
void freeChunkList(Chunk *chunkListHead);
void prepareToFreeChunk(ChunkInfo &info);
void releaseChunk(Chunk *chunk);
@ -543,7 +543,6 @@ class GCRuntime
bool sweepPhase(SliceBudget &sliceBudget);
void endSweepPhase(bool lastGC);
void sweepZones(FreeOp *fop, bool lastGC);
void decommitAllWithoutUnlocking(const AutoLockGC &lock);
void decommitArenasFromAvailableList(Chunk **availableListHeadp);
void decommitArenas();
void expireChunksAndArenas(bool shouldShrink, const AutoLockGC &lock);

View File

@ -744,22 +744,15 @@ GCRuntime::expireEmptyChunkPool(bool shrinkBuffers, const AutoLockGC &lock)
return freeList;
}
static void
FreeChunkPool(JSRuntime *rt, ChunkPool &pool)
void
GCRuntime::freeEmptyChunks(JSRuntime *rt)
{
for (ChunkPool::Enum e(pool); !e.empty();) {
for (ChunkPool::Enum e(emptyChunks_); !e.empty();) {
Chunk *chunk = e.front();
e.removeAndPopFront();
MOZ_ASSERT(!chunk->info.numArenasFreeCommitted);
FreeChunk(rt, chunk);
}
MOZ_ASSERT(pool.count() == 0);
}
void
GCRuntime::freeEmptyChunks(JSRuntime *rt, const AutoLockGC &lock)
{
FreeChunkPool(rt, emptyChunks(lock));
}
void
@ -1429,7 +1422,7 @@ GCRuntime::finish()
chunkSet.clear();
}
FreeChunkPool(rt, emptyChunks_);
freeEmptyChunks(rt);
if (rootsHash.initialized())
rootsHash.clear();
@ -3129,25 +3122,6 @@ GCRuntime::maybePeriodicFullGC()
#endif
}
// Do all possible decommit immediately from the current thread without
// releasing the GC lock or allocating any memory.
void
GCRuntime::decommitAllWithoutUnlocking(const AutoLockGC &lock)
{
MOZ_ASSERT(emptyChunks(lock).count() == 0);
for (Chunk *chunk = *getAvailableChunkList(); chunk; chunk = chunk->info.next) {
for (size_t i = 0; i < ArenasPerChunk; ++i) {
if (chunk->decommittedArenas.get(i) || chunk->arenas[i].aheader.allocated())
continue;
if (MarkPagesUnused(&chunk->arenas[i], ArenaSize)) {
chunk->info.numArenasFreeCommitted--;
chunk->decommittedArenas.set(i);
}
}
}
}
void
GCRuntime::decommitArenasFromAvailableList(Chunk **availableListHeadp)
{
@ -6242,12 +6216,7 @@ GCRuntime::onOutOfMallocMemory()
// Throw away any excess chunks we have lying around.
AutoLockGC lock(rt);
freeEmptyChunks(rt, lock);
// Immediately decommit as many arenas as possible in the hopes that this
// might let the OS scrape together enough pages to satisfy the failing
// malloc request.
decommitAllWithoutUnlocking(lock);
expireChunksAndArenas(true, lock);
}
void