| 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 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 237 INLINE(HeapObject* Pop()) { | 237 INLINE(HeapObject* Pop()) { |
| 238 DCHECK(!IsEmpty()); | 238 DCHECK(!IsEmpty()); |
| 239 top_ = ((top_ - 1) & mask_); | 239 top_ = ((top_ - 1) & mask_); |
| 240 HeapObject* object = array_[top_]; | 240 HeapObject* object = array_[top_]; |
| 241 DCHECK(object->IsHeapObject()); | 241 DCHECK(object->IsHeapObject()); |
| 242 return object; | 242 return object; |
| 243 } | 243 } |
| 244 | 244 |
| 245 INLINE(void UnshiftGrey(HeapObject* object)) { | 245 INLINE(void UnshiftGrey(HeapObject* object)) { |
| 246 DCHECK(object->IsHeapObject()); | 246 DCHECK(object->IsHeapObject()); |
| 247 DCHECK(Marking::IsGrey(Marking::MarkBitFrom(object))); |
| 247 if (IsFull()) { | 248 if (IsFull()) { |
| 248 SetOverflowed(); | 249 SetOverflowed(); |
| 249 } else { | 250 } else { |
| 250 bottom_ = ((bottom_ - 1) & mask_); | 251 bottom_ = ((bottom_ - 1) & mask_); |
| 251 array_[bottom_] = object; | 252 array_[bottom_] = object; |
| 252 } | 253 } |
| 253 } | 254 } |
| 254 | 255 |
| 256 INLINE(void UnshiftBlack(HeapObject* object)) { |
| 257 DCHECK(object->IsHeapObject()); |
| 258 DCHECK(Marking::IsBlack(Marking::MarkBitFrom(object))); |
| 259 if (IsFull()) { |
| 260 Marking::BlackToGrey(object); |
| 261 MemoryChunk::IncrementLiveBytesFromGC(object->address(), -object->Size()); |
| 262 SetOverflowed(); |
| 263 } else { |
| 264 bottom_ = ((bottom_ - 1) & mask_); |
| 265 array_[bottom_] = object; |
| 266 } |
| 267 } |
| 268 |
| 255 HeapObject** array() { return array_; } | 269 HeapObject** array() { return array_; } |
| 256 int bottom() { return bottom_; } | 270 int bottom() { return bottom_; } |
| 257 int top() { return top_; } | 271 int top() { return top_; } |
| 258 int mask() { return mask_; } | 272 int mask() { return mask_; } |
| 259 void set_top(int top) { top_ = top; } | 273 void set_top(int top) { top_ = top; } |
| 260 | 274 |
| 261 private: | 275 private: |
| 262 HeapObject** array_; | 276 HeapObject** array_; |
| 263 // array_[(top - 1) & mask_] is the top element in the deque. The Deque is | 277 // array_[(top - 1) & mask_] is the top element in the deque. The Deque is |
| 264 // empty when top_ == bottom_. It is full when top_ + 1 == bottom | 278 // empty when top_ == bottom_. It is full when top_ + 1 == bottom |
| (...skipping 740 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1005 private: | 1019 private: |
| 1006 MarkCompactCollector* collector_; | 1020 MarkCompactCollector* collector_; |
| 1007 }; | 1021 }; |
| 1008 | 1022 |
| 1009 | 1023 |
| 1010 const char* AllocationSpaceName(AllocationSpace space); | 1024 const char* AllocationSpaceName(AllocationSpace space); |
| 1011 } | 1025 } |
| 1012 } // namespace v8::internal | 1026 } // namespace v8::internal |
| 1013 | 1027 |
| 1014 #endif // V8_HEAP_MARK_COMPACT_H_ | 1028 #endif // V8_HEAP_MARK_COMPACT_H_ |
| OLD | NEW |