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

Side by Side Diff: src/incremental-marking.h

Issue 6824078: Move most of the incremental marking write barrier to generated code. (Closed) Base URL: http://v8.googlecode.com/svn/branches/experimental/gc/
Patch Set: '' Created 9 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 | Annotate | Revision Log
OLDNEW
1 // Copyright 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
122 if (!IsStopped()) { 122 if (!IsStopped()) {
123 MarkBit obj_bit = Marking::MarkBitFrom(obj); 123 MarkBit obj_bit = Marking::MarkBitFrom(obj);
124 if (IsBlack(obj_bit)) { 124 if (IsBlack(obj_bit)) {
125 BlackToGreyAndPush(obj, obj_bit); 125 BlackToGreyAndPush(obj, obj_bit);
126 RestartIfNotMarking(); 126 RestartIfNotMarking();
127 } 127 }
128 } 128 }
129 } 129 }
130 130
131 // Impossible markbits: 01 131 // Impossible markbits: 01
132 static const char* kImpossibleBitPattern;
Vyacheslav Egorov (Chromium) 2011/04/16 17:50:36 Why have this strings? They are used only in asser
Erik Corry 2011/04/23 17:00:11 Yes they are for assertions because I suspect we m
132 static inline bool IsImpossible(MarkBit mark_bit) { 133 static inline bool IsImpossible(MarkBit mark_bit) {
134 ASSERT(strcmp(kImpossibleBitPattern, "01") == 0);
133 return !mark_bit.Get() && mark_bit.Next().Get(); 135 return !mark_bit.Get() && mark_bit.Next().Get();
134 } 136 }
135 137
136 // Black markbits: 10 - this is required by the sweeper. 138 // Black markbits: 10 - this is required by the sweeper.
139 static const char* kBlackBitPattern;
137 static inline bool IsBlack(MarkBit mark_bit) { 140 static inline bool IsBlack(MarkBit mark_bit) {
141 ASSERT(strcmp(kBlackBitPattern, "10") == 0);
138 ASSERT(!IsImpossible(mark_bit)); 142 ASSERT(!IsImpossible(mark_bit));
139 return mark_bit.Get() && !mark_bit.Next().Get(); 143 return mark_bit.Get() && !mark_bit.Next().Get();
140 } 144 }
141 145
142 // White markbits: 00 - this is required by the mark bit clearer. 146 // White markbits: 00 - this is required by the mark bit clearer.
147 static const char* kWhiteBitPattern;
143 static inline bool IsWhite(MarkBit mark_bit) { 148 static inline bool IsWhite(MarkBit mark_bit) {
149 ASSERT(strcmp(kWhiteBitPattern, "00") == 0);
144 ASSERT(!IsImpossible(mark_bit)); 150 ASSERT(!IsImpossible(mark_bit));
145 return !mark_bit.Get(); 151 return !mark_bit.Get();
146 } 152 }
147 153
148 // Grey markbits: 11 154 // Grey markbits: 11
155 static const char* kGreyBitPattern;
149 static inline bool IsGrey(MarkBit mark_bit) { 156 static inline bool IsGrey(MarkBit mark_bit) {
157 ASSERT(strcmp(kGreyBitPattern, "11") == 0);
150 ASSERT(!IsImpossible(mark_bit)); 158 ASSERT(!IsImpossible(mark_bit));
151 return mark_bit.Get() && mark_bit.Next().Get(); 159 return mark_bit.Get() && mark_bit.Next().Get();
152 } 160 }
153 161
154 static inline void BlackToGreyAndPush(HeapObject* obj, MarkBit mark_bit) { 162 static inline void BlackToGreyAndPush(HeapObject* obj, MarkBit mark_bit) {
155 ASSERT(Marking::MarkBitFrom(obj) == mark_bit); 163 ASSERT(Marking::MarkBitFrom(obj) == mark_bit);
156 ASSERT(obj->Size() >= 2*kPointerSize); 164 ASSERT(obj->Size() >= 2*kPointerSize);
157 ASSERT(!IsStopped()); 165 ASSERT(!IsStopped());
158 ASSERT(IsBlack(mark_bit)); 166 ASSERT(IsBlack(mark_bit));
159 mark_bit.Next().Set(); 167 mark_bit.Next().Set();
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
240 248
241 static int steps_count_; 249 static int steps_count_;
242 static double steps_took_; 250 static double steps_took_;
243 static bool should_hurry_; 251 static bool should_hurry_;
244 static intptr_t allocation_marking_factor_; 252 static intptr_t allocation_marking_factor_;
245 }; 253 };
246 254
247 } } // namespace v8::internal 255 } } // namespace v8::internal
248 256
249 #endif // V8_INCREMENTAL_MARKING_H_ 257 #endif // V8_INCREMENTAL_MARKING_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698