Bug 1166041 - Wait for nursery sweeping to finish before shutting down; r=jonco
authorTerrence Cole <terrence@mozilla.com>
Wed, 29 Jul 2015 08:57:14 -0700
changeset 288881 54e85cce2cadab90168e9ac93e4e4dfeb53667dd
parent 288880 284e480363118933968d31946e0747d8141a00c0
child 288882 eafffe750ebb430eb48caaba500a0fa81bb7ab36
push id934
push userraliiev@mozilla.com
push dateMon, 26 Oct 2015 12:58:05 +0000
treeherdermozilla-release@05704e35c1d0 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjonco
bugs1166041
milestone42.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1166041 - Wait for nursery sweeping to finish before shutting down; r=jonco
js/src/gc/Nursery.cpp
js/src/jsgc.cpp
--- a/js/src/gc/Nursery.cpp
+++ b/js/src/gc/Nursery.cpp
@@ -633,16 +633,17 @@ js::Nursery::freeMallocedBuffers()
         freeMallocedBuffersTask->runFromMainThread(runtime());
 
     MOZ_ASSERT(mallocedBuffers.empty());
 }
 
 void
 js::Nursery::waitBackgroundFreeEnd()
 {
+    MOZ_ASSERT(freeMallocedBuffersTask);
     freeMallocedBuffersTask->join();
 }
 
 void
 js::Nursery::sweep()
 {
 #ifdef JS_GC_ZEAL
     /* Poison the nursery contents so touching a freed object will crash. */
--- a/js/src/jsgc.cpp
+++ b/js/src/jsgc.cpp
@@ -1313,16 +1313,20 @@ GCRuntime::init(uint32_t maxbytes, uint3
         return false;
 
     return true;
 }
 
 void
 GCRuntime::finish()
 {
+    /* Wait for the nursery sweeping to end. */
+    if (rt->gc.nursery.isEnabled())
+        rt->gc.nursery.waitBackgroundFreeEnd();
+
     /*
      * 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);