Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(241)

Side by Side Diff: src/heap/mark-compact-inl.h

Issue 1040443002: MarkBit cleanup: They have to be accessed through Marking accessors. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/heap/mark-compact.cc ('k') | src/heap/objects-visiting-inl.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 10 matching lines...) Expand all
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 } 26 }
27 27
28 28
29 void MarkCompactCollector::MarkObject(HeapObject* obj, MarkBit mark_bit) { 29 void MarkCompactCollector::MarkObject(HeapObject* obj, MarkBit mark_bit) {
30 DCHECK(Marking::MarkBitFrom(obj) == mark_bit); 30 DCHECK(Marking::MarkBitFrom(obj) == mark_bit);
31 if (!mark_bit.Get()) { 31 if (Marking::IsWhite(mark_bit)) {
32 mark_bit.Set(); 32 Marking::WhiteToBlack(mark_bit);
33 MemoryChunk::IncrementLiveBytesFromGC(obj->address(), obj->Size()); 33 MemoryChunk::IncrementLiveBytesFromGC(obj->address(), obj->Size());
34 DCHECK(IsMarked(obj));
35 DCHECK(obj->GetIsolate()->heap()->Contains(obj)); 34 DCHECK(obj->GetIsolate()->heap()->Contains(obj));
36 marking_deque_.PushBlack(obj); 35 marking_deque_.PushBlack(obj);
37 } 36 }
38 } 37 }
39 38
40 39
41 void MarkCompactCollector::SetMark(HeapObject* obj, MarkBit mark_bit) { 40 void MarkCompactCollector::SetMark(HeapObject* obj, MarkBit mark_bit) {
42 DCHECK(!mark_bit.Get()); 41 DCHECK(Marking::IsWhite(mark_bit));
43 DCHECK(Marking::MarkBitFrom(obj) == mark_bit); 42 DCHECK(Marking::MarkBitFrom(obj) == mark_bit);
44 mark_bit.Set(); 43 Marking::WhiteToBlack(mark_bit);
45 MemoryChunk::IncrementLiveBytesFromGC(obj->address(), obj->Size()); 44 MemoryChunk::IncrementLiveBytesFromGC(obj->address(), obj->Size());
46 } 45 }
47 46
48 47
49 bool MarkCompactCollector::IsMarked(Object* obj) { 48 bool MarkCompactCollector::IsMarked(Object* obj) {
50 DCHECK(obj->IsHeapObject()); 49 DCHECK(obj->IsHeapObject());
51 HeapObject* heap_object = HeapObject::cast(obj); 50 HeapObject* heap_object = HeapObject::cast(obj);
52 return Marking::MarkBitFrom(heap_object).Get(); 51 return Marking::IsBlackOrGrey(Marking::MarkBitFrom(heap_object));
53 } 52 }
54 53
55 54
56 void MarkCompactCollector::RecordSlot(Object** anchor_slot, Object** slot, 55 void MarkCompactCollector::RecordSlot(Object** anchor_slot, Object** slot,
57 Object* object, 56 Object* object,
58 SlotsBuffer::AdditionMode mode) { 57 SlotsBuffer::AdditionMode mode) {
59 Page* object_page = Page::FromAddress(reinterpret_cast<Address>(object)); 58 Page* object_page = Page::FromAddress(reinterpret_cast<Address>(object));
60 if (object_page->IsEvacuationCandidate() && 59 if (object_page->IsEvacuationCandidate() &&
61 !ShouldSkipEvacuationSlotRecording(anchor_slot)) { 60 !ShouldSkipEvacuationSlotRecording(anchor_slot)) {
62 if (!SlotsBuffer::AddTo(&slots_buffer_allocator_, 61 if (!SlotsBuffer::AddTo(&slots_buffer_allocator_,
63 object_page->slots_buffer_address(), slot, mode)) { 62 object_page->slots_buffer_address(), slot, mode)) {
64 EvictEvacuationCandidate(object_page); 63 EvictEvacuationCandidate(object_page);
65 } 64 }
66 } 65 }
67 } 66 }
68 } 67 }
69 } // namespace v8::internal 68 } // namespace v8::internal
70 69
71 #endif // V8_HEAP_MARK_COMPACT_INL_H_ 70 #endif // V8_HEAP_MARK_COMPACT_INL_H_
OLDNEW
« no previous file with comments | « src/heap/mark-compact.cc ('k') | src/heap/objects-visiting-inl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698