Wait for sweeper threads when expansion of old generation fails.
authorhpayer@chromium.org <hpayer@chromium.org@ce2b1a6d-e550-0410-aec6-3dcde31c8c00>
Wed, 25 Jun 2014 10:53:00 +0000 (10:53 +0000)
committerhpayer@chromium.org <hpayer@chromium.org@ce2b1a6d-e550-0410-aec6-3dcde31c8c00>
Wed, 25 Jun 2014 10:53:00 +0000 (10:53 +0000)
BUG=
R=ulan@chromium.org

Review URL: https://codereview.chromium.org/351013002

git-svn-id: https://v8.googlecode.com/svn/branches/bleeding_edge@22007 ce2b1a6d-e550-0410-aec6-3dcde31c8c00

src/spaces.cc

index 22233d9..72a0222 100644 (file)
@@ -2595,6 +2595,16 @@ HeapObject* PagedSpace::SlowAllocateRaw(int size_in_bytes) {
   // collection.
   if (!heap()->always_allocate() &&
       heap()->OldGenerationAllocationLimitReached()) {
+    // If sweeper threads are active, wait for them at that point.
+     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;
+     }
+
     return NULL;
   }
 
@@ -2604,16 +2614,6 @@ HeapObject* PagedSpace::SlowAllocateRaw(int size_in_bytes) {
     return free_list_.Allocate(size_in_bytes);
   }
 
-  // If sweeper threads are active, wait for them at that point.
-  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;
 }