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

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

Issue 2647873002: Revert of [heap] Provide ObjectMarking with marking transitions (Closed)
Patch Set: Created 3 years, 11 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
« no previous file with comments | « src/heap/incremental-marking.cc ('k') | src/heap/mark-compact.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 <deque> 8 #include <deque>
9 9
10 #include "src/base/bits.h" 10 #include "src/base/bits.h"
(...skipping 28 matching lines...) Expand all
39 V8_INLINE static MarkBit MarkBitFrom(HeapObject* obj) { 39 V8_INLINE static MarkBit MarkBitFrom(HeapObject* obj) {
40 const Address address = obj->address(); 40 const Address address = obj->address();
41 MemoryChunk* p = MemoryChunk::FromAddress(address); 41 MemoryChunk* p = MemoryChunk::FromAddress(address);
42 return p->markbits()->MarkBitFromIndex(p->AddressToMarkbitIndex(address)); 42 return p->markbits()->MarkBitFromIndex(p->AddressToMarkbitIndex(address));
43 } 43 }
44 44
45 static Marking::ObjectColor Color(HeapObject* obj) { 45 static Marking::ObjectColor Color(HeapObject* obj) {
46 return Marking::Color(ObjectMarking::MarkBitFrom(obj)); 46 return Marking::Color(ObjectMarking::MarkBitFrom(obj));
47 } 47 }
48 48
49 V8_INLINE static bool IsImpossible(HeapObject* obj) {
50 return Marking::IsImpossible(MarkBitFrom(obj));
51 }
52
53 V8_INLINE static bool IsBlack(HeapObject* obj) {
54 return Marking::IsBlack(MarkBitFrom(obj));
55 }
56
57 V8_INLINE static bool IsWhite(HeapObject* obj) {
58 return Marking::IsWhite(MarkBitFrom(obj));
59 }
60
61 V8_INLINE static bool IsGrey(HeapObject* obj) {
62 return Marking::IsGrey(MarkBitFrom(obj));
63 }
64
65 V8_INLINE static bool IsBlackOrGrey(HeapObject* obj) {
66 return Marking::IsBlackOrGrey(MarkBitFrom(obj));
67 }
68
69 V8_INLINE static void ClearMarkBit(HeapObject* obj) {
70 Marking::MarkWhite(MarkBitFrom(obj));
71 }
72
73 V8_INLINE static void BlackToWhite(HeapObject* obj) {
74 DCHECK(IsBlack(obj));
75 MarkBit markbit = MarkBitFrom(obj);
76 Marking::BlackToWhite(markbit);
77 MemoryChunk::IncrementLiveBytes(obj, -obj->Size());
78 }
79
80 V8_INLINE static void GreyToWhite(HeapObject* obj) {
81 DCHECK(IsGrey(obj));
82 Marking::GreyToWhite(MarkBitFrom(obj));
83 }
84
85 V8_INLINE static void BlackToGrey(HeapObject* obj) {
86 DCHECK(IsBlack(obj));
87 MarkBit markbit = MarkBitFrom(obj);
88 Marking::BlackToGrey(markbit);
89 MemoryChunk::IncrementLiveBytes(obj, -obj->Size());
90 }
91
92 V8_INLINE static void WhiteToGrey(HeapObject* obj) {
93 DCHECK(IsWhite(obj));
94 Marking::WhiteToGrey(MarkBitFrom(obj));
95 }
96
97 V8_INLINE static void WhiteToBlack(HeapObject* obj) {
98 DCHECK(IsWhite(obj));
99 MarkBit markbit = MarkBitFrom(obj);
100 Marking::WhiteToBlack(markbit);
101 MemoryChunk::IncrementLiveBytes(obj, obj->Size());
102 }
103
104 V8_INLINE static void GreyToBlack(HeapObject* obj) {
105 DCHECK(IsGrey(obj));
106 MarkBit markbit = MarkBitFrom(obj);
107 Marking::GreyToBlack(markbit);
108 MemoryChunk::IncrementLiveBytes(obj, obj->Size());
109 }
110
111 V8_INLINE static void AnyToGrey(HeapObject* obj) {
112 MarkBit markbit = MarkBitFrom(obj);
113 if (Marking::IsBlack(markbit)) {
114 MemoryChunk::IncrementLiveBytes(obj, -obj->Size());
115 }
116 Marking::AnyToGrey(markbit);
117 }
118
119 private: 49 private:
120 DISALLOW_IMPLICIT_CONSTRUCTORS(ObjectMarking); 50 DISALLOW_IMPLICIT_CONSTRUCTORS(ObjectMarking);
121 }; 51 };
122 52
123 // ---------------------------------------------------------------------------- 53 // ----------------------------------------------------------------------------
124 // Marking deque for tracing live objects. 54 // Marking deque for tracing live objects.
125 class MarkingDeque { 55 class MarkingDeque {
126 public: 56 public:
127 explicit MarkingDeque(Heap* heap) 57 explicit MarkingDeque(Heap* heap)
128 : backing_store_(nullptr), 58 : backing_store_(nullptr),
(...skipping 529 matching lines...) Expand 10 before | Expand all | Expand 10 after
658 // Unshifts a black object into the marking stack and accounts for live bytes. 588 // Unshifts a black object into the marking stack and accounts for live bytes.
659 // Note that this assumes lives bytes have already been counted. 589 // Note that this assumes lives bytes have already been counted.
660 INLINE(void UnshiftBlack(HeapObject* obj)); 590 INLINE(void UnshiftBlack(HeapObject* obj));
661 591
662 // Marks the object black and pushes it on the marking stack. 592 // Marks the object black and pushes it on the marking stack.
663 // This is for non-incremental marking only. 593 // This is for non-incremental marking only.
664 INLINE(void MarkObject(HeapObject* obj, MarkBit mark_bit)); 594 INLINE(void MarkObject(HeapObject* obj, MarkBit mark_bit));
665 595
666 // Marks the object black assuming that it is not yet marked. 596 // Marks the object black assuming that it is not yet marked.
667 // This is for non-incremental marking only. 597 // This is for non-incremental marking only.
668 INLINE(void SetMark(HeapObject* obj)); 598 INLINE(void SetMark(HeapObject* obj, MarkBit mark_bit));
669 599
670 // Mark the heap roots and all objects reachable from them. 600 // Mark the heap roots and all objects reachable from them.
671 void MarkRoots(RootMarkingVisitor<MarkCompactMode::FULL>* visitor); 601 void MarkRoots(RootMarkingVisitor<MarkCompactMode::FULL>* visitor);
672 602
673 // Mark the string table specially. References to internalized strings from 603 // Mark the string table specially. References to internalized strings from
674 // the string table are weak. 604 // the string table are weak.
675 void MarkStringTable(RootMarkingVisitor<MarkCompactMode::FULL>* visitor); 605 void MarkStringTable(RootMarkingVisitor<MarkCompactMode::FULL>* visitor);
676 606
677 // Mark objects reachable (transitively) from objects in the marking stack 607 // Mark objects reachable (transitively) from objects in the marking stack
678 // or overflowed in the heap. 608 // or overflowed in the heap.
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after
848 778
849 private: 779 private:
850 MarkCompactCollector* collector_; 780 MarkCompactCollector* collector_;
851 }; 781 };
852 782
853 V8_EXPORT_PRIVATE const char* AllocationSpaceName(AllocationSpace space); 783 V8_EXPORT_PRIVATE const char* AllocationSpaceName(AllocationSpace space);
854 } // namespace internal 784 } // namespace internal
855 } // namespace v8 785 } // namespace v8
856 786
857 #endif // V8_HEAP_MARK_COMPACT_H_ 787 #endif // V8_HEAP_MARK_COMPACT_H_
OLDNEW
« no previous file with comments | « src/heap/incremental-marking.cc ('k') | src/heap/mark-compact.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698