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 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 if (IsFull()) { | 212 if (IsFull()) { |
213 Marking::BlackToGrey(object); | 213 Marking::BlackToGrey(object); |
214 MemoryChunk::IncrementLiveBytesFromGC(object->address(), -object->Size()); | 214 MemoryChunk::IncrementLiveBytesFromGC(object, -object->Size()); |
215 SetOverflowed(); | 215 SetOverflowed(); |
216 } else { | 216 } else { |
217 array_[top_] = object; | 217 array_[top_] = object; |
218 top_ = ((top_ + 1) & mask_); | 218 top_ = ((top_ + 1) & mask_); |
219 } | 219 } |
220 } | 220 } |
221 | 221 |
222 INLINE(void PushGrey(HeapObject* object)) { | 222 INLINE(void PushGrey(HeapObject* object)) { |
223 DCHECK(object->IsHeapObject()); | 223 DCHECK(object->IsHeapObject()); |
224 if (IsFull()) { | 224 if (IsFull()) { |
(...skipping 20 matching lines...) Expand all Loading... |
245 bottom_ = ((bottom_ - 1) & mask_); | 245 bottom_ = ((bottom_ - 1) & mask_); |
246 array_[bottom_] = object; | 246 array_[bottom_] = object; |
247 } | 247 } |
248 } | 248 } |
249 | 249 |
250 INLINE(void UnshiftBlack(HeapObject* object)) { | 250 INLINE(void UnshiftBlack(HeapObject* object)) { |
251 DCHECK(object->IsHeapObject()); | 251 DCHECK(object->IsHeapObject()); |
252 DCHECK(Marking::IsBlack(Marking::MarkBitFrom(object))); | 252 DCHECK(Marking::IsBlack(Marking::MarkBitFrom(object))); |
253 if (IsFull()) { | 253 if (IsFull()) { |
254 Marking::BlackToGrey(object); | 254 Marking::BlackToGrey(object); |
255 MemoryChunk::IncrementLiveBytesFromGC(object->address(), -object->Size()); | 255 MemoryChunk::IncrementLiveBytesFromGC(object, -object->Size()); |
256 SetOverflowed(); | 256 SetOverflowed(); |
257 } else { | 257 } else { |
258 bottom_ = ((bottom_ - 1) & mask_); | 258 bottom_ = ((bottom_ - 1) & mask_); |
259 array_[bottom_] = object; | 259 array_[bottom_] = object; |
260 } | 260 } |
261 } | 261 } |
262 | 262 |
263 HeapObject** array() { return array_; } | 263 HeapObject** array() { return array_; } |
264 int bottom() { return bottom_; } | 264 int bottom() { return bottom_; } |
265 int top() { return top_; } | 265 int top() { return top_; } |
(...skipping 771 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1037 private: | 1037 private: |
1038 MarkCompactCollector* collector_; | 1038 MarkCompactCollector* collector_; |
1039 }; | 1039 }; |
1040 | 1040 |
1041 | 1041 |
1042 const char* AllocationSpaceName(AllocationSpace space); | 1042 const char* AllocationSpaceName(AllocationSpace space); |
1043 } | 1043 } |
1044 } // namespace v8::internal | 1044 } // namespace v8::internal |
1045 | 1045 |
1046 #endif // V8_HEAP_MARK_COMPACT_H_ | 1046 #endif // V8_HEAP_MARK_COMPACT_H_ |
OLD | NEW |