OLD | NEW |
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_INCREMENTAL_MARKING_H_ | 5 #ifndef V8_HEAP_INCREMENTAL_MARKING_H_ |
6 #define V8_HEAP_INCREMENTAL_MARKING_H_ | 6 #define V8_HEAP_INCREMENTAL_MARKING_H_ |
7 | 7 |
8 #include "src/cancelable-task.h" | 8 #include "src/cancelable-task.h" |
9 #include "src/execution.h" | 9 #include "src/execution.h" |
10 #include "src/heap/heap.h" | 10 #include "src/heap/heap.h" |
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
178 void ClearIdleMarkingDelayCounter(); | 178 void ClearIdleMarkingDelayCounter(); |
179 | 179 |
180 bool IsIdleMarkingDelayCounterLimitReached(); | 180 bool IsIdleMarkingDelayCounterLimitReached(); |
181 | 181 |
182 static void MarkGrey(Heap* heap, HeapObject* object); | 182 static void MarkGrey(Heap* heap, HeapObject* object); |
183 | 183 |
184 static void MarkBlack(HeapObject* object, int size); | 184 static void MarkBlack(HeapObject* object, int size); |
185 | 185 |
186 static void TransferMark(Heap* heap, HeapObject* from, HeapObject* to); | 186 static void TransferMark(Heap* heap, HeapObject* from, HeapObject* to); |
187 | 187 |
188 // Returns true if the color transfer requires live bytes updating. | 188 INLINE(static void TransferColor(HeapObject* from, HeapObject* to, |
189 INLINE(static bool TransferColor(HeapObject* from, HeapObject* to, | |
190 int size)) { | 189 int size)) { |
191 MarkBit from_mark_bit = ObjectMarking::MarkBitFrom(from); | 190 if (ObjectMarking::IsBlack(to)) { |
192 MarkBit to_mark_bit = ObjectMarking::MarkBitFrom(to); | |
193 | |
194 if (Marking::IsBlack(to_mark_bit)) { | |
195 DCHECK(to->GetHeap()->incremental_marking()->black_allocation()); | 191 DCHECK(to->GetHeap()->incremental_marking()->black_allocation()); |
196 return false; | 192 return; |
197 } | 193 } |
198 | 194 |
199 DCHECK(Marking::IsWhite(to_mark_bit)); | 195 DCHECK(ObjectMarking::IsWhite(to)); |
200 if (from_mark_bit.Get()) { | 196 if (ObjectMarking::IsGrey(from)) { |
201 to_mark_bit.Set(); | 197 ObjectMarking::WhiteToGrey(to); |
202 if (from_mark_bit.Next().Get()) { | 198 } else if (ObjectMarking::IsBlack(from)) { |
203 to_mark_bit.Next().Set(); | 199 ObjectMarking::WhiteToBlack(to); |
204 return true; | |
205 } | |
206 } | 200 } |
207 return false; | |
208 } | 201 } |
209 | 202 |
210 void IterateBlackObject(HeapObject* object); | 203 void IterateBlackObject(HeapObject* object); |
211 | 204 |
212 Heap* heap() const { return heap_; } | 205 Heap* heap() const { return heap_; } |
213 | 206 |
214 IncrementalMarkingJob* incremental_marking_job() { | 207 IncrementalMarkingJob* incremental_marking_job() { |
215 return &incremental_marking_job_; | 208 return &incremental_marking_job_; |
216 } | 209 } |
217 | 210 |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
304 IncrementalMarkingJob incremental_marking_job_; | 297 IncrementalMarkingJob incremental_marking_job_; |
305 Observer new_generation_observer_; | 298 Observer new_generation_observer_; |
306 Observer old_generation_observer_; | 299 Observer old_generation_observer_; |
307 | 300 |
308 DISALLOW_IMPLICIT_CONSTRUCTORS(IncrementalMarking); | 301 DISALLOW_IMPLICIT_CONSTRUCTORS(IncrementalMarking); |
309 }; | 302 }; |
310 } // namespace internal | 303 } // namespace internal |
311 } // namespace v8 | 304 } // namespace v8 |
312 | 305 |
313 #endif // V8_HEAP_INCREMENTAL_MARKING_H_ | 306 #endif // V8_HEAP_INCREMENTAL_MARKING_H_ |
OLD | NEW |