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 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
58 explicit IncrementalMarking(Heap* heap); | 58 explicit IncrementalMarking(Heap* heap); |
59 | 59 |
60 MarkingState marking_state(HeapObject* object) const { | 60 MarkingState marking_state(HeapObject* object) const { |
61 return MarkingState::Internal(object); | 61 return MarkingState::Internal(object); |
62 } | 62 } |
63 | 63 |
64 MarkingState marking_state(MemoryChunk* chunk) const { | 64 MarkingState marking_state(MemoryChunk* chunk) const { |
65 return MarkingState::Internal(chunk); | 65 return MarkingState::Internal(chunk); |
66 } | 66 } |
67 | 67 |
| 68 void MarkBlack(HeapObject* object, int size); |
| 69 void MarkGrey(HeapObject* object); |
| 70 |
68 // Transfers mark bits without requiring proper object headers. | 71 // Transfers mark bits without requiring proper object headers. |
69 void TransferMark(Heap* heap, HeapObject* from, HeapObject* to); | 72 void TransferMark(Heap* heap, HeapObject* from, HeapObject* to); |
70 | 73 |
71 // Transfers color including live byte count, requiring properly set up | 74 // Transfers color including live byte count, requiring properly set up |
72 // objects. | 75 // objects. |
73 template <MarkBit::AccessMode access_mode = MarkBit::NON_ATOMIC> | 76 template <MarkBit::AccessMode access_mode = MarkBit::NON_ATOMIC> |
74 V8_INLINE void TransferColor(HeapObject* from, HeapObject* to) { | 77 V8_INLINE void TransferColor(HeapObject* from, HeapObject* to) { |
75 if (ObjectMarking::IsBlack<access_mode>(to, marking_state(to))) { | 78 if (ObjectMarking::IsBlack<access_mode>(to, marking_state(to))) { |
76 DCHECK(black_allocation()); | 79 DCHECK(black_allocation()); |
77 return; | 80 return; |
78 } | 81 } |
79 | 82 |
80 DCHECK(ObjectMarking::IsWhite<access_mode>(to, marking_state(to))); | 83 DCHECK(ObjectMarking::IsWhite<access_mode>(to, marking_state(to))); |
81 if (ObjectMarking::IsGrey<access_mode>(from, marking_state(from))) { | 84 if (ObjectMarking::IsGrey<access_mode>(from, marking_state(from))) { |
82 bool success = | 85 ObjectMarking::WhiteToGrey<access_mode>(to, marking_state(to)); |
83 ObjectMarking::WhiteToGrey<access_mode>(to, marking_state(to)); | |
84 DCHECK(success); | |
85 USE(success); | |
86 } else if (ObjectMarking::IsBlack<access_mode>(from, marking_state(from))) { | 86 } else if (ObjectMarking::IsBlack<access_mode>(from, marking_state(from))) { |
87 bool success = | 87 ObjectMarking::WhiteToBlack<access_mode>(to, marking_state(to)); |
88 ObjectMarking::WhiteToBlack<access_mode>(to, marking_state(to)); | |
89 DCHECK(success); | |
90 USE(success); | |
91 } | 88 } |
92 } | 89 } |
93 | 90 |
94 | 91 |
95 State state() { | 92 State state() { |
96 DCHECK(state_ == STOPPED || FLAG_incremental_marking); | 93 DCHECK(state_ == STOPPED || FLAG_incremental_marking); |
97 return state_; | 94 return state_; |
98 } | 95 } |
99 | 96 |
100 bool should_hurry() { return should_hurry_; } | 97 bool should_hurry() { return should_hurry_; } |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
206 INLINE(void RecordWriteIntoCode(Code* host, RelocInfo* rinfo, Object* value)); | 203 INLINE(void RecordWriteIntoCode(Code* host, RelocInfo* rinfo, Object* value)); |
207 INLINE(void RecordWriteOfCodeEntry(JSFunction* host, Object** slot, | 204 INLINE(void RecordWriteOfCodeEntry(JSFunction* host, Object** slot, |
208 Code* value)); | 205 Code* value)); |
209 | 206 |
210 void RecordWriteSlow(HeapObject* obj, Object** slot, Object* value); | 207 void RecordWriteSlow(HeapObject* obj, Object** slot, Object* value); |
211 void RecordWriteIntoCodeSlow(Code* host, RelocInfo* rinfo, Object* value); | 208 void RecordWriteIntoCodeSlow(Code* host, RelocInfo* rinfo, Object* value); |
212 void RecordWriteOfCodeEntrySlow(JSFunction* host, Object** slot, Code* value); | 209 void RecordWriteOfCodeEntrySlow(JSFunction* host, Object** slot, Code* value); |
213 void RecordCodeTargetPatch(Code* host, Address pc, HeapObject* value); | 210 void RecordCodeTargetPatch(Code* host, Address pc, HeapObject* value); |
214 void RecordCodeTargetPatch(Address pc, HeapObject* value); | 211 void RecordCodeTargetPatch(Address pc, HeapObject* value); |
215 | 212 |
216 // Returns true if the function succeeds in transitioning the object | 213 void WhiteToGreyAndPush(HeapObject* obj); |
217 // from white to grey. | |
218 bool WhiteToGreyAndPush(HeapObject* obj); | |
219 | 214 |
220 inline void SetOldSpacePageFlags(MemoryChunk* chunk) { | 215 inline void SetOldSpacePageFlags(MemoryChunk* chunk) { |
221 SetOldSpacePageFlags(chunk, IsMarking(), IsCompacting()); | 216 SetOldSpacePageFlags(chunk, IsMarking(), IsCompacting()); |
222 } | 217 } |
223 | 218 |
224 inline void SetNewSpacePageFlags(Page* chunk) { | 219 inline void SetNewSpacePageFlags(Page* chunk) { |
225 SetNewSpacePageFlags(chunk, IsMarking()); | 220 SetNewSpacePageFlags(chunk, IsMarking()); |
226 } | 221 } |
227 | 222 |
228 bool IsCompacting() { return IsMarking() && is_compacting_; } | 223 bool IsCompacting() { return IsMarking() && is_compacting_; } |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
344 | 339 |
345 Observer new_generation_observer_; | 340 Observer new_generation_observer_; |
346 Observer old_generation_observer_; | 341 Observer old_generation_observer_; |
347 | 342 |
348 DISALLOW_IMPLICIT_CONSTRUCTORS(IncrementalMarking); | 343 DISALLOW_IMPLICIT_CONSTRUCTORS(IncrementalMarking); |
349 }; | 344 }; |
350 } // namespace internal | 345 } // namespace internal |
351 } // namespace v8 | 346 } // namespace v8 |
352 | 347 |
353 #endif // V8_HEAP_INCREMENTAL_MARKING_H_ | 348 #endif // V8_HEAP_INCREMENTAL_MARKING_H_ |
OLD | NEW |