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 762 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
773 } | 773 } |
774 | 774 |
775 | 775 |
776 void Page::ResetFreeListStatistics() { | 776 void Page::ResetFreeListStatistics() { |
777 wasted_memory_ = 0; | 777 wasted_memory_ = 0; |
778 available_in_free_list_ = 0; | 778 available_in_free_list_ = 0; |
779 } | 779 } |
780 | 780 |
781 size_t Page::AvailableInFreeList() { | 781 size_t Page::AvailableInFreeList() { |
782 size_t sum = 0; | 782 size_t sum = 0; |
783 ForAllFreeListCategories([this, &sum](FreeListCategory* category) { | 783 ForAllFreeListCategories([&sum](FreeListCategory* category) { |
784 sum += category->available(); | 784 sum += category->available(); |
785 }); | 785 }); |
786 return sum; | 786 return sum; |
787 } | 787 } |
788 | 788 |
789 size_t Page::ShrinkToHighWaterMark() { | 789 size_t Page::ShrinkToHighWaterMark() { |
790 // Shrink pages to high water mark. The water mark points either to a filler | 790 // Shrink pages to high water mark. The water mark points either to a filler |
791 // or the area_end. | 791 // or the area_end. |
792 HeapObject* filler = HeapObject::FromAddress(HighWaterMark()); | 792 HeapObject* filler = HeapObject::FromAddress(HighWaterMark()); |
793 if (filler->address() == area_end()) return 0; | 793 if (filler->address() == area_end()) return 0; |
(...skipping 1835 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2629 owner_->SetAllocationInfo(new_node->address() + size_in_bytes, | 2629 owner_->SetAllocationInfo(new_node->address() + size_in_bytes, |
2630 new_node->address() + new_node_size); | 2630 new_node->address() + new_node_size); |
2631 } | 2631 } |
2632 | 2632 |
2633 return new_node; | 2633 return new_node; |
2634 } | 2634 } |
2635 | 2635 |
2636 size_t FreeList::EvictFreeListItems(Page* page) { | 2636 size_t FreeList::EvictFreeListItems(Page* page) { |
2637 size_t sum = 0; | 2637 size_t sum = 0; |
2638 page->ForAllFreeListCategories( | 2638 page->ForAllFreeListCategories( |
2639 [this, &sum, page](FreeListCategory* category) { | 2639 [this, &sum](FreeListCategory* category) { |
2640 DCHECK_EQ(this, category->owner()); | 2640 DCHECK_EQ(this, category->owner()); |
2641 sum += category->available(); | 2641 sum += category->available(); |
2642 RemoveCategory(category); | 2642 RemoveCategory(category); |
2643 category->Invalidate(); | 2643 category->Invalidate(); |
2644 }); | 2644 }); |
2645 return sum; | 2645 return sum; |
2646 } | 2646 } |
2647 | 2647 |
2648 bool FreeList::ContainsPageFreeListItems(Page* page) { | 2648 bool FreeList::ContainsPageFreeListItems(Page* page) { |
2649 bool contained = false; | 2649 bool contained = false; |
(...skipping 579 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3229 object->ShortPrint(); | 3229 object->ShortPrint(); |
3230 PrintF("\n"); | 3230 PrintF("\n"); |
3231 } | 3231 } |
3232 printf(" --------------------------------------\n"); | 3232 printf(" --------------------------------------\n"); |
3233 printf(" Marked: %x, LiveCount: %x\n", mark_size, LiveBytes()); | 3233 printf(" Marked: %x, LiveCount: %x\n", mark_size, LiveBytes()); |
3234 } | 3234 } |
3235 | 3235 |
3236 #endif // DEBUG | 3236 #endif // DEBUG |
3237 } // namespace internal | 3237 } // namespace internal |
3238 } // namespace v8 | 3238 } // namespace v8 |
OLD | NEW |