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

Side by Side Diff: src/heap/incremental-marking.cc

Issue 2638803002: [heap] Remove markbits getter from raw address (Closed)
Patch Set: Fix LeftTrim Created 3 years, 11 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/incremental-marking.h ('k') | src/heap/mark-compact.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 #include "src/heap/incremental-marking.h" 5 #include "src/heap/incremental-marking.h"
6 6
7 #include "src/code-stubs.h" 7 #include "src/code-stubs.h"
8 #include "src/compilation-cache.h" 8 #include "src/compilation-cache.h"
9 #include "src/conversions.h" 9 #include "src/conversions.h"
10 #include "src/heap/gc-idle-time-handler.h" 10 #include "src/heap/gc-idle-time-handler.h"
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
129 if (obj->IsHeapObject()) { 129 if (obj->IsHeapObject()) {
130 HeapObject* heap_obj = HeapObject::cast(obj); 130 HeapObject* heap_obj = HeapObject::cast(obj);
131 MarkBit mark_bit = ObjectMarking::MarkBitFrom(HeapObject::cast(obj)); 131 MarkBit mark_bit = ObjectMarking::MarkBitFrom(HeapObject::cast(obj));
132 if (Marking::IsBlack(mark_bit)) { 132 if (Marking::IsBlack(mark_bit)) {
133 MemoryChunk::IncrementLiveBytes(heap_obj, -heap_obj->Size()); 133 MemoryChunk::IncrementLiveBytes(heap_obj, -heap_obj->Size());
134 } 134 }
135 Marking::AnyToGrey(mark_bit); 135 Marking::AnyToGrey(mark_bit);
136 } 136 }
137 } 137 }
138 138
139 void IncrementalMarking::TransferMark(Heap* heap, Address old_start, 139 void IncrementalMarking::TransferMark(Heap* heap, HeapObject* from,
140 Address new_start) { 140 HeapObject* to) {
141 // This is only used when resizing an object. 141 // This is only used when resizing an object.
142 DCHECK(MemoryChunk::FromAddress(old_start) == 142 DCHECK(MemoryChunk::FromAddress(from->address()) ==
143 MemoryChunk::FromAddress(new_start)); 143 MemoryChunk::FromAddress(to->address()));
144 144
145 if (!heap->incremental_marking()->IsMarking()) return; 145 if (!heap->incremental_marking()->IsMarking()) return;
146 146
147 // If the mark doesn't move, we don't check the color of the object. 147 // If the mark doesn't move, we don't check the color of the object.
148 // It doesn't matter whether the object is black, since it hasn't changed 148 // It doesn't matter whether the object is black, since it hasn't changed
149 // size, so the adjustment to the live data count will be zero anyway. 149 // size, so the adjustment to the live data count will be zero anyway.
150 if (old_start == new_start) return; 150 if (from == to) return;
151 151
152 MarkBit new_mark_bit = ObjectMarking::MarkBitFrom(new_start); 152 MarkBit new_mark_bit = ObjectMarking::MarkBitFrom(to);
153 MarkBit old_mark_bit = ObjectMarking::MarkBitFrom(old_start); 153 MarkBit old_mark_bit = ObjectMarking::MarkBitFrom(from);
154 154
155 #ifdef DEBUG 155 #ifdef DEBUG
156 Marking::ObjectColor old_color = Marking::Color(old_mark_bit); 156 Marking::ObjectColor old_color = Marking::Color(old_mark_bit);
157 #endif 157 #endif
158 158
159 if (Marking::IsBlack(old_mark_bit)) { 159 if (Marking::IsBlack(old_mark_bit)) {
160 Marking::BlackToWhite(old_mark_bit); 160 Marking::BlackToWhite(old_mark_bit);
161 Marking::MarkBlack(new_mark_bit); 161 Marking::MarkBlack(new_mark_bit);
162 return; 162 return;
163 } else if (Marking::IsGrey(old_mark_bit)) { 163 } else if (Marking::IsGrey(old_mark_bit)) {
164 Marking::GreyToWhite(old_mark_bit); 164 Marking::GreyToWhite(old_mark_bit);
165 heap->incremental_marking()->WhiteToGreyAndPush( 165 heap->incremental_marking()->WhiteToGreyAndPush(to, new_mark_bit);
166 HeapObject::FromAddress(new_start), new_mark_bit);
167 heap->incremental_marking()->RestartIfNotMarking(); 166 heap->incremental_marking()->RestartIfNotMarking();
168 } 167 }
169 168
170 #ifdef DEBUG 169 #ifdef DEBUG
171 Marking::ObjectColor new_color = Marking::Color(new_mark_bit); 170 Marking::ObjectColor new_color = Marking::Color(new_mark_bit);
172 DCHECK(new_color == old_color); 171 DCHECK(new_color == old_color);
173 #endif 172 #endif
174 } 173 }
175 174
176 class IncrementalMarkingMarkingVisitor 175 class IncrementalMarkingMarkingVisitor
(...skipping 624 matching lines...) Expand 10 before | Expand all | Expand 10 after
801 // Only pointers to from space have to be updated. 800 // Only pointers to from space have to be updated.
802 if (heap_->InFromSpace(obj)) { 801 if (heap_->InFromSpace(obj)) {
803 MapWord map_word = obj->map_word(); 802 MapWord map_word = obj->map_word();
804 // There may be objects on the marking deque that do not exist anymore, 803 // There may be objects on the marking deque that do not exist anymore,
805 // e.g. left trimmed objects or objects from the root set (frames). 804 // e.g. left trimmed objects or objects from the root set (frames).
806 // If these object are dead at scavenging time, their marking deque 805 // If these object are dead at scavenging time, their marking deque
807 // entries will not point to forwarding addresses. Hence, we can discard 806 // entries will not point to forwarding addresses. Hence, we can discard
808 // them. 807 // them.
809 if (map_word.IsForwardingAddress()) { 808 if (map_word.IsForwardingAddress()) {
810 HeapObject* dest = map_word.ToForwardingAddress(); 809 HeapObject* dest = map_word.ToForwardingAddress();
811 if (Marking::IsBlack(ObjectMarking::MarkBitFrom(dest->address()))) 810 if (Marking::IsBlack(ObjectMarking::MarkBitFrom(dest))) continue;
812 continue;
813 array[new_top] = dest; 811 array[new_top] = dest;
814 new_top = ((new_top + 1) & mask); 812 new_top = ((new_top + 1) & mask);
815 DCHECK(new_top != marking_deque->bottom()); 813 DCHECK(new_top != marking_deque->bottom());
816 #ifdef DEBUG 814 #ifdef DEBUG
817 MarkBit mark_bit = ObjectMarking::MarkBitFrom(obj); 815 MarkBit mark_bit = ObjectMarking::MarkBitFrom(obj);
818 DCHECK(Marking::IsGrey(mark_bit) || 816 DCHECK(Marking::IsGrey(mark_bit) ||
819 (obj->IsFiller() && Marking::IsWhite(mark_bit))); 817 (obj->IsFiller() && Marking::IsWhite(mark_bit)));
820 #endif 818 #endif
821 } 819 }
822 } else if (obj->map() != filler_map) { 820 } else if (obj->map() != filler_map) {
(...skipping 391 matching lines...) Expand 10 before | Expand all | Expand 10 after
1214 idle_marking_delay_counter_++; 1212 idle_marking_delay_counter_++;
1215 } 1213 }
1216 1214
1217 1215
1218 void IncrementalMarking::ClearIdleMarkingDelayCounter() { 1216 void IncrementalMarking::ClearIdleMarkingDelayCounter() {
1219 idle_marking_delay_counter_ = 0; 1217 idle_marking_delay_counter_ = 0;
1220 } 1218 }
1221 1219
1222 } // namespace internal 1220 } // namespace internal
1223 } // namespace v8 1221 } // namespace v8
OLDNEW
« no previous file with comments | « src/heap/incremental-marking.h ('k') | src/heap/mark-compact.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698