OLD | NEW |
1 // Copyright 2016 the V8 project authors. All rights reserved. | 1 // Copyright 2016 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_MARKING_H | 5 #ifndef V8_MARKING_H |
6 #define V8_MARKING_H | 6 #define V8_MARKING_H |
7 | 7 |
8 #include "src/utils.h" | 8 #include "src/utils.h" |
9 | 9 |
10 namespace v8 { | 10 namespace v8 { |
(...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
266 INLINE(static void GreyToBlack(MarkBit markbit)) { | 266 INLINE(static void GreyToBlack(MarkBit markbit)) { |
267 DCHECK(IsGrey(markbit)); | 267 DCHECK(IsGrey(markbit)); |
268 markbit.Next().Set(); | 268 markbit.Next().Set(); |
269 } | 269 } |
270 | 270 |
271 INLINE(static void AnyToGrey(MarkBit markbit)) { | 271 INLINE(static void AnyToGrey(MarkBit markbit)) { |
272 markbit.Set(); | 272 markbit.Set(); |
273 markbit.Next().Clear(); | 273 markbit.Next().Clear(); |
274 } | 274 } |
275 | 275 |
276 #ifdef DEBUG | |
277 enum ObjectColor { | 276 enum ObjectColor { |
278 BLACK_OBJECT, | 277 BLACK_OBJECT, |
279 WHITE_OBJECT, | 278 WHITE_OBJECT, |
280 GREY_OBJECT, | 279 GREY_OBJECT, |
281 IMPOSSIBLE_COLOR | 280 IMPOSSIBLE_COLOR |
282 }; | 281 }; |
283 | 282 |
284 static const char* ColorName(ObjectColor color) { | 283 static const char* ColorName(ObjectColor color) { |
285 switch (color) { | 284 switch (color) { |
286 case BLACK_OBJECT: | 285 case BLACK_OBJECT: |
287 return "black"; | 286 return "black"; |
288 case WHITE_OBJECT: | 287 case WHITE_OBJECT: |
289 return "white"; | 288 return "white"; |
290 case GREY_OBJECT: | 289 case GREY_OBJECT: |
291 return "grey"; | 290 return "grey"; |
292 case IMPOSSIBLE_COLOR: | 291 case IMPOSSIBLE_COLOR: |
293 return "impossible"; | 292 return "impossible"; |
294 } | 293 } |
295 return "error"; | 294 return "error"; |
296 } | 295 } |
297 | 296 |
298 static ObjectColor Color(MarkBit mark_bit) { | 297 static ObjectColor Color(MarkBit mark_bit) { |
299 if (IsBlack(mark_bit)) return BLACK_OBJECT; | 298 if (IsBlack(mark_bit)) return BLACK_OBJECT; |
300 if (IsWhite(mark_bit)) return WHITE_OBJECT; | 299 if (IsWhite(mark_bit)) return WHITE_OBJECT; |
301 if (IsGrey(mark_bit)) return GREY_OBJECT; | 300 if (IsGrey(mark_bit)) return GREY_OBJECT; |
302 UNREACHABLE(); | 301 UNREACHABLE(); |
303 return IMPOSSIBLE_COLOR; | 302 return IMPOSSIBLE_COLOR; |
304 } | 303 } |
305 #endif | |
306 | 304 |
307 private: | 305 private: |
308 DISALLOW_IMPLICIT_CONSTRUCTORS(Marking); | 306 DISALLOW_IMPLICIT_CONSTRUCTORS(Marking); |
309 }; | 307 }; |
310 | 308 |
311 } // namespace internal | 309 } // namespace internal |
312 } // namespace v8 | 310 } // namespace v8 |
313 | 311 |
314 #endif // V8_MARKING_H_ | 312 #endif // V8_MARKING_H_ |
OLD | NEW |