Chromium Code Reviews| 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 2821 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2832 // were created with the wrong FreeSpaceMap (normally NULL), so we need to | 2832 // were created with the wrong FreeSpaceMap (normally NULL), so we need to |
| 2833 // fix them. | 2833 // fix them. |
| 2834 void PagedSpace::RepairFreeListsAfterDeserialization() { | 2834 void PagedSpace::RepairFreeListsAfterDeserialization() { |
| 2835 free_list_.RepairLists(heap()); | 2835 free_list_.RepairLists(heap()); |
| 2836 // Each page may have a small free space that is not tracked by a free list. | 2836 // Each page may have a small free space that is not tracked by a free list. |
| 2837 // Update the maps for those free space objects. | 2837 // Update the maps for those free space objects. |
| 2838 for (Page* page : *this) { | 2838 for (Page* page : *this) { |
| 2839 size_t size = page->wasted_memory(); | 2839 size_t size = page->wasted_memory(); |
| 2840 if (size == 0) continue; | 2840 if (size == 0) continue; |
| 2841 DCHECK_GE(static_cast<size_t>(Page::kPageSize), size); | 2841 DCHECK_GE(static_cast<size_t>(Page::kPageSize), size); |
| 2842 Address address = page->OffsetToAddress(Page::kPageSize - size); | 2842 Address address = |
|
Slava Chigrin
2017/04/06 12:30:13
I suppose here was a bug. As described here
https:
ulan
2017/04/06 15:11:27
We can use page->HighWaterMark() and page->area_en
Slava Chigrin
2017/04/06 15:48:34
Done.
| |
| 2843 page->OffsetToAddress((page->executable() == EXECUTABLE | |
| 2844 ? MemoryAllocator::CodePageAreaEndOffset() | |
| 2845 : Page::kPageSize) - | |
| 2846 size); | |
| 2847 | |
| 2843 heap()->CreateFillerObjectAt(address, static_cast<int>(size), | 2848 heap()->CreateFillerObjectAt(address, static_cast<int>(size), |
| 2844 ClearRecordedSlots::kNo); | 2849 ClearRecordedSlots::kNo); |
| 2845 } | 2850 } |
| 2846 } | 2851 } |
| 2847 | 2852 |
| 2848 HeapObject* PagedSpace::SweepAndRetryAllocation(int size_in_bytes) { | 2853 HeapObject* PagedSpace::SweepAndRetryAllocation(int size_in_bytes) { |
| 2849 MarkCompactCollector* collector = heap()->mark_compact_collector(); | 2854 MarkCompactCollector* collector = heap()->mark_compact_collector(); |
| 2850 if (collector->sweeping_in_progress()) { | 2855 if (collector->sweeping_in_progress()) { |
| 2851 // Wait for the sweeper threads here and complete the sweeping phase. | 2856 // Wait for the sweeper threads here and complete the sweeping phase. |
| 2852 collector->EnsureSweepingCompleted(); | 2857 collector->EnsureSweepingCompleted(); |
| (...skipping 441 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3294 PrintF("\n"); | 3299 PrintF("\n"); |
| 3295 } | 3300 } |
| 3296 printf(" --------------------------------------\n"); | 3301 printf(" --------------------------------------\n"); |
| 3297 printf(" Marked: %x, LiveCount: %" V8PRIdPTR "\n", mark_size, | 3302 printf(" Marked: %x, LiveCount: %" V8PRIdPTR "\n", mark_size, |
| 3298 MarkingState::Internal(this).live_bytes()); | 3303 MarkingState::Internal(this).live_bytes()); |
| 3299 } | 3304 } |
| 3300 | 3305 |
| 3301 #endif // DEBUG | 3306 #endif // DEBUG |
| 3302 } // namespace internal | 3307 } // namespace internal |
| 3303 } // namespace v8 | 3308 } // namespace v8 |
| OLD | NEW |