OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
46 | 46 |
47 void MarkCompactCollector::SetFlags(int flags) { | 47 void MarkCompactCollector::SetFlags(int flags) { |
48 sweep_precisely_ = ((flags & Heap::kMakeHeapIterableMask) != 0); | 48 sweep_precisely_ = ((flags & Heap::kMakeHeapIterableMask) != 0); |
49 } | 49 } |
50 | 50 |
51 | 51 |
52 void MarkCompactCollector::MarkObject(HeapObject* obj, MarkBit mark_bit) { | 52 void MarkCompactCollector::MarkObject(HeapObject* obj, MarkBit mark_bit) { |
53 ASSERT(Marking::MarkBitFrom(obj) == mark_bit); | 53 ASSERT(Marking::MarkBitFrom(obj) == mark_bit); |
54 if (!mark_bit.Get()) { | 54 if (!mark_bit.Get()) { |
55 mark_bit.Set(); | 55 mark_bit.Set(); |
56 MemoryChunk::IncrementLiveBytes(obj->address(), obj->Size()); | 56 MemoryChunk::IncrementLiveBytesFromGC(obj->address(), obj->Size()); |
57 ProcessNewlyMarkedObject(obj); | 57 ProcessNewlyMarkedObject(obj); |
58 } | 58 } |
59 } | 59 } |
60 | 60 |
61 | 61 |
62 void MarkCompactCollector::SetMark(HeapObject* obj, MarkBit mark_bit) { | 62 void MarkCompactCollector::SetMark(HeapObject* obj, MarkBit mark_bit) { |
63 ASSERT(!mark_bit.Get()); | 63 ASSERT(!mark_bit.Get()); |
64 ASSERT(Marking::MarkBitFrom(obj) == mark_bit); | 64 ASSERT(Marking::MarkBitFrom(obj) == mark_bit); |
65 mark_bit.Set(); | 65 mark_bit.Set(); |
66 MemoryChunk::IncrementLiveBytes(obj->address(), obj->Size()); | 66 MemoryChunk::IncrementLiveBytesFromGC(obj->address(), obj->Size()); |
67 } | 67 } |
68 | 68 |
69 | 69 |
70 bool MarkCompactCollector::IsMarked(Object* obj) { | 70 bool MarkCompactCollector::IsMarked(Object* obj) { |
71 ASSERT(obj->IsHeapObject()); | 71 ASSERT(obj->IsHeapObject()); |
72 HeapObject* heap_object = HeapObject::cast(obj); | 72 HeapObject* heap_object = HeapObject::cast(obj); |
73 return Marking::MarkBitFrom(heap_object).Get(); | 73 return Marking::MarkBitFrom(heap_object).Get(); |
74 } | 74 } |
75 | 75 |
76 | 76 |
77 void MarkCompactCollector::RecordSlot(Object** anchor_slot, | 77 void MarkCompactCollector::RecordSlot(Object** anchor_slot, |
78 Object** slot, | 78 Object** slot, |
79 Object* object) { | 79 Object* object) { |
80 Page* object_page = Page::FromAddress(reinterpret_cast<Address>(object)); | 80 Page* object_page = Page::FromAddress(reinterpret_cast<Address>(object)); |
81 if (object_page->IsEvacuationCandidate() && | 81 if (object_page->IsEvacuationCandidate() && |
82 !ShouldSkipEvacuationSlotRecording(anchor_slot)) { | 82 !ShouldSkipEvacuationSlotRecording(anchor_slot)) { |
83 if (!SlotsBuffer::AddTo(&slots_buffer_allocator_, | 83 if (!SlotsBuffer::AddTo(&slots_buffer_allocator_, |
84 object_page->slots_buffer_address(), | 84 object_page->slots_buffer_address(), |
85 slot, | 85 slot, |
86 SlotsBuffer::FAIL_ON_OVERFLOW)) { | 86 SlotsBuffer::FAIL_ON_OVERFLOW)) { |
87 EvictEvacuationCandidate(object_page); | 87 EvictEvacuationCandidate(object_page); |
88 } | 88 } |
89 } | 89 } |
90 } | 90 } |
91 | 91 |
92 | 92 |
93 } } // namespace v8::internal | 93 } } // namespace v8::internal |
94 | 94 |
95 #endif // V8_MARK_COMPACT_INL_H_ | 95 #endif // V8_MARK_COMPACT_INL_H_ |
OLD | NEW |