| 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 559 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 570 case CODE_SPACE: | 570 case CODE_SPACE: |
| 571 return &swept_code_space_pages_; | 571 return &swept_code_space_pages_; |
| 572 case MAP_SPACE: | 572 case MAP_SPACE: |
| 573 return &swept_map_space_pages_; | 573 return &swept_map_space_pages_; |
| 574 default: | 574 default: |
| 575 UNREACHABLE(); | 575 UNREACHABLE(); |
| 576 } | 576 } |
| 577 return nullptr; | 577 return nullptr; |
| 578 } | 578 } |
| 579 | 579 |
| 580 std::vector<std::pair<void*, void*>>& wrappers_to_trace() { |
| 581 return wrappers_to_trace_; |
| 582 } |
| 583 |
| 584 void SetEmbedderHeapTracer(EmbedderHeapTracer* tracer); |
| 585 |
| 586 EmbedderHeapTracer* embedder_heap_tracer() { return embedder_heap_tracer_; } |
| 587 |
| 588 bool UsingEmbedderHeapTracer() { return embedder_heap_tracer(); } |
| 589 |
| 580 private: | 590 private: |
| 581 class EvacuateNewSpaceVisitor; | 591 class EvacuateNewSpaceVisitor; |
| 582 class EvacuateOldSpaceVisitor; | 592 class EvacuateOldSpaceVisitor; |
| 583 class EvacuateVisitorBase; | 593 class EvacuateVisitorBase; |
| 584 class HeapObjectVisitor; | 594 class HeapObjectVisitor; |
| 585 class SweeperTask; | 595 class SweeperTask; |
| 586 | 596 |
| 587 typedef std::vector<Page*> SweepingList; | 597 typedef std::vector<Page*> SweepingList; |
| 588 | 598 |
| 589 explicit MarkCompactCollector(Heap* heap); | 599 explicit MarkCompactCollector(Heap* heap); |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 671 void MarkStringTable(RootMarkingVisitor* visitor); | 681 void MarkStringTable(RootMarkingVisitor* visitor); |
| 672 | 682 |
| 673 // Mark objects reachable (transitively) from objects in the marking stack | 683 // Mark objects reachable (transitively) from objects in the marking stack |
| 674 // or overflowed in the heap. | 684 // or overflowed in the heap. |
| 675 void ProcessMarkingDeque(); | 685 void ProcessMarkingDeque(); |
| 676 | 686 |
| 677 // Mark objects reachable (transitively) from objects in the marking stack | 687 // Mark objects reachable (transitively) from objects in the marking stack |
| 678 // or overflowed in the heap. This respects references only considered in | 688 // or overflowed in the heap. This respects references only considered in |
| 679 // the final atomic marking pause including the following: | 689 // the final atomic marking pause including the following: |
| 680 // - Processing of objects reachable through Harmony WeakMaps. | 690 // - Processing of objects reachable through Harmony WeakMaps. |
| 681 // - Objects reachable due to host application logic like object groups | 691 // - Objects reachable due to host application logic like object groups, |
| 682 // or implicit references' groups. | 692 // implicit references' groups, or embedder heap tracing. |
| 683 void ProcessEphemeralMarking(ObjectVisitor* visitor, | 693 void ProcessEphemeralMarking(ObjectVisitor* visitor, |
| 684 bool only_process_harmony_weak_collections); | 694 bool only_process_harmony_weak_collections); |
| 685 | 695 |
| 686 // If the call-site of the top optimized code was not prepared for | 696 // If the call-site of the top optimized code was not prepared for |
| 687 // deoptimization, then treat the maps in the code as strong pointers, | 697 // deoptimization, then treat the maps in the code as strong pointers, |
| 688 // otherwise a map can die and deoptimize the code. | 698 // otherwise a map can die and deoptimize the code. |
| 689 void ProcessTopOptimizedFrame(ObjectVisitor* visitor); | 699 void ProcessTopOptimizedFrame(ObjectVisitor* visitor); |
| 690 | 700 |
| 691 // Collects a list of dependent code from maps embedded in optimize code. | 701 // Collects a list of dependent code from maps embedded in optimize code. |
| 692 DependentCode* DependentCodeListFromNonLiveMaps(); | 702 DependentCode* DependentCodeListFromNonLiveMaps(); |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 806 static void VisitObject(HeapObject* obj); | 816 static void VisitObject(HeapObject* obj); |
| 807 | 817 |
| 808 friend class UnmarkObjectVisitor; | 818 friend class UnmarkObjectVisitor; |
| 809 static void UnmarkObject(HeapObject* obj); | 819 static void UnmarkObject(HeapObject* obj); |
| 810 #endif | 820 #endif |
| 811 | 821 |
| 812 Heap* heap_; | 822 Heap* heap_; |
| 813 base::VirtualMemory* marking_deque_memory_; | 823 base::VirtualMemory* marking_deque_memory_; |
| 814 size_t marking_deque_memory_committed_; | 824 size_t marking_deque_memory_committed_; |
| 815 MarkingDeque marking_deque_; | 825 MarkingDeque marking_deque_; |
| 826 std::vector<std::pair<void*, void*>> wrappers_to_trace_; |
| 827 |
| 816 CodeFlusher* code_flusher_; | 828 CodeFlusher* code_flusher_; |
| 829 |
| 830 EmbedderHeapTracer* embedder_heap_tracer_; |
| 831 |
| 817 bool have_code_to_deoptimize_; | 832 bool have_code_to_deoptimize_; |
| 818 | 833 |
| 819 List<Page*> evacuation_candidates_; | 834 List<Page*> evacuation_candidates_; |
| 820 List<NewSpacePage*> newspace_evacuation_candidates_; | 835 List<NewSpacePage*> newspace_evacuation_candidates_; |
| 821 | 836 |
| 822 base::Mutex swept_pages_mutex_; | 837 base::Mutex swept_pages_mutex_; |
| 823 List<Page*> swept_old_space_pages_; | 838 List<Page*> swept_old_space_pages_; |
| 824 List<Page*> swept_code_space_pages_; | 839 List<Page*> swept_code_space_pages_; |
| 825 List<Page*> swept_map_space_pages_; | 840 List<Page*> swept_map_space_pages_; |
| 826 | 841 |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 860 private: | 875 private: |
| 861 MarkCompactCollector* collector_; | 876 MarkCompactCollector* collector_; |
| 862 }; | 877 }; |
| 863 | 878 |
| 864 | 879 |
| 865 const char* AllocationSpaceName(AllocationSpace space); | 880 const char* AllocationSpaceName(AllocationSpace space); |
| 866 } // namespace internal | 881 } // namespace internal |
| 867 } // namespace v8 | 882 } // namespace v8 |
| 868 | 883 |
| 869 #endif // V8_HEAP_MARK_COMPACT_H_ | 884 #endif // V8_HEAP_MARK_COMPACT_H_ |
| OLD | NEW |