| OLD | NEW |
| 1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "src/heap/spaces.h" | 5 #include "src/heap/spaces.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "src/base/bits.h" | 9 #include "src/base/bits.h" |
| 10 #include "src/base/platform/platform.h" | 10 #include "src/base/platform/platform.h" |
| (...skipping 2781 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2792 size_t size = page->wasted_memory(); | 2792 size_t size = page->wasted_memory(); |
| 2793 if (size == 0) continue; | 2793 if (size == 0) continue; |
| 2794 DCHECK_GE(static_cast<size_t>(Page::kPageSize), size); | 2794 DCHECK_GE(static_cast<size_t>(Page::kPageSize), size); |
| 2795 Address address = page->OffsetToAddress(Page::kPageSize - size); | 2795 Address address = page->OffsetToAddress(Page::kPageSize - size); |
| 2796 heap()->CreateFillerObjectAt(address, static_cast<int>(size), | 2796 heap()->CreateFillerObjectAt(address, static_cast<int>(size), |
| 2797 ClearRecordedSlots::kNo); | 2797 ClearRecordedSlots::kNo); |
| 2798 } | 2798 } |
| 2799 } | 2799 } |
| 2800 | 2800 |
| 2801 | 2801 |
| 2802 void PagedSpace::EvictEvacuationCandidatesFromLinearAllocationArea() { | |
| 2803 if (allocation_info_.top() >= allocation_info_.limit()) return; | |
| 2804 | |
| 2805 if (!Page::FromAllocationAreaAddress(allocation_info_.top())->CanAllocate()) { | |
| 2806 // Create filler object to keep page iterable if it was iterable. | |
| 2807 int remaining = | |
| 2808 static_cast<int>(allocation_info_.limit() - allocation_info_.top()); | |
| 2809 heap()->CreateFillerObjectAt(allocation_info_.top(), remaining, | |
| 2810 ClearRecordedSlots::kNo); | |
| 2811 allocation_info_.Reset(nullptr, nullptr); | |
| 2812 } | |
| 2813 } | |
| 2814 | |
| 2815 | |
| 2816 HeapObject* PagedSpace::SweepAndRetryAllocation(int size_in_bytes) { | 2802 HeapObject* PagedSpace::SweepAndRetryAllocation(int size_in_bytes) { |
| 2817 MarkCompactCollector* collector = heap()->mark_compact_collector(); | 2803 MarkCompactCollector* collector = heap()->mark_compact_collector(); |
| 2818 if (collector->sweeping_in_progress()) { | 2804 if (collector->sweeping_in_progress()) { |
| 2819 // Wait for the sweeper threads here and complete the sweeping phase. | 2805 // Wait for the sweeper threads here and complete the sweeping phase. |
| 2820 collector->EnsureSweepingCompleted(); | 2806 collector->EnsureSweepingCompleted(); |
| 2821 | 2807 |
| 2822 // After waiting for the sweeper threads, there may be new free-list | 2808 // After waiting for the sweeper threads, there may be new free-list |
| 2823 // entries. | 2809 // entries. |
| 2824 return free_list_.Allocate(size_in_bytes); | 2810 return free_list_.Allocate(size_in_bytes); |
| 2825 } | 2811 } |
| (...skipping 419 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3245 object->ShortPrint(); | 3231 object->ShortPrint(); |
| 3246 PrintF("\n"); | 3232 PrintF("\n"); |
| 3247 } | 3233 } |
| 3248 printf(" --------------------------------------\n"); | 3234 printf(" --------------------------------------\n"); |
| 3249 printf(" Marked: %x, LiveCount: %x\n", mark_size, LiveBytes()); | 3235 printf(" Marked: %x, LiveCount: %x\n", mark_size, LiveBytes()); |
| 3250 } | 3236 } |
| 3251 | 3237 |
| 3252 #endif // DEBUG | 3238 #endif // DEBUG |
| 3253 } // namespace internal | 3239 } // namespace internal |
| 3254 } // namespace v8 | 3240 } // namespace v8 |
| OLD | NEW |