| 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/isolate.h" | 9 #include "src/isolate.h" |
| 10 | 10 |
| 11 | 11 |
| 12 namespace v8 { | 12 namespace v8 { |
| 13 namespace internal { | 13 namespace internal { |
| 14 | 14 |
| 15 | 15 |
| 16 MarkBit Marking::MarkBitFrom(Address addr) { | 16 MarkBit Marking::MarkBitFrom(Address addr) { |
| 17 MemoryChunk* p = MemoryChunk::FromAddress(addr); | 17 MemoryChunk* p = MemoryChunk::FromAddress(addr); |
| 18 return p->markbits()->MarkBitFromIndex(p->AddressToMarkbitIndex(addr)); | 18 return p->markbits()->MarkBitFromIndex(p->AddressToMarkbitIndex(addr)); |
| 19 } | 19 } |
| 20 | 20 |
| 21 | 21 |
| 22 void MarkCompactCollector::SetFlags(int flags) { | 22 void MarkCompactCollector::SetFlags(int flags) { |
| 23 reduce_memory_footprint_ = ((flags & Heap::kReduceMemoryFootprintMask) != 0); | 23 reduce_memory_footprint_ = ((flags & Heap::kReduceMemoryFootprintMask) != 0); |
| 24 abort_incremental_marking_ = | 24 abort_incremental_marking_ = |
| 25 ((flags & Heap::kAbortIncrementalMarkingMask) != 0); | 25 ((flags & Heap::kAbortIncrementalMarkingMask) != 0); |
| 26 finalize_incremental_marking_ = | |
| 27 ((flags & Heap::kFinalizeIncrementalMarkingMask) != 0); | |
| 28 DCHECK(!finalize_incremental_marking_ || !abort_incremental_marking_); | |
| 29 } | 26 } |
| 30 | 27 |
| 31 | 28 |
| 32 void MarkCompactCollector::MarkObject(HeapObject* obj, MarkBit mark_bit) { | 29 void MarkCompactCollector::MarkObject(HeapObject* obj, MarkBit mark_bit) { |
| 33 DCHECK(Marking::MarkBitFrom(obj) == mark_bit); | 30 DCHECK(Marking::MarkBitFrom(obj) == mark_bit); |
| 34 if (Marking::IsWhite(mark_bit)) { | 31 if (Marking::IsWhite(mark_bit)) { |
| 35 Marking::WhiteToBlack(mark_bit); | 32 Marking::WhiteToBlack(mark_bit); |
| 36 MemoryChunk::IncrementLiveBytesFromGC(obj->address(), obj->Size()); | 33 MemoryChunk::IncrementLiveBytesFromGC(obj->address(), obj->Size()); |
| 37 DCHECK(obj->GetIsolate()->heap()->Contains(obj)); | 34 DCHECK(obj->GetIsolate()->heap()->Contains(obj)); |
| 38 marking_deque_.PushBlack(obj); | 35 marking_deque_.PushBlack(obj); |
| (...skipping 25 matching lines...) Expand all Loading... |
| 64 if (!SlotsBuffer::AddTo(&slots_buffer_allocator_, | 61 if (!SlotsBuffer::AddTo(&slots_buffer_allocator_, |
| 65 object_page->slots_buffer_address(), slot, mode)) { | 62 object_page->slots_buffer_address(), slot, mode)) { |
| 66 EvictEvacuationCandidate(object_page); | 63 EvictEvacuationCandidate(object_page); |
| 67 } | 64 } |
| 68 } | 65 } |
| 69 } | 66 } |
| 70 } | 67 } |
| 71 } // namespace v8::internal | 68 } // namespace v8::internal |
| 72 | 69 |
| 73 #endif // V8_HEAP_MARK_COMPACT_INL_H_ | 70 #endif // V8_HEAP_MARK_COMPACT_INL_H_ |
| OLD | NEW |