OLD | NEW |
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 17 matching lines...) Expand all Loading... |
28 #ifndef V8_INCREMENTAL_MARKING_INL_H_ | 28 #ifndef V8_INCREMENTAL_MARKING_INL_H_ |
29 #define V8_INCREMENTAL_MARKING_INL_H_ | 29 #define V8_INCREMENTAL_MARKING_INL_H_ |
30 | 30 |
31 #include "incremental-marking.h" | 31 #include "incremental-marking.h" |
32 | 32 |
33 namespace v8 { | 33 namespace v8 { |
34 namespace internal { | 34 namespace internal { |
35 | 35 |
36 | 36 |
37 void IncrementalMarking::RecordWrite(HeapObject* obj, Object* value) { | 37 void IncrementalMarking::RecordWrite(HeapObject* obj, Object* value) { |
38 if (!IsStopped() && value->IsHeapObject()) { | 38 if (IsMarking() && value->IsHeapObject()) { |
39 MarkBit value_bit = heap_->marking()->MarkBitFrom(HeapObject::cast(value)); | 39 MarkBit value_bit = heap_->marking()->MarkBitFrom(HeapObject::cast(value)); |
40 if (IsWhite(value_bit)) { | 40 if (IsWhite(value_bit)) { |
41 MarkBit obj_bit = heap_->marking()->MarkBitFrom(obj); | 41 MarkBit obj_bit = heap_->marking()->MarkBitFrom(obj); |
42 if (IsBlack(obj_bit)) { | 42 if (IsBlack(obj_bit)) { |
43 BlackToGreyAndUnshift(obj, obj_bit); | 43 BlackToGreyAndUnshift(obj, obj_bit); |
44 RestartIfNotMarking(); | 44 RestartIfNotMarking(); |
45 } | 45 } |
46 } | 46 } |
47 } | 47 } |
48 } | 48 } |
49 | 49 |
50 | 50 |
51 void IncrementalMarking::RecordWriteOf(HeapObject* value) { | 51 void IncrementalMarking::RecordWriteOf(HeapObject* value) { |
52 if (state_ != STOPPED) { | 52 if (IsMarking()) { |
53 MarkBit value_bit = heap_->marking()->MarkBitFrom(value); | 53 MarkBit value_bit = heap_->marking()->MarkBitFrom(value); |
54 if (IsWhite(value_bit)) { | 54 if (IsWhite(value_bit)) { |
55 WhiteToGreyAndPush(value, value_bit); | 55 WhiteToGreyAndPush(value, value_bit); |
56 RestartIfNotMarking(); | 56 RestartIfNotMarking(); |
57 } | 57 } |
58 } | 58 } |
59 } | 59 } |
60 | 60 |
61 | 61 |
62 void IncrementalMarking::RecordWrites(HeapObject* obj) { | 62 void IncrementalMarking::RecordWrites(HeapObject* obj) { |
63 if (!IsStopped()) { | 63 if (IsMarking()) { |
64 MarkBit obj_bit = heap_->marking()->MarkBitFrom(obj); | 64 MarkBit obj_bit = heap_->marking()->MarkBitFrom(obj); |
65 if (IsBlack(obj_bit)) { | 65 if (IsBlack(obj_bit)) { |
66 BlackToGreyAndUnshift(obj, obj_bit); | 66 BlackToGreyAndUnshift(obj, obj_bit); |
67 RestartIfNotMarking(); | 67 RestartIfNotMarking(); |
68 } | 68 } |
69 } | 69 } |
70 } | 70 } |
71 | 71 |
72 | 72 |
73 void IncrementalMarking::BlackToGreyAndUnshift(HeapObject* obj, | 73 void IncrementalMarking::BlackToGreyAndUnshift(HeapObject* obj, |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
108 if (IsWhite(mark_bit)) return WHITE_OBJECT; | 108 if (IsWhite(mark_bit)) return WHITE_OBJECT; |
109 if (IsGrey(mark_bit)) return GREY_OBJECT; | 109 if (IsGrey(mark_bit)) return GREY_OBJECT; |
110 UNREACHABLE(); | 110 UNREACHABLE(); |
111 return IMPOSSIBLE_COLOR; | 111 return IMPOSSIBLE_COLOR; |
112 } | 112 } |
113 | 113 |
114 | 114 |
115 } } // namespace v8::internal | 115 } } // namespace v8::internal |
116 | 116 |
117 #endif // V8_INCREMENTAL_MARKING_INL_H_ | 117 #endif // V8_INCREMENTAL_MARKING_INL_H_ |
OLD | NEW |