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

Side by Side Diff: src/heap/remembered-set.cc

Issue 2139133003: [heap] Untangle Marking and friends from heap dependencies. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: fix comment formatting Created 4 years, 5 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/objects-visiting-inl.h ('k') | src/heap/scavenger.cc » ('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 2016 the V8 project authors. All rights reserved. 1 // Copyright 2016 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 #include "src/heap/remembered-set.h" 5 #include "src/heap/remembered-set.h"
6 #include "src/heap/heap-inl.h" 6 #include "src/heap/heap-inl.h"
7 #include "src/heap/heap.h" 7 #include "src/heap/heap.h"
8 #include "src/heap/mark-compact.h" 8 #include "src/heap/mark-compact.h"
9 #include "src/heap/slot-set.h" 9 #include "src/heap/slot-set.h"
10 #include "src/heap/spaces.h" 10 #include "src/heap/spaces.h"
(...skipping 13 matching lines...) Expand all
24 Object** slot = reinterpret_cast<Object**>(addr); 24 Object** slot = reinterpret_cast<Object**>(addr);
25 return IsValidSlot(heap, chunk, slot) ? KEEP_SLOT : REMOVE_SLOT; 25 return IsValidSlot(heap, chunk, slot) ? KEEP_SLOT : REMOVE_SLOT;
26 }); 26 });
27 } 27 }
28 } 28 }
29 for (MemoryChunk* chunk : *heap->code_space()) { 29 for (MemoryChunk* chunk : *heap->code_space()) {
30 TypedSlotSet* slots = GetTypedSlotSet(chunk); 30 TypedSlotSet* slots = GetTypedSlotSet(chunk);
31 if (slots != nullptr) { 31 if (slots != nullptr) {
32 slots->Iterate( 32 slots->Iterate(
33 [heap, chunk](SlotType type, Address host_addr, Address addr) { 33 [heap, chunk](SlotType type, Address host_addr, Address addr) {
34 if (Marking::IsBlack(Marking::MarkBitFrom(host_addr))) { 34 if (Marking::IsBlack(ObjectMarking::MarkBitFrom(host_addr))) {
35 return KEEP_SLOT; 35 return KEEP_SLOT;
36 } else { 36 } else {
37 return REMOVE_SLOT; 37 return REMOVE_SLOT;
38 } 38 }
39 }); 39 });
40 } 40 }
41 } 41 }
42 if (Heap::ShouldZapGarbage()) { 42 if (Heap::ShouldZapGarbage()) {
43 // Need to filter invalid slots as we overwrite them with zap values in 43 // Need to filter invalid slots as we overwrite them with zap values in
44 // during sweeping which runs concurrently with pointer updating. 44 // during sweeping which runs concurrently with pointer updating.
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 bool RememberedSet<direction>::IsValidSlot(Heap* heap, MemoryChunk* chunk, 81 bool RememberedSet<direction>::IsValidSlot(Heap* heap, MemoryChunk* chunk,
82 Object** slot) { 82 Object** slot) {
83 STATIC_ASSERT(direction == OLD_TO_NEW); 83 STATIC_ASSERT(direction == OLD_TO_NEW);
84 Object* object = *slot; 84 Object* object = *slot;
85 if (!heap->InNewSpace(object)) { 85 if (!heap->InNewSpace(object)) {
86 return false; 86 return false;
87 } 87 }
88 HeapObject* heap_object = HeapObject::cast(object); 88 HeapObject* heap_object = HeapObject::cast(object);
89 // If the target object is not black, the source slot must be part 89 // If the target object is not black, the source slot must be part
90 // of a non-black (dead) object. 90 // of a non-black (dead) object.
91 return Marking::IsBlack(Marking::MarkBitFrom(heap_object)) && 91 return Marking::IsBlack(ObjectMarking::MarkBitFrom(heap_object)) &&
92 heap->mark_compact_collector()->IsSlotInBlackObject( 92 heap->mark_compact_collector()->IsSlotInBlackObject(
93 chunk, reinterpret_cast<Address>(slot)); 93 chunk, reinterpret_cast<Address>(slot));
94 } 94 }
95 95
96 template void RememberedSet<OLD_TO_NEW>::ClearInvalidSlots(Heap* heap); 96 template void RememberedSet<OLD_TO_NEW>::ClearInvalidSlots(Heap* heap);
97 template void RememberedSet<OLD_TO_NEW>::VerifyValidSlots(Heap* heap); 97 template void RememberedSet<OLD_TO_NEW>::VerifyValidSlots(Heap* heap);
98 template void RememberedSet<OLD_TO_OLD>::VerifyValidSlots(Heap* heap); 98 template void RememberedSet<OLD_TO_OLD>::VerifyValidSlots(Heap* heap);
99 99
100 } // namespace internal 100 } // namespace internal
101 } // namespace v8 101 } // namespace v8
OLDNEW
« no previous file with comments | « src/heap/objects-visiting-inl.h ('k') | src/heap/scavenger.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698