| 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_INL_H_ | 5 #ifndef V8_HEAP_MARK_COMPACT_INL_H_ |
| 6 #define V8_HEAP_MARK_COMPACT_INL_H_ | 6 #define V8_HEAP_MARK_COMPACT_INL_H_ |
| 7 | 7 |
| 8 #include "src/heap/mark-compact.h" | 8 #include "src/heap/mark-compact.h" |
| 9 #include "src/heap/remembered-set.h" | 9 #include "src/heap/remembered-set.h" |
| 10 #include "src/isolate.h" | 10 #include "src/isolate.h" |
| 11 | 11 |
| 12 namespace v8 { | 12 namespace v8 { |
| 13 namespace internal { | 13 namespace internal { |
| 14 | 14 |
| 15 void MarkCompactCollector::PushBlack(HeapObject* obj) { | 15 void MarkCompactCollector::PushBlack(HeapObject* obj) { |
| 16 DCHECK(Marking::IsBlack(ObjectMarking::MarkBitFrom(obj))); | 16 DCHECK(Marking::IsBlack(ObjectMarking::MarkBitFrom(obj))); |
| 17 if (marking_deque_.Push(obj)) { | 17 if (marking_deque()->Push(obj)) { |
| 18 MemoryChunk::IncrementLiveBytesFromGC(obj, obj->Size()); | 18 MemoryChunk::IncrementLiveBytesFromGC(obj, obj->Size()); |
| 19 } else { | 19 } else { |
| 20 MarkBit mark_bit = ObjectMarking::MarkBitFrom(obj); | 20 MarkBit mark_bit = ObjectMarking::MarkBitFrom(obj); |
| 21 Marking::BlackToGrey(mark_bit); | 21 Marking::BlackToGrey(mark_bit); |
| 22 } | 22 } |
| 23 } | 23 } |
| 24 | 24 |
| 25 | 25 |
| 26 void MarkCompactCollector::UnshiftBlack(HeapObject* obj) { | 26 void MarkCompactCollector::UnshiftBlack(HeapObject* obj) { |
| 27 DCHECK(Marking::IsBlack(ObjectMarking::MarkBitFrom(obj))); | 27 DCHECK(Marking::IsBlack(ObjectMarking::MarkBitFrom(obj))); |
| 28 if (!marking_deque_.Unshift(obj)) { | 28 if (!marking_deque()->Unshift(obj)) { |
| 29 MemoryChunk::IncrementLiveBytesFromGC(obj, -obj->Size()); | 29 MemoryChunk::IncrementLiveBytesFromGC(obj, -obj->Size()); |
| 30 MarkBit mark_bit = ObjectMarking::MarkBitFrom(obj); | 30 MarkBit mark_bit = ObjectMarking::MarkBitFrom(obj); |
| 31 Marking::BlackToGrey(mark_bit); | 31 Marking::BlackToGrey(mark_bit); |
| 32 } | 32 } |
| 33 } | 33 } |
| 34 | 34 |
| 35 | 35 |
| 36 void MarkCompactCollector::MarkObject(HeapObject* obj, MarkBit mark_bit) { | 36 void MarkCompactCollector::MarkObject(HeapObject* obj, MarkBit mark_bit) { |
| 37 DCHECK(ObjectMarking::MarkBitFrom(obj) == mark_bit); | 37 DCHECK(ObjectMarking::MarkBitFrom(obj) == mark_bit); |
| 38 if (Marking::IsWhite(mark_bit)) { | 38 if (Marking::IsWhite(mark_bit)) { |
| (...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 217 } | 217 } |
| 218 if (object != nullptr) return object; | 218 if (object != nullptr) return object; |
| 219 } | 219 } |
| 220 return nullptr; | 220 return nullptr; |
| 221 } | 221 } |
| 222 | 222 |
| 223 } // namespace internal | 223 } // namespace internal |
| 224 } // namespace v8 | 224 } // namespace v8 |
| 225 | 225 |
| 226 #endif // V8_HEAP_MARK_COMPACT_INL_H_ | 226 #endif // V8_HEAP_MARK_COMPACT_INL_H_ |
| OLD | NEW |