Index: src/spaces.cc |
diff --git a/src/spaces.cc b/src/spaces.cc |
index 22233d9b3c2d011aa1ff8d59740cd97228689dc1..72a0222ba454d6c77d7bd8c714095bcee72100c8 100644 |
--- a/src/spaces.cc |
+++ b/src/spaces.cc |
@@ -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; |
} |