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

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

Issue 1040443002: MarkBit cleanup: They have to be accessed through Marking accessors. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 8 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 "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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 } 43 }
44 44
45 // Black markbits: 10 - this is required by the sweeper. 45 // Black markbits: 10 - this is required by the sweeper.
46 static const char* kBlackBitPattern; 46 static const char* kBlackBitPattern;
47 INLINE(static bool IsBlack(MarkBit mark_bit)) { 47 INLINE(static bool IsBlack(MarkBit mark_bit)) {
48 return mark_bit.Get() && !mark_bit.Next().Get(); 48 return mark_bit.Get() && !mark_bit.Next().Get();
49 } 49 }
50 50
51 // White markbits: 00 - this is required by the mark bit clearer. 51 // White markbits: 00 - this is required by the mark bit clearer.
52 static const char* kWhiteBitPattern; 52 static const char* kWhiteBitPattern;
53 INLINE(static bool IsWhite(MarkBit mark_bit)) { return !mark_bit.Get(); } 53 INLINE(static bool IsWhite(MarkBit mark_bit)) {
54 DCHECK(!IsImpossible(mark_bit));
55 return !mark_bit.Get();
56 }
54 57
55 // Grey markbits: 11 58 // Grey markbits: 11
56 static const char* kGreyBitPattern; 59 static const char* kGreyBitPattern;
57 INLINE(static bool IsGrey(MarkBit mark_bit)) { 60 INLINE(static bool IsGrey(MarkBit mark_bit)) {
58 return mark_bit.Get() && mark_bit.Next().Get(); 61 return mark_bit.Get() && mark_bit.Next().Get();
59 } 62 }
60 63
64 // IsBlackOrGrey assumes that the first bit is set for black or grey
65 // objects.
66 INLINE(static bool IsBlackOrGrey(MarkBit mark_bit)) { return mark_bit.Get(); }
67
61 INLINE(static void MarkBlack(MarkBit mark_bit)) { 68 INLINE(static void MarkBlack(MarkBit mark_bit)) {
62 mark_bit.Set(); 69 mark_bit.Set();
63 mark_bit.Next().Clear(); 70 mark_bit.Next().Clear();
64 } 71 }
65 72
66 INLINE(static void BlackToGrey(MarkBit markbit)) { markbit.Next().Set(); } 73 INLINE(static void MarkWhite(MarkBit mark_bit)) {
74 mark_bit.Clear();
75 mark_bit.Next().Clear();
76 }
77
78 INLINE(static void BlackToWhite(MarkBit markbit)) {
79 DCHECK(IsBlack(markbit));
80 markbit.Clear();
81 }
82
83 INLINE(static void GreyToWhite(MarkBit markbit)) {
84 DCHECK(IsGrey(markbit));
85 markbit.Clear();
86 markbit.Next().Clear();
87 }
88
89 INLINE(static void BlackToGrey(MarkBit markbit)) {
90 DCHECK(IsBlack(markbit));
91 markbit.Next().Set();
92 }
67 93
68 INLINE(static void WhiteToGrey(MarkBit markbit)) { 94 INLINE(static void WhiteToGrey(MarkBit markbit)) {
95 DCHECK(IsWhite(markbit));
69 markbit.Set(); 96 markbit.Set();
70 markbit.Next().Set(); 97 markbit.Next().Set();
71 } 98 }
72 99
73 INLINE(static void GreyToBlack(MarkBit markbit)) { markbit.Next().Clear(); } 100 INLINE(static void WhiteToBlack(MarkBit markbit)) {
101 DCHECK(IsWhite(markbit));
102 markbit.Set();
103 }
104
105 INLINE(static void GreyToBlack(MarkBit markbit)) {
106 DCHECK(IsGrey(markbit));
107 markbit.Next().Clear();
108 }
74 109
75 INLINE(static void BlackToGrey(HeapObject* obj)) { 110 INLINE(static void BlackToGrey(HeapObject* obj)) {
76 BlackToGrey(MarkBitFrom(obj)); 111 BlackToGrey(MarkBitFrom(obj));
77 } 112 }
78 113
79 INLINE(static void AnyToGrey(MarkBit markbit)) { 114 INLINE(static void AnyToGrey(MarkBit markbit)) {
80 markbit.Set(); 115 markbit.Set();
81 markbit.Next().Set(); 116 markbit.Next().Set();
82 } 117 }
83 118
119 static void SetAllMarkBitsInRange(MarkBit start, MarkBit end);
120 static void ClearAllMarkBitsOfCellsContainedInRange(MarkBit start,
121 MarkBit end);
122
84 void TransferMark(Address old_start, Address new_start); 123 void TransferMark(Address old_start, Address new_start);
85 124
86 #ifdef DEBUG 125 #ifdef DEBUG
87 enum ObjectColor { 126 enum ObjectColor {
88 BLACK_OBJECT, 127 BLACK_OBJECT,
89 WHITE_OBJECT, 128 WHITE_OBJECT,
90 GREY_OBJECT, 129 GREY_OBJECT,
91 IMPOSSIBLE_COLOR 130 IMPOSSIBLE_COLOR
92 }; 131 };
93 132
(...skipping 863 matching lines...) Expand 10 before | Expand all | Expand 10 after
957 private: 996 private:
958 MarkCompactCollector* collector_; 997 MarkCompactCollector* collector_;
959 }; 998 };
960 999
961 1000
962 const char* AllocationSpaceName(AllocationSpace space); 1001 const char* AllocationSpaceName(AllocationSpace space);
963 } 1002 }
964 } // namespace v8::internal 1003 } // namespace v8::internal
965 1004
966 #endif // V8_HEAP_MARK_COMPACT_H_ 1005 #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