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

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

Issue 2091733002: Reland [heap] Avoid the use of cells to point from code to new-space objects. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Address comments. 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/remembered-set.h ('k') | src/ia32/assembler-ia32-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 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"
11 #include "src/heap/store-buffer.h" 11 #include "src/heap/store-buffer.h"
12 #include "src/macro-assembler.h"
12 13
13 namespace v8 { 14 namespace v8 {
14 namespace internal { 15 namespace internal {
15 16
16 template <PointerDirection direction> 17 template <PointerDirection direction>
17 void RememberedSet<direction>::ClearInvalidSlots(Heap* heap) { 18 void RememberedSet<direction>::ClearInvalidSlots(Heap* heap) {
18 STATIC_ASSERT(direction == OLD_TO_NEW); 19 STATIC_ASSERT(direction == OLD_TO_NEW);
19 for (MemoryChunk* chunk : *heap->old_space()) { 20 for (MemoryChunk* chunk : *heap->old_space()) {
20 SlotSet* slots = GetSlotSet(chunk); 21 SlotSet* slots = GetSlotSet(chunk);
21 if (slots != nullptr) { 22 if (slots != nullptr) {
22 slots->Iterate([heap, chunk](Address addr) { 23 slots->Iterate([heap, chunk](Address addr) {
23 Object** slot = reinterpret_cast<Object**>(addr); 24 Object** slot = reinterpret_cast<Object**>(addr);
24 return IsValidSlot(heap, chunk, slot) ? KEEP_SLOT : REMOVE_SLOT; 25 return IsValidSlot(heap, chunk, slot) ? KEEP_SLOT : REMOVE_SLOT;
25 }); 26 });
26 } 27 }
27 } 28 }
29 for (MemoryChunk* chunk : *heap->code_space()) {
30 TypedSlotSet* slots = GetTypedSlotSet(chunk);
31 if (slots != nullptr) {
32 slots->Iterate(
33 [heap, chunk](SlotType type, Address host_addr, Address addr) {
34 if (Marking::IsBlack(Marking::MarkBitFrom(host_addr))) {
35 return KEEP_SLOT;
36 } else {
37 return REMOVE_SLOT;
38 }
39 });
40 }
41 }
28 } 42 }
29 43
30 template <PointerDirection direction> 44 template <PointerDirection direction>
31 void RememberedSet<direction>::VerifyValidSlots(Heap* heap) { 45 void RememberedSet<direction>::VerifyValidSlots(Heap* heap) {
32 Iterate(heap, [heap](Address addr) { 46 Iterate(heap, [heap](Address addr) {
33 HeapObject* obj = 47 HeapObject* obj =
34 heap->mark_compact_collector()->FindBlackObjectBySlotSlow(addr); 48 heap->mark_compact_collector()->FindBlackObjectBySlotSlow(addr);
35 if (obj == nullptr) { 49 if (obj == nullptr) {
36 // The slot is in dead object. 50 // The slot is in dead object.
37 MemoryChunk* chunk = MemoryChunk::FromAnyPointerAddress(heap, addr); 51 MemoryChunk* chunk = MemoryChunk::FromAnyPointerAddress(heap, addr);
(...skipping 27 matching lines...) Expand all
65 heap->mark_compact_collector()->IsSlotInBlackObject( 79 heap->mark_compact_collector()->IsSlotInBlackObject(
66 chunk, reinterpret_cast<Address>(slot)); 80 chunk, reinterpret_cast<Address>(slot));
67 } 81 }
68 82
69 template void RememberedSet<OLD_TO_NEW>::ClearInvalidSlots(Heap* heap); 83 template void RememberedSet<OLD_TO_NEW>::ClearInvalidSlots(Heap* heap);
70 template void RememberedSet<OLD_TO_NEW>::VerifyValidSlots(Heap* heap); 84 template void RememberedSet<OLD_TO_NEW>::VerifyValidSlots(Heap* heap);
71 template void RememberedSet<OLD_TO_OLD>::VerifyValidSlots(Heap* heap); 85 template void RememberedSet<OLD_TO_OLD>::VerifyValidSlots(Heap* heap);
72 86
73 } // namespace internal 87 } // namespace internal
74 } // namespace v8 88 } // namespace v8
OLDNEW
« no previous file with comments | « src/heap/remembered-set.h ('k') | src/ia32/assembler-ia32-inl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698