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

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

Issue 2801073006: Decouple root visitors from object visitors. (Closed)
Patch Set: rebase Created 3 years, 8 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
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"
11 #include "src/heap/gc-tracer.h" 11 #include "src/heap/gc-tracer.h"
12 #include "src/heap/heap-inl.h" 12 #include "src/heap/heap-inl.h"
13 #include "src/heap/mark-compact-inl.h" 13 #include "src/heap/mark-compact-inl.h"
14 #include "src/heap/object-stats.h" 14 #include "src/heap/object-stats.h"
15 #include "src/heap/objects-visiting-inl.h" 15 #include "src/heap/objects-visiting-inl.h"
16 #include "src/heap/objects-visiting.h" 16 #include "src/heap/objects-visiting.h"
17 #include "src/tracing/trace-event.h" 17 #include "src/tracing/trace-event.h"
18 #include "src/v8.h" 18 #include "src/v8.h"
19 #include "src/visitors.h"
19 20
20 namespace v8 { 21 namespace v8 {
21 namespace internal { 22 namespace internal {
22 23
23 IncrementalMarking::IncrementalMarking(Heap* heap) 24 IncrementalMarking::IncrementalMarking(Heap* heap)
24 : heap_(heap), 25 : heap_(heap),
25 state_(STOPPED), 26 state_(STOPPED),
26 initial_old_generation_size_(0), 27 initial_old_generation_size_(0),
27 bytes_marked_ahead_of_schedule_(0), 28 bytes_marked_ahead_of_schedule_(0),
28 unscanned_bytes_of_large_object_(0), 29 unscanned_bytes_of_large_object_(0),
(...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after
272 if ((page->owner() != nullptr) && (page->owner()->identity() == LO_SPACE)) { 273 if ((page->owner() != nullptr) && (page->owner()->identity() == LO_SPACE)) {
273 // IterateBlackObject requires us to visit the whole object. 274 // IterateBlackObject requires us to visit the whole object.
274 page->ResetProgressBar(); 275 page->ResetProgressBar();
275 } 276 }
276 Map* map = object->map(); 277 Map* map = object->map();
277 MarkGrey(heap_, map); 278 MarkGrey(heap_, map);
278 IncrementalMarkingMarkingVisitor::IterateBody(map, object); 279 IncrementalMarkingMarkingVisitor::IterateBody(map, object);
279 } 280 }
280 } 281 }
281 282
282 class IncrementalMarkingRootMarkingVisitor : public ObjectVisitor { 283 class IncrementalMarkingRootMarkingVisitor : public RootVisitor {
283 public: 284 public:
284 explicit IncrementalMarkingRootMarkingVisitor( 285 explicit IncrementalMarkingRootMarkingVisitor(
285 IncrementalMarking* incremental_marking) 286 IncrementalMarking* incremental_marking)
286 : heap_(incremental_marking->heap()) {} 287 : heap_(incremental_marking->heap()) {}
287 288
288 void VisitPointer(Object** p) override { MarkObjectByPointer(p); } 289 void VisitRootPointer(Root root, Object** p) override {
290 MarkObjectByPointer(p);
291 }
289 292
290 void VisitPointers(Object** start, Object** end) override { 293 void VisitRootPointers(Root root, Object** start, Object** end) override {
291 for (Object** p = start; p < end; p++) MarkObjectByPointer(p); 294 for (Object** p = start; p < end; p++) MarkObjectByPointer(p);
292 } 295 }
293 296
294 private: 297 private:
295 void MarkObjectByPointer(Object** p) { 298 void MarkObjectByPointer(Object** p) {
296 Object* obj = *p; 299 Object* obj = *p;
297 if (!obj->IsHeapObject()) return; 300 if (!obj->IsHeapObject()) return;
298 301
299 IncrementalMarking::MarkGrey(heap_, HeapObject::cast(obj)); 302 IncrementalMarking::MarkGrey(heap_, HeapObject::cast(obj));
300 } 303 }
(...skipping 873 matching lines...) Expand 10 before | Expand all | Expand 10 after
1174 idle_marking_delay_counter_++; 1177 idle_marking_delay_counter_++;
1175 } 1178 }
1176 1179
1177 1180
1178 void IncrementalMarking::ClearIdleMarkingDelayCounter() { 1181 void IncrementalMarking::ClearIdleMarkingDelayCounter() {
1179 idle_marking_delay_counter_ = 0; 1182 idle_marking_delay_counter_ = 0;
1180 } 1183 }
1181 1184
1182 } // namespace internal 1185 } // namespace internal
1183 } // namespace v8 1186 } // namespace v8
OLDNEW
« no previous file with comments | « src/heap/heap-inl.h ('k') | src/heap/mark-compact.h » ('j') | src/heap/mark-compact.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698