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 <deque> | 8 #include <deque> |
9 | 9 |
10 #include "src/base/bits.h" | 10 #include "src/base/bits.h" |
(...skipping 610 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
621 | 621 |
622 EmbedderHeapTracer* embedder_heap_tracer() { return embedder_heap_tracer_; } | 622 EmbedderHeapTracer* embedder_heap_tracer() { return embedder_heap_tracer_; } |
623 | 623 |
624 bool UsingEmbedderHeapTracer() { return embedder_heap_tracer(); } | 624 bool UsingEmbedderHeapTracer() { return embedder_heap_tracer(); } |
625 | 625 |
626 void TracePossibleWrapper(JSObject* js_object); | 626 void TracePossibleWrapper(JSObject* js_object); |
627 | 627 |
628 void RegisterExternallyReferencedObject(Object** object); | 628 void RegisterExternallyReferencedObject(Object** object); |
629 | 629 |
630 private: | 630 private: |
631 class EvacuateNewSpacePageVisitor; | |
632 class EvacuateNewSpaceVisitor; | 631 class EvacuateNewSpaceVisitor; |
633 class EvacuateOldSpaceVisitor; | 632 class EvacuateOldSpaceVisitor; |
634 class EvacuateRecordOnlyVisitor; | 633 class EvacuateRecordOnlyVisitor; |
635 class EvacuateVisitorBase; | 634 class EvacuateVisitorBase; |
636 class HeapObjectVisitor; | 635 class HeapObjectVisitor; |
637 | 636 |
| 637 typedef std::vector<Page*> SweepingList; |
| 638 |
638 explicit MarkCompactCollector(Heap* heap); | 639 explicit MarkCompactCollector(Heap* heap); |
639 | 640 |
640 bool WillBeDeoptimized(Code* code); | 641 bool WillBeDeoptimized(Code* code); |
641 void ClearInvalidRememberedSetSlots(); | 642 void ClearInvalidRememberedSetSlots(); |
642 | 643 |
643 void ComputeEvacuationHeuristics(int area_size, | 644 void ComputeEvacuationHeuristics(int area_size, |
644 int* target_fragmentation_percent, | 645 int* target_fragmentation_percent, |
645 int* max_evacuated_bytes); | 646 int* max_evacuated_bytes); |
646 | 647 |
647 #ifdef DEBUG | 648 #ifdef DEBUG |
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
820 | 821 |
821 // The number of parallel compaction tasks, including the main thread. | 822 // The number of parallel compaction tasks, including the main thread. |
822 int NumberOfParallelCompactionTasks(int pages, intptr_t live_bytes); | 823 int NumberOfParallelCompactionTasks(int pages, intptr_t live_bytes); |
823 | 824 |
824 void EvacuateNewSpaceAndCandidates(); | 825 void EvacuateNewSpaceAndCandidates(); |
825 | 826 |
826 void UpdatePointersAfterEvacuation(); | 827 void UpdatePointersAfterEvacuation(); |
827 | 828 |
828 // Iterates through all live objects on a page using marking information. | 829 // Iterates through all live objects on a page using marking information. |
829 // Returns whether all objects have successfully been visited. | 830 // Returns whether all objects have successfully been visited. |
830 template <class Visitor> | 831 bool VisitLiveObjects(MemoryChunk* page, HeapObjectVisitor* visitor, |
831 bool VisitLiveObjects(MemoryChunk* page, Visitor* visitor, | |
832 IterationMode mode); | 832 IterationMode mode); |
833 | 833 |
834 void VisitLiveObjectsBody(Page* page, ObjectVisitor* visitor); | 834 void VisitLiveObjectsBody(Page* page, ObjectVisitor* visitor); |
835 | 835 |
836 void RecomputeLiveBytes(MemoryChunk* page); | 836 void RecomputeLiveBytes(MemoryChunk* page); |
837 | 837 |
838 void ReleaseEvacuationCandidates(); | 838 void ReleaseEvacuationCandidates(); |
839 | 839 |
840 // Starts sweeping of a space by contributing on the main thread and setting | 840 // Starts sweeping of a space by contributing on the main thread and setting |
841 // up other pages for sweeping. | 841 // up other pages for sweeping. |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
892 private: | 892 private: |
893 MarkCompactCollector* collector_; | 893 MarkCompactCollector* collector_; |
894 }; | 894 }; |
895 | 895 |
896 | 896 |
897 const char* AllocationSpaceName(AllocationSpace space); | 897 const char* AllocationSpaceName(AllocationSpace space); |
898 } // namespace internal | 898 } // namespace internal |
899 } // namespace v8 | 899 } // namespace v8 |
900 | 900 |
901 #endif // V8_HEAP_MARK_COMPACT_H_ | 901 #endif // V8_HEAP_MARK_COMPACT_H_ |
OLD | NEW |