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

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

Issue 2090983002: Revert of 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: 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"
13 12
14 namespace v8 { 13 namespace v8 {
15 namespace internal { 14 namespace internal {
16 15
17 template <PointerDirection direction> 16 template <PointerDirection direction>
18 void RememberedSet<direction>::ClearInvalidSlots(Heap* heap) { 17 void RememberedSet<direction>::ClearInvalidSlots(Heap* heap) {
19 STATIC_ASSERT(direction == OLD_TO_NEW); 18 STATIC_ASSERT(direction == OLD_TO_NEW);
20 for (MemoryChunk* chunk : *heap->old_space()) { 19 for (MemoryChunk* chunk : *heap->old_space()) {
21 SlotSet* slots = GetSlotSet(chunk); 20 SlotSet* slots = GetSlotSet(chunk);
22 if (slots != nullptr) { 21 if (slots != nullptr) {
23 slots->Iterate([heap, chunk](Address addr) { 22 slots->Iterate([heap, chunk](Address addr) {
24 Object** slot = reinterpret_cast<Object**>(addr); 23 Object** slot = reinterpret_cast<Object**>(addr);
25 return IsValidSlot(heap, chunk, slot) ? KEEP_SLOT : REMOVE_SLOT; 24 return IsValidSlot(heap, chunk, slot) ? KEEP_SLOT : REMOVE_SLOT;
26 }); 25 });
27 } 26 }
28 } 27 }
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 }
42 } 28 }
43 29
44 template <PointerDirection direction> 30 template <PointerDirection direction>
45 void RememberedSet<direction>::VerifyValidSlots(Heap* heap) { 31 void RememberedSet<direction>::VerifyValidSlots(Heap* heap) {
46 Iterate(heap, [heap](Address addr) { 32 Iterate(heap, [heap](Address addr) {
47 HeapObject* obj = 33 HeapObject* obj =
48 heap->mark_compact_collector()->FindBlackObjectBySlotSlow(addr); 34 heap->mark_compact_collector()->FindBlackObjectBySlotSlow(addr);
49 if (obj == nullptr) { 35 if (obj == nullptr) {
50 // The slot is in dead object. 36 // The slot is in dead object.
51 MemoryChunk* chunk = MemoryChunk::FromAnyPointerAddress(heap, addr); 37 MemoryChunk* chunk = MemoryChunk::FromAnyPointerAddress(heap, addr);
(...skipping 27 matching lines...) Expand all
79 heap->mark_compact_collector()->IsSlotInBlackObject( 65 heap->mark_compact_collector()->IsSlotInBlackObject(
80 chunk, reinterpret_cast<Address>(slot)); 66 chunk, reinterpret_cast<Address>(slot));
81 } 67 }
82 68
83 template void RememberedSet<OLD_TO_NEW>::ClearInvalidSlots(Heap* heap); 69 template void RememberedSet<OLD_TO_NEW>::ClearInvalidSlots(Heap* heap);
84 template void RememberedSet<OLD_TO_NEW>::VerifyValidSlots(Heap* heap); 70 template void RememberedSet<OLD_TO_NEW>::VerifyValidSlots(Heap* heap);
85 template void RememberedSet<OLD_TO_OLD>::VerifyValidSlots(Heap* heap); 71 template void RememberedSet<OLD_TO_OLD>::VerifyValidSlots(Heap* heap);
86 72
87 } // namespace internal 73 } // namespace internal
88 } // namespace v8 74 } // 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