| OLD | NEW |
| 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/concurrent-marking.h" | 10 #include "src/heap/concurrent-marking.h" |
| 11 #include "src/heap/gc-idle-time-handler.h" | 11 #include "src/heap/gc-idle-time-handler.h" |
| 12 #include "src/heap/gc-tracer.h" | 12 #include "src/heap/gc-tracer.h" |
| 13 #include "src/heap/heap-inl.h" | 13 #include "src/heap/heap-inl.h" |
| 14 #include "src/heap/mark-compact-inl.h" | 14 #include "src/heap/mark-compact-inl.h" |
| 15 #include "src/heap/object-stats.h" | 15 #include "src/heap/object-stats.h" |
| 16 #include "src/heap/objects-visiting-inl.h" | 16 #include "src/heap/objects-visiting-inl.h" |
| 17 #include "src/heap/objects-visiting.h" | 17 #include "src/heap/objects-visiting.h" |
| 18 #include "src/tracing/trace-event.h" | 18 #include "src/tracing/trace-event.h" |
| 19 #include "src/v8.h" | 19 #include "src/v8.h" |
| 20 #include "src/visitors.h" |
| 20 | 21 |
| 21 namespace v8 { | 22 namespace v8 { |
| 22 namespace internal { | 23 namespace internal { |
| 23 | 24 |
| 24 IncrementalMarking::IncrementalMarking(Heap* heap) | 25 IncrementalMarking::IncrementalMarking(Heap* heap) |
| 25 : heap_(heap), | 26 : heap_(heap), |
| 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), |
| 29 state_(STOPPED), | 30 state_(STOPPED), |
| (...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 273 if ((page->owner() != nullptr) && (page->owner()->identity() == LO_SPACE)) { | 274 if ((page->owner() != nullptr) && (page->owner()->identity() == LO_SPACE)) { |
| 274 // IterateBlackObject requires us to visit the whole object. | 275 // IterateBlackObject requires us to visit the whole object. |
| 275 page->ResetProgressBar(); | 276 page->ResetProgressBar(); |
| 276 } | 277 } |
| 277 Map* map = object->map(); | 278 Map* map = object->map(); |
| 278 MarkGrey(heap_, map); | 279 MarkGrey(heap_, map); |
| 279 IncrementalMarkingMarkingVisitor::IterateBody(map, object); | 280 IncrementalMarkingMarkingVisitor::IterateBody(map, object); |
| 280 } | 281 } |
| 281 } | 282 } |
| 282 | 283 |
| 283 class IncrementalMarkingRootMarkingVisitor : public ObjectVisitor { | 284 class IncrementalMarkingRootMarkingVisitor : public RootVisitor { |
| 284 public: | 285 public: |
| 285 explicit IncrementalMarkingRootMarkingVisitor( | 286 explicit IncrementalMarkingRootMarkingVisitor( |
| 286 IncrementalMarking* incremental_marking) | 287 IncrementalMarking* incremental_marking) |
| 287 : heap_(incremental_marking->heap()) {} | 288 : heap_(incremental_marking->heap()) {} |
| 288 | 289 |
| 289 void VisitPointer(Object** p) override { MarkObjectByPointer(p); } | 290 void VisitRootPointer(Root root, Object** p) override { |
| 291 MarkObjectByPointer(p); |
| 292 } |
| 290 | 293 |
| 291 void VisitPointers(Object** start, Object** end) override { | 294 void VisitRootPointers(Root root, Object** start, Object** end) override { |
| 292 for (Object** p = start; p < end; p++) MarkObjectByPointer(p); | 295 for (Object** p = start; p < end; p++) MarkObjectByPointer(p); |
| 293 } | 296 } |
| 294 | 297 |
| 295 private: | 298 private: |
| 296 void MarkObjectByPointer(Object** p) { | 299 void MarkObjectByPointer(Object** p) { |
| 297 Object* obj = *p; | 300 Object* obj = *p; |
| 298 if (!obj->IsHeapObject()) return; | 301 if (!obj->IsHeapObject()) return; |
| 299 | 302 |
| 300 IncrementalMarking::MarkGrey(heap_, HeapObject::cast(obj)); | 303 IncrementalMarking::MarkGrey(heap_, HeapObject::cast(obj)); |
| 301 } | 304 } |
| (...skipping 882 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1184 idle_marking_delay_counter_++; | 1187 idle_marking_delay_counter_++; |
| 1185 } | 1188 } |
| 1186 | 1189 |
| 1187 | 1190 |
| 1188 void IncrementalMarking::ClearIdleMarkingDelayCounter() { | 1191 void IncrementalMarking::ClearIdleMarkingDelayCounter() { |
| 1189 idle_marking_delay_counter_ = 0; | 1192 idle_marking_delay_counter_ = 0; |
| 1190 } | 1193 } |
| 1191 | 1194 |
| 1192 } // namespace internal | 1195 } // namespace internal |
| 1193 } // namespace v8 | 1196 } // namespace v8 |
| OLD | NEW |