Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(130)

Side by Side Diff: src/heap/mark-compact.h

Issue 997423002: Use the incremental root marking visitor for overapproximating the weak closure (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: updates Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 10
(...skipping 532 matching lines...) Expand 10 before | Expand all | Expand 10 after
543 543
544 // Determine type of object and emit deletion log event. 544 // Determine type of object and emit deletion log event.
545 static void ReportDeleteIfNeeded(HeapObject* obj, Isolate* isolate); 545 static void ReportDeleteIfNeeded(HeapObject* obj, Isolate* isolate);
546 546
547 // Distinguishable invalid map encodings (for single word and multiple words) 547 // Distinguishable invalid map encodings (for single word and multiple words)
548 // that indicate free regions. 548 // that indicate free regions.
549 static const uint32_t kSingleFreeEncoding = 0; 549 static const uint32_t kSingleFreeEncoding = 0;
550 static const uint32_t kMultiFreeEncoding = 1; 550 static const uint32_t kMultiFreeEncoding = 1;
551 551
552 static inline bool IsMarked(Object* obj); 552 static inline bool IsMarked(Object* obj);
553 static bool IsUnmarkedHeapObjectWithHeap(Heap* heap, Object** p);
553 554
554 inline Heap* heap() const { return heap_; } 555 inline Heap* heap() const { return heap_; }
555 inline Isolate* isolate() const; 556 inline Isolate* isolate() const;
556 557
557 CodeFlusher* code_flusher() { return code_flusher_; } 558 CodeFlusher* code_flusher() { return code_flusher_; }
558 inline bool is_code_flushing_enabled() const { return code_flusher_ != NULL; } 559 inline bool is_code_flushing_enabled() const { return code_flusher_ != NULL; }
559 void EnableCodeFlushing(bool enable); 560 void EnableCodeFlushing(bool enable);
560 561
561 enum SweeperType { 562 enum SweeperType {
562 CONCURRENT_SWEEPING, 563 CONCURRENT_SWEEPING,
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
656 bool sweeping_in_progress() { return sweeping_in_progress_; } 657 bool sweeping_in_progress() { return sweeping_in_progress_; }
657 658
658 void set_evacuation(bool evacuation) { evacuation_ = evacuation; } 659 void set_evacuation(bool evacuation) { evacuation_ = evacuation; }
659 660
660 bool evacuation() const { return evacuation_; } 661 bool evacuation() const { return evacuation_; }
661 662
662 // Special case for processing weak references in a full collection. We need 663 // Special case for processing weak references in a full collection. We need
663 // to artificially keep AllocationSites alive for a time. 664 // to artificially keep AllocationSites alive for a time.
664 void MarkAllocationSite(AllocationSite* site); 665 void MarkAllocationSite(AllocationSite* site);
665 666
667 // Mark objects in implicit references groups if their parent object
668 // is marked.
669 void MarkImplicitRefGroups();
670
666 MarkingDeque* marking_deque() { return &marking_deque_; } 671 MarkingDeque* marking_deque() { return &marking_deque_; }
667 672
668 void EnsureMarkingDequeIsCommittedAndInitialize(); 673 void EnsureMarkingDequeIsCommittedAndInitialize();
669 674
670 void InitializeMarkingDeque(); 675 void InitializeMarkingDeque();
671 676
672 void UncommitMarkingDeque(); 677 void UncommitMarkingDeque();
673 678
674 void OverApproximateWeakClosure();
675
676 // The following four methods can just be called after marking, when the 679 // The following four methods can just be called after marking, when the
677 // whole transitive closure is known. They must be called before sweeping 680 // whole transitive closure is known. They must be called before sweeping
678 // when mark bits are still intact. 681 // when mark bits are still intact.
679 bool IsSlotInBlackObject(Page* p, Address slot); 682 bool IsSlotInBlackObject(Page* p, Address slot);
680 bool IsSlotInBlackObjectSlow(Page* p, Address slot); 683 bool IsSlotInBlackObjectSlow(Page* p, Address slot);
681 bool IsSlotInLiveObject(HeapObject** address, HeapObject* object); 684 bool IsSlotInLiveObject(HeapObject** address, HeapObject* object);
682 void VerifyIsSlotInLiveObject(HeapObject** address, HeapObject* object); 685 void VerifyIsSlotInLiveObject(HeapObject** address, HeapObject* object);
683 686
684 private: 687 private:
685 class SweeperTask; 688 class SweeperTask;
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
769 // This is for non-incremental marking only. 772 // This is for non-incremental marking only.
770 INLINE(void SetMark(HeapObject* obj, MarkBit mark_bit)); 773 INLINE(void SetMark(HeapObject* obj, MarkBit mark_bit));
771 774
772 // Mark the heap roots and all objects reachable from them. 775 // Mark the heap roots and all objects reachable from them.
773 void MarkRoots(RootMarkingVisitor* visitor); 776 void MarkRoots(RootMarkingVisitor* visitor);
774 777
775 // Mark the string table specially. References to internalized strings from 778 // Mark the string table specially. References to internalized strings from
776 // the string table are weak. 779 // the string table are weak.
777 void MarkStringTable(RootMarkingVisitor* visitor); 780 void MarkStringTable(RootMarkingVisitor* visitor);
778 781
779 // Mark objects in implicit references groups if their parent object
780 // is marked.
781 void MarkImplicitRefGroups();
782
783 // Mark objects reachable (transitively) from objects in the marking stack 782 // Mark objects reachable (transitively) from objects in the marking stack
784 // or overflowed in the heap. 783 // or overflowed in the heap.
785 void ProcessMarkingDeque(); 784 void ProcessMarkingDeque();
786 785
787 // Mark objects reachable (transitively) from objects in the marking stack 786 // Mark objects reachable (transitively) from objects in the marking stack
788 // or overflowed in the heap. This respects references only considered in 787 // or overflowed in the heap. This respects references only considered in
789 // the final atomic marking pause including the following: 788 // the final atomic marking pause including the following:
790 // - Processing of objects reachable through Harmony WeakMaps. 789 // - Processing of objects reachable through Harmony WeakMaps.
791 // - Objects reachable due to host application logic like object groups 790 // - Objects reachable due to host application logic like object groups
792 // or implicit references' groups. 791 // or implicit references' groups.
(...skipping 16 matching lines...) Expand all
809 void EmptyMarkingDeque(); 808 void EmptyMarkingDeque();
810 809
811 // Refill the marking stack with overflowed objects from the heap. This 810 // Refill the marking stack with overflowed objects from the heap. This
812 // function either leaves the marking stack full or clears the overflow 811 // function either leaves the marking stack full or clears the overflow
813 // flag on the marking stack. 812 // flag on the marking stack.
814 void RefillMarkingDeque(); 813 void RefillMarkingDeque();
815 814
816 // Callback function for telling whether the object *p is an unmarked 815 // Callback function for telling whether the object *p is an unmarked
817 // heap object. 816 // heap object.
818 static bool IsUnmarkedHeapObject(Object** p); 817 static bool IsUnmarkedHeapObject(Object** p);
819 static bool IsUnmarkedHeapObjectWithHeap(Heap* heap, Object** p);
820 818
821 // Map transitions from a live map to a dead map must be killed. 819 // Map transitions from a live map to a dead map must be killed.
822 // We replace them with a null descriptor, with the same key. 820 // We replace them with a null descriptor, with the same key.
823 void ClearNonLiveReferences(); 821 void ClearNonLiveReferences();
824 void ClearNonLivePrototypeTransitions(Map* map); 822 void ClearNonLivePrototypeTransitions(Map* map);
825 void ClearNonLiveMapTransitions(Map* map, MarkBit map_mark); 823 void ClearNonLiveMapTransitions(Map* map, MarkBit map_mark);
826 void ClearMapTransitions(Map* map, Map* dead_transition); 824 void ClearMapTransitions(Map* map, Map* dead_transition);
827 bool ClearMapBackPointer(Map* map); 825 bool ClearMapBackPointer(Map* map);
828 void TrimDescriptorArray(Map* map, DescriptorArray* descriptors, 826 void TrimDescriptorArray(Map* map, DescriptorArray* descriptors,
829 int number_of_own_descriptors); 827 int number_of_own_descriptors);
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
969 private: 967 private:
970 MarkCompactCollector* collector_; 968 MarkCompactCollector* collector_;
971 }; 969 };
972 970
973 971
974 const char* AllocationSpaceName(AllocationSpace space); 972 const char* AllocationSpaceName(AllocationSpace space);
975 } 973 }
976 } // namespace v8::internal 974 } // namespace v8::internal
977 975
978 #endif // V8_HEAP_MARK_COMPACT_H_ 976 #endif // V8_HEAP_MARK_COMPACT_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698