Chromium Code Reviews| Index: src/heap/spaces.cc |
| diff --git a/src/heap/spaces.cc b/src/heap/spaces.cc |
| index 520a4060ca4c8280bc324f1c17228254e0c0a06b..c45b0d9c9d67830ad3114008e0b5257fbcdfbc24 100644 |
| --- a/src/heap/spaces.cc |
| +++ b/src/heap/spaces.cc |
| @@ -2713,8 +2713,7 @@ void PagedSpace::EvictEvacuationCandidatesFromLinearAllocationArea() { |
| } |
| -HeapObject* PagedSpace::WaitForSweeperThreadsAndRetryAllocation( |
| - int size_in_bytes) { |
| +HeapObject* PagedSpace::SweepAndRetry(int size_in_bytes) { |
|
Hannes Payer (out of office)
2015/10/22 11:05:13
Let's call it SweepAndRetryAllocation.
Michael Lippautz
2015/10/22 12:50:38
Done.
|
| MarkCompactCollector* collector = heap()->mark_compact_collector(); |
| if (collector->sweeping_in_progress()) { |
| // Wait for the sweeper threads here and complete the sweeping phase. |
| @@ -2724,7 +2723,17 @@ HeapObject* PagedSpace::WaitForSweeperThreadsAndRetryAllocation( |
| // entries. |
| return free_list_.Allocate(size_in_bytes); |
| } |
| - return NULL; |
| + return nullptr; |
| +} |
| + |
| + |
| +HeapObject* CompactionSpace::SweepAndRetry(int size_in_bytes) { |
|
Hannes Payer (out of office)
2015/10/22 11:05:13
Same same.
Michael Lippautz
2015/10/22 12:50:38
Done done.
|
| + MarkCompactCollector* collector = heap()->mark_compact_collector(); |
| + if (collector->sweeping_in_progress()) { |
| + collector->SweepAndRefill(this); |
| + return free_list_.Allocate(size_in_bytes); |
| + } |
| + return nullptr; |
| } |
| @@ -2761,7 +2770,7 @@ HeapObject* PagedSpace::SlowAllocateRaw(int size_in_bytes) { |
| heap()->OldGenerationAllocationLimitReached()) { |
| // If sweeper threads are active, wait for them at that point and steal |
| // elements form their free-lists. |
| - HeapObject* object = WaitForSweeperThreadsAndRetryAllocation(size_in_bytes); |
| + HeapObject* object = SweepAndRetry(size_in_bytes); |
| return object; |
| } |
| @@ -2775,7 +2784,7 @@ HeapObject* PagedSpace::SlowAllocateRaw(int size_in_bytes) { |
| // If sweeper threads are active, wait for them at that point and steal |
| // elements form their free-lists. Allocation may still fail their which |
| // would indicate that there is not enough memory for the given allocation. |
| - return WaitForSweeperThreadsAndRetryAllocation(size_in_bytes); |
| + return SweepAndRetry(size_in_bytes); |
| } |