Reviewers: ulan,

Description:
Waiting for sweeper threads is last resort in SlowAllocateRaw.

BUG=

Please review this at https://codereview.chromium.org/356403002/

SVN Base: https://v8.googlecode.com/svn/branches/bleeding_edge

Affected files (+11, -0 lines):
  M src/spaces.cc


Index: src/spaces.cc
diff --git a/src/spaces.cc b/src/spaces.cc
index 194f75dfbfa56e0c3498cb83f63ade07df0596eb..777a74683a50f1312e6a334f5371a82cb147808e 100644
--- a/src/spaces.cc
+++ b/src/spaces.cc
@@ -2614,6 +2614,17 @@ HeapObject* PagedSpace::SlowAllocateRaw(int size_in_bytes) {
     return free_list_.Allocate(size_in_bytes);
   }

+  // If sweeper threads are still running, wait for them.
+  if (collector->IsConcurrentSweepingInProgress()) {
+    collector->WaitUntilSweepingCompleted();
+
+    // After waiting for the sweeper threads, there may be new free-list
+    // entries.
+    HeapObject* object = free_list_.Allocate(size_in_bytes);
+    if (object != NULL)
+      return object;
+  }
+
   // Finally, fail.
   return NULL;
 }


--
--
v8-dev mailing list
v8-dev@googlegroups.com
http://groups.google.com/group/v8-dev
--- You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to v8-dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to