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 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
203 | 203 |
204 void ClearOverflowed() { overflowed_ = false; } | 204 void ClearOverflowed() { overflowed_ = false; } |
205 | 205 |
206 void SetOverflowed() { overflowed_ = true; } | 206 void SetOverflowed() { overflowed_ = true; } |
207 | 207 |
208 // Push the (marked) object on the marking stack if there is room, | 208 // Push the (marked) object on the marking stack if there is room, |
209 // otherwise mark the object as overflowed and wait for a rescan of the | 209 // otherwise mark the object as overflowed and wait for a rescan of the |
210 // heap. | 210 // heap. |
211 INLINE(void PushBlack(HeapObject* object)) { | 211 INLINE(void PushBlack(HeapObject* object)) { |
212 DCHECK(object->IsHeapObject()); | 212 DCHECK(object->IsHeapObject()); |
213 // TODO(jochen): Remove again before we branch for 4.2. | 213 DCHECK(object->map()->IsMap()); |
214 CHECK(object->IsHeapObject() && object->map()->IsMap()); | |
215 if (IsFull()) { | 214 if (IsFull()) { |
216 Marking::BlackToGrey(object); | 215 Marking::BlackToGrey(object); |
217 MemoryChunk::IncrementLiveBytesFromGC(object->address(), -object->Size()); | 216 MemoryChunk::IncrementLiveBytesFromGC(object->address(), -object->Size()); |
218 SetOverflowed(); | 217 SetOverflowed(); |
219 } else { | 218 } else { |
220 array_[top_] = object; | 219 array_[top_] = object; |
221 top_ = ((top_ + 1) & mask_); | 220 top_ = ((top_ + 1) & mask_); |
222 } | 221 } |
223 } | 222 } |
224 | 223 |
225 INLINE(void PushGrey(HeapObject* object)) { | 224 INLINE(void PushGrey(HeapObject* object)) { |
226 DCHECK(object->IsHeapObject()); | 225 DCHECK(object->IsHeapObject()); |
227 // TODO(jochen): Remove again before we branch for 4.2. | 226 DCHECK(object->map()->IsMap()); |
228 CHECK(object->IsHeapObject() && object->map()->IsMap()); | |
229 if (IsFull()) { | 227 if (IsFull()) { |
230 SetOverflowed(); | 228 SetOverflowed(); |
231 } else { | 229 } else { |
232 array_[top_] = object; | 230 array_[top_] = object; |
233 top_ = ((top_ + 1) & mask_); | 231 top_ = ((top_ + 1) & mask_); |
234 } | 232 } |
235 } | 233 } |
236 | 234 |
237 INLINE(HeapObject* Pop()) { | 235 INLINE(HeapObject* Pop()) { |
238 DCHECK(!IsEmpty()); | 236 DCHECK(!IsEmpty()); |
(...skipping 766 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1005 private: | 1003 private: |
1006 MarkCompactCollector* collector_; | 1004 MarkCompactCollector* collector_; |
1007 }; | 1005 }; |
1008 | 1006 |
1009 | 1007 |
1010 const char* AllocationSpaceName(AllocationSpace space); | 1008 const char* AllocationSpaceName(AllocationSpace space); |
1011 } | 1009 } |
1012 } // namespace v8::internal | 1010 } // namespace v8::internal |
1013 | 1011 |
1014 #endif // V8_HEAP_MARK_COMPACT_H_ | 1012 #endif // V8_HEAP_MARK_COMPACT_H_ |
OLD | NEW |