Bug 1075572 - Join the alloc task when finishing the GC; r=bhackett

--HG--
extra : rebase_source : f430ce2a54987fa45094f2313b6eb662bc80e697
This commit is contained in:
Terrence Cole 2015-01-26 13:29:00 -08:00
Родитель 5159c47849
Коммит 7604aa35cf
1 изменённых файлов: 9 добавлений и 6 удалений

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

@ -1287,10 +1287,12 @@ void
GCRuntime::finish()
{
/*
* Wait until the background finalization stops and the helper thread
* shuts down before we forcefully release any remaining GC memory.
* Wait until the background finalization and allocation stops and the
* helper thread shuts down before we forcefully release any remaining GC
* memory.
*/
helperState.finish();
allocTask.cancel(GCParallelTask::CancelAndWait);
#ifdef JS_GC_ZEAL
/* Free memory associated with GC verification. */
@ -2957,10 +2959,11 @@ GCRuntime::refillFreeListFromMainThread(JSContext *cx, AllocKind thingKind)
return thing;
// Even if allocateFromArena failed due to OOM, a background
// finalization task may be running (freeing more memory); wait for it
// to finish, then try to allocate again in case it freed up the memory
// we need.
rt->gc.waitBackgroundSweepEnd();
// finalization or allocation task may be running freeing more memory
// or adding more available memory to our free pool; wait for them to
// finish, then try to allocate again in case they made more memory
// available.
rt->gc.waitBackgroundSweepOrAllocEnd();
thing = arenas->allocateFromArena(zone, thingKind, maybeStartBGAlloc);
if (MOZ_LIKELY(thing))