Index: src/heap/spaces.cc |
diff --git a/src/heap/spaces.cc b/src/heap/spaces.cc |
index 90d252abb592a46a051864883c30c6bd44b436b3..024fb5dd6d1306ba778d92e3d7be46ae1a3fc5d9 100644 |
--- a/src/heap/spaces.cc |
+++ b/src/heap/spaces.cc |
@@ -952,9 +952,7 @@ STATIC_ASSERT(static_cast<ObjectSpace>(1 << AllocationSpace::MAP_SPACE) == |
PagedSpace::PagedSpace(Heap* heap, AllocationSpace space, |
Executability executable) |
- : Space(heap, space, executable), |
- free_list_(this), |
- end_of_unswept_pages_(NULL) { |
+ : Space(heap, space, executable), free_list_(this) { |
area_size_ = MemoryAllocator::PageAreaSize(space); |
accounting_stats_.Clear(); |
@@ -1109,8 +1107,6 @@ void PagedSpace::MergeCompactionSpace(CompactionSpace* other) { |
DCHECK(other->top() == nullptr); |
DCHECK(other->limit() == nullptr); |
- DCHECK(other->end_of_unswept_pages_ == nullptr); |
- |
AccountCommitted(other->CommittedMemory()); |
// Move over pages. |
@@ -2851,10 +2847,14 @@ HeapObject* PagedSpace::SlowAllocateRaw(int size_in_bytes) { |
if (object != NULL) return object; |
// If sweeping is still in progress try to sweep pages on the main thread. |
- collector->SweepInParallel(heap()->paged_space(identity()), size_in_bytes); |
+ int max_freed = collector->SweepInParallel( |
+ heap()->paged_space(identity()), size_in_bytes, |
+ kMaxPagesSweptDuringSlowAllocation); |
RefillFreeList(); |
- object = free_list_.Allocate(size_in_bytes); |
- if (object != nullptr) return object; |
+ if (max_freed >= size_in_bytes) { |
+ object = free_list_.Allocate(size_in_bytes); |
+ if (object != nullptr) return object; |
+ } |
} |
// Free list allocation failed and there is no next page. Fail if we have |