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

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

Issue 2731363002: [heap] Do not clear mark bits of left trimmed old object start. (Closed)
Patch Set: comment fix Created 3 years, 9 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/heap.cc ('k') | src/heap/mark-compact-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 #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 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
131 if (!heap->incremental_marking()->IsMarking()) return; 131 if (!heap->incremental_marking()->IsMarking()) return;
132 132
133 // If the mark doesn't move, we don't check the color of the object. 133 // If the mark doesn't move, we don't check the color of the object.
134 // It doesn't matter whether the object is black, since it hasn't changed 134 // It doesn't matter whether the object is black, since it hasn't changed
135 // size, so the adjustment to the live data count will be zero anyway. 135 // size, so the adjustment to the live data count will be zero anyway.
136 if (from == to) return; 136 if (from == to) return;
137 137
138 MarkBit new_mark_bit = ObjectMarking::MarkBitFrom(to); 138 MarkBit new_mark_bit = ObjectMarking::MarkBitFrom(to);
139 MarkBit old_mark_bit = ObjectMarking::MarkBitFrom(from); 139 MarkBit old_mark_bit = ObjectMarking::MarkBitFrom(from);
140 140
141 #ifdef DEBUG
142 Marking::ObjectColor old_color = Marking::Color(old_mark_bit);
143 #endif
144
145 if (Marking::IsBlack(old_mark_bit)) { 141 if (Marking::IsBlack(old_mark_bit)) {
146 Marking::MarkWhite(old_mark_bit); 142 Marking::MarkBlack(new_mark_bit);
147 Marking::WhiteToBlack(new_mark_bit);
148 return;
149 } else if (Marking::IsGrey(old_mark_bit)) { 143 } else if (Marking::IsGrey(old_mark_bit)) {
150 Marking::MarkWhite(old_mark_bit); 144 Marking::MarkGrey(new_mark_bit);
151 Marking::WhiteToGrey(new_mark_bit);
152 heap->mark_compact_collector()->marking_deque()->Push(to); 145 heap->mark_compact_collector()->marking_deque()->Push(to);
153 heap->incremental_marking()->RestartIfNotMarking(); 146 heap->incremental_marking()->RestartIfNotMarking();
154 } 147 }
155
156 #ifdef DEBUG
157 Marking::ObjectColor new_color = Marking::Color(new_mark_bit);
158 DCHECK(new_color == old_color);
159 #endif
160 } 148 }
161 149
162 class IncrementalMarkingMarkingVisitor 150 class IncrementalMarkingMarkingVisitor
163 : public StaticMarkingVisitor<IncrementalMarkingMarkingVisitor> { 151 : public StaticMarkingVisitor<IncrementalMarkingMarkingVisitor> {
164 public: 152 public:
165 static void Initialize() { 153 static void Initialize() {
166 StaticMarkingVisitor<IncrementalMarkingMarkingVisitor>::Initialize(); 154 StaticMarkingVisitor<IncrementalMarkingMarkingVisitor>::Initialize();
167 table_.Register(kVisitFixedArray, &VisitFixedArrayIncremental); 155 table_.Register(kVisitFixedArray, &VisitFixedArrayIncremental);
168 table_.Register(kVisitNativeContext, &VisitNativeContextIncremental); 156 table_.Register(kVisitNativeContext, &VisitNativeContextIncremental);
169 } 157 }
(...skipping 658 matching lines...) Expand 10 before | Expand all | Expand 10 after
828 816
829 intptr_t IncrementalMarking::ProcessMarkingDeque( 817 intptr_t IncrementalMarking::ProcessMarkingDeque(
830 intptr_t bytes_to_process, ForceCompletionAction completion) { 818 intptr_t bytes_to_process, ForceCompletionAction completion) {
831 intptr_t bytes_processed = 0; 819 intptr_t bytes_processed = 0;
832 MarkingDeque* marking_deque = 820 MarkingDeque* marking_deque =
833 heap_->mark_compact_collector()->marking_deque(); 821 heap_->mark_compact_collector()->marking_deque();
834 while (!marking_deque->IsEmpty() && (bytes_processed < bytes_to_process || 822 while (!marking_deque->IsEmpty() && (bytes_processed < bytes_to_process ||
835 completion == FORCE_COMPLETION)) { 823 completion == FORCE_COMPLETION)) {
836 HeapObject* obj = marking_deque->Pop(); 824 HeapObject* obj = marking_deque->Pop();
837 825
838 // Left trimming may result in white filler objects on the marking deque. 826 // Left trimming may result in white, grey, or black filler objects on the
839 // Ignore these objects. 827 // marking deque. Ignore these objects.
840 if (obj->IsFiller()) { 828 if (obj->IsFiller()) {
841 DCHECK(ObjectMarking::IsImpossible(obj) || ObjectMarking::IsWhite(obj)); 829 DCHECK(!ObjectMarking::IsImpossible(obj));
842 continue; 830 continue;
843 } 831 }
844 832
845 Map* map = obj->map(); 833 Map* map = obj->map();
846 int size = obj->SizeFromMap(map); 834 int size = obj->SizeFromMap(map);
847 unscanned_bytes_of_large_object_ = 0; 835 unscanned_bytes_of_large_object_ = 0;
848 VisitObject(map, obj, size); 836 VisitObject(map, obj, size);
849 bytes_processed += size - unscanned_bytes_of_large_object_; 837 bytes_processed += size - unscanned_bytes_of_large_object_;
850 } 838 }
851 // Report all found wrappers to the embedder. This is necessary as the 839 // Report all found wrappers to the embedder. This is necessary as the
(...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after
1168 idle_marking_delay_counter_++; 1156 idle_marking_delay_counter_++;
1169 } 1157 }
1170 1158
1171 1159
1172 void IncrementalMarking::ClearIdleMarkingDelayCounter() { 1160 void IncrementalMarking::ClearIdleMarkingDelayCounter() {
1173 idle_marking_delay_counter_ = 0; 1161 idle_marking_delay_counter_ = 0;
1174 } 1162 }
1175 1163
1176 } // namespace internal 1164 } // namespace internal
1177 } // namespace v8 1165 } // namespace v8
OLDNEW
« no previous file with comments | « src/heap/heap.cc ('k') | src/heap/mark-compact-inl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698