| Index: src/heap/spaces.cc
|
| diff --git a/src/heap/spaces.cc b/src/heap/spaces.cc
|
| index 90d252abb592a46a051864883c30c6bd44b436b3..cdf1a193b60295099d38b111f09ebba3f550a9f8 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.
|
| @@ -2837,6 +2833,8 @@ HeapObject* CompactionSpace::SweepAndRetryAllocation(int size_in_bytes) {
|
|
|
|
|
| HeapObject* PagedSpace::SlowAllocateRaw(int size_in_bytes) {
|
| + const int kMaxPagesToSweep = 1;
|
| +
|
| // Allocation in this space has failed.
|
|
|
| MarkCompactCollector* collector = heap()->mark_compact_collector();
|
| @@ -2851,10 +2849,13 @@ 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, kMaxPagesToSweep);
|
| 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
|
|
|