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 |
(...skipping 15 matching lines...) Expand all Loading... |
26 finalize_incremental_marking_ = | 26 finalize_incremental_marking_ = |
27 ((flags & Heap::kFinalizeIncrementalMarkingMask) != 0); | 27 ((flags & Heap::kFinalizeIncrementalMarkingMask) != 0); |
28 DCHECK(!finalize_incremental_marking_ || !abort_incremental_marking_); | 28 DCHECK(!finalize_incremental_marking_ || !abort_incremental_marking_); |
29 } | 29 } |
30 | 30 |
31 | 31 |
32 void MarkCompactCollector::MarkObject(HeapObject* obj, MarkBit mark_bit) { | 32 void MarkCompactCollector::MarkObject(HeapObject* obj, MarkBit mark_bit) { |
33 DCHECK(Marking::MarkBitFrom(obj) == mark_bit); | 33 DCHECK(Marking::MarkBitFrom(obj) == mark_bit); |
34 if (Marking::IsWhite(mark_bit)) { | 34 if (Marking::IsWhite(mark_bit)) { |
35 Marking::WhiteToBlack(mark_bit); | 35 Marking::WhiteToBlack(mark_bit); |
36 MemoryChunk::IncrementLiveBytesFromGC(obj->address(), obj->Size()); | 36 MemoryChunk::IncrementLiveBytesFromGC(obj, obj->Size()); |
37 DCHECK(obj->GetIsolate()->heap()->Contains(obj)); | 37 DCHECK(obj->GetIsolate()->heap()->Contains(obj)); |
38 marking_deque_.PushBlack(obj); | 38 marking_deque_.PushBlack(obj); |
39 } | 39 } |
40 } | 40 } |
41 | 41 |
42 | 42 |
43 void MarkCompactCollector::SetMark(HeapObject* obj, MarkBit mark_bit) { | 43 void MarkCompactCollector::SetMark(HeapObject* obj, MarkBit mark_bit) { |
44 DCHECK(Marking::IsWhite(mark_bit)); | 44 DCHECK(Marking::IsWhite(mark_bit)); |
45 DCHECK(Marking::MarkBitFrom(obj) == mark_bit); | 45 DCHECK(Marking::MarkBitFrom(obj) == mark_bit); |
46 Marking::WhiteToBlack(mark_bit); | 46 Marking::WhiteToBlack(mark_bit); |
47 MemoryChunk::IncrementLiveBytesFromGC(obj->address(), obj->Size()); | 47 MemoryChunk::IncrementLiveBytesFromGC(obj, obj->Size()); |
48 } | 48 } |
49 | 49 |
50 | 50 |
51 bool MarkCompactCollector::IsMarked(Object* obj) { | 51 bool MarkCompactCollector::IsMarked(Object* obj) { |
52 DCHECK(obj->IsHeapObject()); | 52 DCHECK(obj->IsHeapObject()); |
53 HeapObject* heap_object = HeapObject::cast(obj); | 53 HeapObject* heap_object = HeapObject::cast(obj); |
54 return Marking::IsBlackOrGrey(Marking::MarkBitFrom(heap_object)); | 54 return Marking::IsBlackOrGrey(Marking::MarkBitFrom(heap_object)); |
55 } | 55 } |
56 | 56 |
57 | 57 |
58 void MarkCompactCollector::RecordSlot(Object** anchor_slot, Object** slot, | 58 void MarkCompactCollector::RecordSlot(Object** anchor_slot, Object** slot, |
59 Object* object, | 59 Object* object, |
60 SlotsBuffer::AdditionMode mode) { | 60 SlotsBuffer::AdditionMode mode) { |
61 Page* object_page = Page::FromAddress(reinterpret_cast<Address>(object)); | 61 Page* object_page = Page::FromAddress(reinterpret_cast<Address>(object)); |
62 if (object_page->IsEvacuationCandidate() && | 62 if (object_page->IsEvacuationCandidate() && |
63 !ShouldSkipEvacuationSlotRecording(anchor_slot)) { | 63 !ShouldSkipEvacuationSlotRecording(anchor_slot)) { |
64 if (!SlotsBuffer::AddTo(&slots_buffer_allocator_, | 64 if (!SlotsBuffer::AddTo(&slots_buffer_allocator_, |
65 object_page->slots_buffer_address(), slot, mode)) { | 65 object_page->slots_buffer_address(), slot, mode)) { |
66 EvictPopularEvacuationCandidate(object_page); | 66 EvictPopularEvacuationCandidate(object_page); |
67 } | 67 } |
68 } | 68 } |
69 } | 69 } |
70 } | 70 } |
71 } // namespace v8::internal | 71 } // namespace v8::internal |
72 | 72 |
73 #endif // V8_HEAP_MARK_COMPACT_INL_H_ | 73 #endif // V8_HEAP_MARK_COMPACT_INL_H_ |
OLD | NEW |