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 471 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
482 // whole transitive closure is known. They must be called before sweeping | 482 // whole transitive closure is known. They must be called before sweeping |
483 // when mark bits are still intact. | 483 // when mark bits are still intact. |
484 bool IsSlotInBlackObject(Page* p, Address slot, HeapObject** out_object); | 484 bool IsSlotInBlackObject(Page* p, Address slot, HeapObject** out_object); |
485 HeapObject* FindBlackObjectBySlotSlow(Address slot); | 485 HeapObject* FindBlackObjectBySlotSlow(Address slot); |
486 bool IsSlotInLiveObject(Address slot); | 486 bool IsSlotInLiveObject(Address slot); |
487 | 487 |
488 // Removes all the slots in the slot buffers that are within the given | 488 // Removes all the slots in the slot buffers that are within the given |
489 // address range. | 489 // address range. |
490 void RemoveObjectSlots(Address start_slot, Address end_slot); | 490 void RemoveObjectSlots(Address start_slot, Address end_slot); |
491 | 491 |
492 // | 492 base::Mutex* swept_pages_mutex() { return &swept_pages_mutex_; } |
493 // Free lists filled by sweeper and consumed by corresponding spaces | 493 List<Page*>* swept_pages(AllocationSpace id) { |
494 // (including compaction spaces). | 494 switch (id) { |
495 // | 495 case OLD_SPACE: |
496 base::SmartPointer<FreeList>& free_list_old_space() { | 496 return &swept_old_space_pages_; |
497 return free_list_old_space_; | 497 case CODE_SPACE: |
498 } | 498 return &swept_code_space_pages_; |
499 base::SmartPointer<FreeList>& free_list_code_space() { | 499 case MAP_SPACE: |
500 return free_list_code_space_; | 500 return &swept_map_space_pages_; |
501 } | 501 default: |
502 base::SmartPointer<FreeList>& free_list_map_space() { | 502 UNREACHABLE(); |
503 return free_list_map_space_; | 503 } |
| 504 return nullptr; |
504 } | 505 } |
505 | 506 |
506 private: | 507 private: |
507 class CompactionTask; | 508 class CompactionTask; |
508 class EvacuateNewSpaceVisitor; | 509 class EvacuateNewSpaceVisitor; |
509 class EvacuateOldSpaceVisitor; | 510 class EvacuateOldSpaceVisitor; |
510 class EvacuateVisitorBase; | 511 class EvacuateVisitorBase; |
511 class Evacuator; | 512 class Evacuator; |
512 class HeapObjectVisitor; | 513 class HeapObjectVisitor; |
513 class SweeperTask; | 514 class SweeperTask; |
(...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
748 Heap* heap_; | 749 Heap* heap_; |
749 base::VirtualMemory* marking_deque_memory_; | 750 base::VirtualMemory* marking_deque_memory_; |
750 size_t marking_deque_memory_committed_; | 751 size_t marking_deque_memory_committed_; |
751 MarkingDeque marking_deque_; | 752 MarkingDeque marking_deque_; |
752 CodeFlusher* code_flusher_; | 753 CodeFlusher* code_flusher_; |
753 bool have_code_to_deoptimize_; | 754 bool have_code_to_deoptimize_; |
754 | 755 |
755 List<Page*> evacuation_candidates_; | 756 List<Page*> evacuation_candidates_; |
756 List<NewSpacePage*> newspace_evacuation_candidates_; | 757 List<NewSpacePage*> newspace_evacuation_candidates_; |
757 | 758 |
758 base::SmartPointer<FreeList> free_list_old_space_; | 759 base::Mutex swept_pages_mutex_; |
759 base::SmartPointer<FreeList> free_list_code_space_; | 760 List<Page*> swept_old_space_pages_; |
760 base::SmartPointer<FreeList> free_list_map_space_; | 761 List<Page*> swept_code_space_pages_; |
| 762 List<Page*> swept_map_space_pages_; |
761 | 763 |
762 SweepingList sweeping_list_old_space_; | 764 SweepingList sweeping_list_old_space_; |
763 SweepingList sweeping_list_code_space_; | 765 SweepingList sweeping_list_code_space_; |
764 SweepingList sweeping_list_map_space_; | 766 SweepingList sweeping_list_map_space_; |
765 | 767 |
766 // True if we are collecting slots to perform evacuation from evacuation | 768 // True if we are collecting slots to perform evacuation from evacuation |
767 // candidates. | 769 // candidates. |
768 bool compacting_; | 770 bool compacting_; |
769 | 771 |
770 // True if concurrent or parallel sweeping is currently in progress. | 772 // True if concurrent or parallel sweeping is currently in progress. |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
865 private: | 867 private: |
866 MarkCompactCollector* collector_; | 868 MarkCompactCollector* collector_; |
867 }; | 869 }; |
868 | 870 |
869 | 871 |
870 const char* AllocationSpaceName(AllocationSpace space); | 872 const char* AllocationSpaceName(AllocationSpace space); |
871 } // namespace internal | 873 } // namespace internal |
872 } // namespace v8 | 874 } // namespace v8 |
873 | 875 |
874 #endif // V8_HEAP_MARK_COMPACT_H_ | 876 #endif // V8_HEAP_MARK_COMPACT_H_ |
OLD | NEW |