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