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 27 matching lines...) Expand all Loading... |
38 | 38 |
39 MarkingState marking_state(HeapObject* object) const { | 39 MarkingState marking_state(HeapObject* object) const { |
40 return MarkingState::Internal(object); | 40 return MarkingState::Internal(object); |
41 } | 41 } |
42 | 42 |
43 MarkingState marking_state(MemoryChunk* chunk) const { | 43 MarkingState marking_state(MemoryChunk* chunk) const { |
44 return MarkingState::Internal(chunk); | 44 return MarkingState::Internal(chunk); |
45 } | 45 } |
46 | 46 |
47 void MarkBlack(HeapObject* object, int size); | 47 void MarkBlack(HeapObject* object, int size); |
48 void MarkGrey(HeapObject* object); | |
49 | 48 |
50 // Transfers mark bits without requiring proper object headers. | 49 // Transfers mark bits without requiring proper object headers. |
51 void TransferMark(Heap* heap, HeapObject* from, HeapObject* to); | 50 void TransferMark(Heap* heap, HeapObject* from, HeapObject* to); |
52 | 51 |
53 // Transfers color including live byte count, requiring properly set up | 52 // Transfers color including live byte count, requiring properly set up |
54 // objects. | 53 // objects. |
55 template <MarkBit::AccessMode access_mode = MarkBit::NON_ATOMIC> | 54 template <MarkBit::AccessMode access_mode = MarkBit::NON_ATOMIC> |
56 V8_INLINE void TransferColor(HeapObject* from, HeapObject* to) { | 55 V8_INLINE void TransferColor(HeapObject* from, HeapObject* to) { |
57 if (ObjectMarking::IsBlack<access_mode>(to, marking_state(to))) { | 56 if (ObjectMarking::IsBlack<access_mode>(to, marking_state(to))) { |
58 DCHECK(black_allocation()); | 57 DCHECK(black_allocation()); |
59 return; | 58 return; |
60 } | 59 } |
61 | 60 |
62 DCHECK(ObjectMarking::IsWhite<access_mode>(to, marking_state(to))); | 61 DCHECK(ObjectMarking::IsWhite<access_mode>(to, marking_state(to))); |
63 if (ObjectMarking::IsGrey<access_mode>(from, marking_state(from))) { | 62 if (ObjectMarking::IsGrey<access_mode>(from, marking_state(from))) { |
64 ObjectMarking::WhiteToGrey<access_mode>(to, marking_state(to)); | 63 bool success = |
| 64 ObjectMarking::WhiteToGrey<access_mode>(to, marking_state(to)); |
| 65 DCHECK(success); |
| 66 USE(success); |
65 } else if (ObjectMarking::IsBlack<access_mode>(from, marking_state(from))) { | 67 } else if (ObjectMarking::IsBlack<access_mode>(from, marking_state(from))) { |
66 ObjectMarking::WhiteToBlack<access_mode>(to, marking_state(to)); | 68 bool success = |
| 69 ObjectMarking::WhiteToBlack<access_mode>(to, marking_state(to)); |
| 70 DCHECK(success); |
| 71 USE(success); |
67 } | 72 } |
68 } | 73 } |
69 | 74 |
70 | 75 |
71 State state() { | 76 State state() { |
72 DCHECK(state_ == STOPPED || FLAG_incremental_marking); | 77 DCHECK(state_ == STOPPED || FLAG_incremental_marking); |
73 return state_; | 78 return state_; |
74 } | 79 } |
75 | 80 |
76 bool should_hurry() { return should_hurry_; } | 81 bool should_hurry() { return should_hurry_; } |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
182 INLINE(void RecordWriteIntoCode(Code* host, RelocInfo* rinfo, Object* value)); | 187 INLINE(void RecordWriteIntoCode(Code* host, RelocInfo* rinfo, Object* value)); |
183 INLINE(void RecordWriteOfCodeEntry(JSFunction* host, Object** slot, | 188 INLINE(void RecordWriteOfCodeEntry(JSFunction* host, Object** slot, |
184 Code* value)); | 189 Code* value)); |
185 | 190 |
186 void RecordWriteSlow(HeapObject* obj, Object** slot, Object* value); | 191 void RecordWriteSlow(HeapObject* obj, Object** slot, Object* value); |
187 void RecordWriteIntoCodeSlow(Code* host, RelocInfo* rinfo, Object* value); | 192 void RecordWriteIntoCodeSlow(Code* host, RelocInfo* rinfo, Object* value); |
188 void RecordWriteOfCodeEntrySlow(JSFunction* host, Object** slot, Code* value); | 193 void RecordWriteOfCodeEntrySlow(JSFunction* host, Object** slot, Code* value); |
189 void RecordCodeTargetPatch(Code* host, Address pc, HeapObject* value); | 194 void RecordCodeTargetPatch(Code* host, Address pc, HeapObject* value); |
190 void RecordCodeTargetPatch(Address pc, HeapObject* value); | 195 void RecordCodeTargetPatch(Address pc, HeapObject* value); |
191 | 196 |
192 void WhiteToGreyAndPush(HeapObject* obj); | 197 bool WhiteToGreyAndPush(HeapObject* obj); |
193 | 198 |
194 inline void SetOldSpacePageFlags(MemoryChunk* chunk) { | 199 inline void SetOldSpacePageFlags(MemoryChunk* chunk) { |
195 SetOldSpacePageFlags(chunk, IsMarking(), IsCompacting()); | 200 SetOldSpacePageFlags(chunk, IsMarking(), IsCompacting()); |
196 } | 201 } |
197 | 202 |
198 inline void SetNewSpacePageFlags(Page* chunk) { | 203 inline void SetNewSpacePageFlags(Page* chunk) { |
199 SetNewSpacePageFlags(chunk, IsMarking()); | 204 SetNewSpacePageFlags(chunk, IsMarking()); |
200 } | 205 } |
201 | 206 |
202 bool IsCompacting() { return IsMarking() && is_compacting_; } | 207 bool IsCompacting() { return IsMarking() && is_compacting_; } |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
317 | 322 |
318 Observer new_generation_observer_; | 323 Observer new_generation_observer_; |
319 Observer old_generation_observer_; | 324 Observer old_generation_observer_; |
320 | 325 |
321 DISALLOW_IMPLICIT_CONSTRUCTORS(IncrementalMarking); | 326 DISALLOW_IMPLICIT_CONSTRUCTORS(IncrementalMarking); |
322 }; | 327 }; |
323 } // namespace internal | 328 } // namespace internal |
324 } // namespace v8 | 329 } // namespace v8 |
325 | 330 |
326 #endif // V8_HEAP_INCREMENTAL_MARKING_H_ | 331 #endif // V8_HEAP_INCREMENTAL_MARKING_H_ |
OLD | NEW |