OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 #ifndef V8_HEAP_MARK_COMPACT_H_ | 5 #ifndef V8_HEAP_MARK_COMPACT_H_ |
6 #define V8_HEAP_MARK_COMPACT_H_ | 6 #define V8_HEAP_MARK_COMPACT_H_ |
7 | 7 |
8 #include "src/base/bits.h" | 8 #include "src/base/bits.h" |
9 #include "src/heap/spaces.h" | 9 #include "src/heap/spaces.h" |
10 #include "src/heap/store-buffer.h" | 10 #include "src/heap/store-buffer.h" |
(...skipping 554 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
565 // whole transitive closure is known. They must be called before sweeping | 565 // whole transitive closure is known. They must be called before sweeping |
566 // when mark bits are still intact. | 566 // when mark bits are still intact. |
567 bool IsSlotInBlackObject(Page* p, Address slot, HeapObject** out_object); | 567 bool IsSlotInBlackObject(Page* p, Address slot, HeapObject** out_object); |
568 HeapObject* FindBlackObjectBySlotSlow(Address slot); | 568 HeapObject* FindBlackObjectBySlotSlow(Address slot); |
569 bool IsSlotInLiveObject(Address slot); | 569 bool IsSlotInLiveObject(Address slot); |
570 | 570 |
571 // Removes all the slots in the slot buffers that are within the given | 571 // Removes all the slots in the slot buffers that are within the given |
572 // address range. | 572 // address range. |
573 void RemoveObjectSlots(Address start_slot, Address end_slot); | 573 void RemoveObjectSlots(Address start_slot, Address end_slot); |
574 | 574 |
575 // | 575 base::Mutex* swept_pages_mutex() { return &swept_pages_mutex_; } |
576 // Free lists filled by sweeper and consumed by corresponding spaces | 576 List<Page*>* swept_pages(AllocationSpace id) { |
577 // (including compaction spaces). | 577 switch (id) { |
578 // | 578 case OLD_SPACE: |
579 base::SmartPointer<FreeList>& free_list_old_space() { | 579 return &swept_old_space_pages_; |
580 return free_list_old_space_; | 580 case CODE_SPACE: |
581 } | 581 return &swept_code_space_pages_; |
582 base::SmartPointer<FreeList>& free_list_code_space() { | 582 case MAP_SPACE: |
583 return free_list_code_space_; | 583 return &swept_map_space_pages_; |
584 } | 584 default: |
585 base::SmartPointer<FreeList>& free_list_map_space() { | 585 UNREACHABLE(); |
586 return free_list_map_space_; | 586 } |
| 587 return nullptr; |
587 } | 588 } |
588 | 589 |
589 private: | 590 private: |
590 class EvacuateNewSpaceVisitor; | 591 class EvacuateNewSpaceVisitor; |
591 class EvacuateOldSpaceVisitor; | 592 class EvacuateOldSpaceVisitor; |
592 class EvacuateVisitorBase; | 593 class EvacuateVisitorBase; |
593 class HeapObjectVisitor; | 594 class HeapObjectVisitor; |
594 class SweeperTask; | 595 class SweeperTask; |
595 | 596 |
596 typedef std::vector<Page*> SweepingList; | 597 typedef std::vector<Page*> SweepingList; |
(...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
827 Heap* heap_; | 828 Heap* heap_; |
828 base::VirtualMemory* marking_deque_memory_; | 829 base::VirtualMemory* marking_deque_memory_; |
829 size_t marking_deque_memory_committed_; | 830 size_t marking_deque_memory_committed_; |
830 MarkingDeque marking_deque_; | 831 MarkingDeque marking_deque_; |
831 CodeFlusher* code_flusher_; | 832 CodeFlusher* code_flusher_; |
832 bool have_code_to_deoptimize_; | 833 bool have_code_to_deoptimize_; |
833 | 834 |
834 List<Page*> evacuation_candidates_; | 835 List<Page*> evacuation_candidates_; |
835 List<NewSpacePage*> newspace_evacuation_candidates_; | 836 List<NewSpacePage*> newspace_evacuation_candidates_; |
836 | 837 |
837 base::SmartPointer<FreeList> free_list_old_space_; | 838 base::Mutex swept_pages_mutex_; |
838 base::SmartPointer<FreeList> free_list_code_space_; | 839 List<Page*> swept_old_space_pages_; |
839 base::SmartPointer<FreeList> free_list_map_space_; | 840 List<Page*> swept_code_space_pages_; |
| 841 List<Page*> swept_map_space_pages_; |
840 | 842 |
841 SweepingList sweeping_list_old_space_; | 843 SweepingList sweeping_list_old_space_; |
842 SweepingList sweeping_list_code_space_; | 844 SweepingList sweeping_list_code_space_; |
843 SweepingList sweeping_list_map_space_; | 845 SweepingList sweeping_list_map_space_; |
844 | 846 |
845 // True if we are collecting slots to perform evacuation from evacuation | 847 // True if we are collecting slots to perform evacuation from evacuation |
846 // candidates. | 848 // candidates. |
847 bool compacting_; | 849 bool compacting_; |
848 | 850 |
849 // True if concurrent or parallel sweeping is currently in progress. | 851 // True if concurrent or parallel sweeping is currently in progress. |
(...skipping 24 matching lines...) Expand all Loading... |
874 private: | 876 private: |
875 MarkCompactCollector* collector_; | 877 MarkCompactCollector* collector_; |
876 }; | 878 }; |
877 | 879 |
878 | 880 |
879 const char* AllocationSpaceName(AllocationSpace space); | 881 const char* AllocationSpaceName(AllocationSpace space); |
880 } // namespace internal | 882 } // namespace internal |
881 } // namespace v8 | 883 } // namespace v8 |
882 | 884 |
883 #endif // V8_HEAP_MARK_COMPACT_H_ | 885 #endif // V8_HEAP_MARK_COMPACT_H_ |
OLD | NEW |