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_MARK_COMPACT_H_ | 5 #ifndef V8_HEAP_MARK_COMPACT_H_ |
6 #define V8_HEAP_MARK_COMPACT_H_ | 6 #define V8_HEAP_MARK_COMPACT_H_ |
7 | 7 |
8 #include "src/base/bits.h" | 8 #include "src/base/bits.h" |
9 #include "src/heap/spaces.h" | 9 #include "src/heap/spaces.h" |
10 | 10 |
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
202 | 202 |
203 void ClearOverflowed() { overflowed_ = false; } | 203 void ClearOverflowed() { overflowed_ = false; } |
204 | 204 |
205 void SetOverflowed() { overflowed_ = true; } | 205 void SetOverflowed() { overflowed_ = true; } |
206 | 206 |
207 // Push the (marked) object on the marking stack if there is room, | 207 // Push the (marked) object on the marking stack if there is room, |
208 // otherwise mark the object as overflowed and wait for a rescan of the | 208 // otherwise mark the object as overflowed and wait for a rescan of the |
209 // heap. | 209 // heap. |
210 INLINE(void PushBlack(HeapObject* object)) { | 210 INLINE(void PushBlack(HeapObject* object)) { |
211 DCHECK(object->IsHeapObject()); | 211 DCHECK(object->IsHeapObject()); |
212 DCHECK(object->map()->IsMap()); | |
213 if (IsFull()) { | 212 if (IsFull()) { |
214 Marking::BlackToGrey(object); | 213 Marking::BlackToGrey(object); |
215 MemoryChunk::IncrementLiveBytesFromGC(object->address(), -object->Size()); | 214 MemoryChunk::IncrementLiveBytesFromGC(object->address(), -object->Size()); |
216 SetOverflowed(); | 215 SetOverflowed(); |
217 } else { | 216 } else { |
218 array_[top_] = object; | 217 array_[top_] = object; |
219 top_ = ((top_ + 1) & mask_); | 218 top_ = ((top_ + 1) & mask_); |
220 } | 219 } |
221 } | 220 } |
222 | 221 |
223 INLINE(void PushGrey(HeapObject* object)) { | 222 INLINE(void PushGrey(HeapObject* object)) { |
224 DCHECK(object->IsHeapObject()); | 223 DCHECK(object->IsHeapObject()); |
225 DCHECK(object->map()->IsMap()); | |
226 if (IsFull()) { | 224 if (IsFull()) { |
227 SetOverflowed(); | 225 SetOverflowed(); |
228 } else { | 226 } else { |
229 array_[top_] = object; | 227 array_[top_] = object; |
230 top_ = ((top_ + 1) & mask_); | 228 top_ = ((top_ + 1) & mask_); |
231 } | 229 } |
232 } | 230 } |
233 | 231 |
234 INLINE(HeapObject* Pop()) { | 232 INLINE(HeapObject* Pop()) { |
235 DCHECK(!IsEmpty()); | 233 DCHECK(!IsEmpty()); |
(...skipping 797 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1033 private: | 1031 private: |
1034 MarkCompactCollector* collector_; | 1032 MarkCompactCollector* collector_; |
1035 }; | 1033 }; |
1036 | 1034 |
1037 | 1035 |
1038 const char* AllocationSpaceName(AllocationSpace space); | 1036 const char* AllocationSpaceName(AllocationSpace space); |
1039 } | 1037 } |
1040 } // namespace v8::internal | 1038 } // namespace v8::internal |
1041 | 1039 |
1042 #endif // V8_HEAP_MARK_COMPACT_H_ | 1040 #endif // V8_HEAP_MARK_COMPACT_H_ |
OLD | NEW |