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

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

Issue 2728113002: [heap] Remove Marking::AnyToGrey and change its callers to use simple marking functions. (Closed)
Patch Set: fixed comment 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 | « no previous file | 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 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
114 // Object is not going to be rescanned. We need to record the slot. 114 // Object is not going to be rescanned. We need to record the slot.
115 heap_->mark_compact_collector()->RecordRelocSlot(host, rinfo, value); 115 heap_->mark_compact_collector()->RecordRelocSlot(host, rinfo, value);
116 } 116 }
117 } 117 }
118 118
119 void IncrementalMarking::WhiteToGreyAndPush(HeapObject* obj) { 119 void IncrementalMarking::WhiteToGreyAndPush(HeapObject* obj) {
120 ObjectMarking::WhiteToGrey(obj); 120 ObjectMarking::WhiteToGrey(obj);
121 heap_->mark_compact_collector()->marking_deque()->Push(obj); 121 heap_->mark_compact_collector()->marking_deque()->Push(obj);
122 } 122 }
123 123
124
125 static void MarkObjectGreyDoNotEnqueue(Object* obj) {
126 if (obj->IsHeapObject()) {
127 HeapObject* heap_obj = HeapObject::cast(obj);
128 ObjectMarking::AnyToGrey(heap_obj);
129 }
130 }
131
132 void IncrementalMarking::TransferMark(Heap* heap, HeapObject* from, 124 void IncrementalMarking::TransferMark(Heap* heap, HeapObject* from,
133 HeapObject* to) { 125 HeapObject* to) {
134 DCHECK(MemoryChunk::FromAddress(from->address())->SweepingDone()); 126 DCHECK(MemoryChunk::FromAddress(from->address())->SweepingDone());
135 // This is only used when resizing an object. 127 // This is only used when resizing an object.
136 DCHECK(MemoryChunk::FromAddress(from->address()) == 128 DCHECK(MemoryChunk::FromAddress(from->address()) ==
137 MemoryChunk::FromAddress(to->address())); 129 MemoryChunk::FromAddress(to->address()));
138 130
139 if (!heap->incremental_marking()->IsMarking()) return; 131 if (!heap->incremental_marking()->IsMarking()) return;
140 132
141 // 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.
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
220 } 212 }
221 213
222 static void VisitNativeContextIncremental(Map* map, HeapObject* object) { 214 static void VisitNativeContextIncremental(Map* map, HeapObject* object) {
223 Context* context = Context::cast(object); 215 Context* context = Context::cast(object);
224 216
225 // We will mark cache black with a separate pass when we finish marking. 217 // We will mark cache black with a separate pass when we finish marking.
226 // Note that GC can happen when the context is not fully initialized, 218 // Note that GC can happen when the context is not fully initialized,
227 // so the cache can be undefined. 219 // so the cache can be undefined.
228 Object* cache = context->get(Context::NORMALIZED_MAP_CACHE_INDEX); 220 Object* cache = context->get(Context::NORMALIZED_MAP_CACHE_INDEX);
229 if (!cache->IsUndefined(map->GetIsolate())) { 221 if (!cache->IsUndefined(map->GetIsolate())) {
230 MarkObjectGreyDoNotEnqueue(cache); 222 if (cache->IsHeapObject()) {
223 HeapObject* heap_obj = HeapObject::cast(cache);
224 // Mark the object grey if it is white, do not enque it into the marking
225 // deque.
226 if (ObjectMarking::IsWhite(heap_obj)) {
227 ObjectMarking::WhiteToGrey(heap_obj);
228 }
229 }
231 } 230 }
232 VisitNativeContext(map, context); 231 VisitNativeContext(map, context);
233 } 232 }
234 233
235 INLINE(static void VisitPointer(Heap* heap, HeapObject* object, Object** p)) { 234 INLINE(static void VisitPointer(Heap* heap, HeapObject* object, Object** p)) {
236 Object* target = *p; 235 Object* target = *p;
237 if (target->IsHeapObject()) { 236 if (target->IsHeapObject()) {
238 heap->mark_compact_collector()->RecordSlot(object, p, target); 237 heap->mark_compact_collector()->RecordSlot(object, p, target);
239 MarkObject(heap, target); 238 MarkObject(heap, target);
240 } 239 }
(...skipping 928 matching lines...) Expand 10 before | Expand all | Expand 10 after
1169 idle_marking_delay_counter_++; 1168 idle_marking_delay_counter_++;
1170 } 1169 }
1171 1170
1172 1171
1173 void IncrementalMarking::ClearIdleMarkingDelayCounter() { 1172 void IncrementalMarking::ClearIdleMarkingDelayCounter() {
1174 idle_marking_delay_counter_ = 0; 1173 idle_marking_delay_counter_ = 0;
1175 } 1174 }
1176 1175
1177 } // namespace internal 1176 } // namespace internal
1178 } // namespace v8 1177 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | src/heap/mark-compact.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698