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_MARK_COMPACT_INL_H_ | 5 #ifndef V8_HEAP_MARK_COMPACT_INL_H_ |
6 #define V8_MARK_COMPACT_INL_H_ | 6 #define V8_HEAP_MARK_COMPACT_INL_H_ |
7 | 7 |
8 #include <memory.h> | 8 #include <memory.h> |
9 | 9 |
| 10 #include "src/heap/mark-compact.h" |
10 #include "src/isolate.h" | 11 #include "src/isolate.h" |
11 #include "src/mark-compact.h" | |
12 | 12 |
13 | 13 |
14 namespace v8 { | 14 namespace v8 { |
15 namespace internal { | 15 namespace internal { |
16 | 16 |
17 | 17 |
18 MarkBit Marking::MarkBitFrom(Address addr) { | 18 MarkBit Marking::MarkBitFrom(Address addr) { |
19 MemoryChunk* p = MemoryChunk::FromAddress(addr); | 19 MemoryChunk* p = MemoryChunk::FromAddress(addr); |
20 return p->markbits()->MarkBitFromIndex(p->AddressToMarkbitIndex(addr), | 20 return p->markbits()->MarkBitFromIndex(p->AddressToMarkbitIndex(addr), |
21 p->ContainsOnlyData()); | 21 p->ContainsOnlyData()); |
(...skipping 28 matching lines...) Expand all Loading... |
50 } | 50 } |
51 | 51 |
52 | 52 |
53 bool MarkCompactCollector::IsMarked(Object* obj) { | 53 bool MarkCompactCollector::IsMarked(Object* obj) { |
54 DCHECK(obj->IsHeapObject()); | 54 DCHECK(obj->IsHeapObject()); |
55 HeapObject* heap_object = HeapObject::cast(obj); | 55 HeapObject* heap_object = HeapObject::cast(obj); |
56 return Marking::MarkBitFrom(heap_object).Get(); | 56 return Marking::MarkBitFrom(heap_object).Get(); |
57 } | 57 } |
58 | 58 |
59 | 59 |
60 void MarkCompactCollector::RecordSlot(Object** anchor_slot, | 60 void MarkCompactCollector::RecordSlot(Object** anchor_slot, Object** slot, |
61 Object** slot, | |
62 Object* object, | 61 Object* object, |
63 SlotsBuffer::AdditionMode mode) { | 62 SlotsBuffer::AdditionMode mode) { |
64 Page* object_page = Page::FromAddress(reinterpret_cast<Address>(object)); | 63 Page* object_page = Page::FromAddress(reinterpret_cast<Address>(object)); |
65 if (object_page->IsEvacuationCandidate() && | 64 if (object_page->IsEvacuationCandidate() && |
66 !ShouldSkipEvacuationSlotRecording(anchor_slot)) { | 65 !ShouldSkipEvacuationSlotRecording(anchor_slot)) { |
67 if (!SlotsBuffer::AddTo(&slots_buffer_allocator_, | 66 if (!SlotsBuffer::AddTo(&slots_buffer_allocator_, |
68 object_page->slots_buffer_address(), | 67 object_page->slots_buffer_address(), slot, mode)) { |
69 slot, | |
70 mode)) { | |
71 EvictEvacuationCandidate(object_page); | 68 EvictEvacuationCandidate(object_page); |
72 } | 69 } |
73 } | 70 } |
74 } | 71 } |
| 72 } |
| 73 } // namespace v8::internal |
75 | 74 |
76 | 75 #endif // V8_HEAP_MARK_COMPACT_INL_H_ |
77 } } // namespace v8::internal | |
78 | |
79 #endif // V8_MARK_COMPACT_INL_H_ | |
OLD | NEW |