| 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/gc-idle-time-handler.h" | 10 #include "src/heap/gc-idle-time-handler.h" | 
| (...skipping 539 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 550     PrintF("[IncrementalMarking] Start marking\n"); | 550     PrintF("[IncrementalMarking] Start marking\n"); | 
| 551   } | 551   } | 
| 552 | 552 | 
| 553   is_compacting_ = !FLAG_never_compact && | 553   is_compacting_ = !FLAG_never_compact && | 
| 554                    heap_->mark_compact_collector()->StartCompaction( | 554                    heap_->mark_compact_collector()->StartCompaction( | 
| 555                        MarkCompactCollector::INCREMENTAL_COMPACTION); | 555                        MarkCompactCollector::INCREMENTAL_COMPACTION); | 
| 556 | 556 | 
| 557   state_ = MARKING; | 557   state_ = MARKING; | 
| 558 | 558 | 
| 559   if (heap_->UsingEmbedderHeapTracer()) { | 559   if (heap_->UsingEmbedderHeapTracer()) { | 
|  | 560     TRACE_GC(heap()->tracer(), | 
|  | 561              GCTracer::Scope::MC_INCREMENTAL_WRAPPER_PROLOGUE); | 
| 560     heap_->mark_compact_collector()->embedder_heap_tracer()->TracePrologue(); | 562     heap_->mark_compact_collector()->embedder_heap_tracer()->TracePrologue(); | 
| 561   } | 563   } | 
| 562 | 564 | 
| 563   RecordWriteStub::Mode mode = is_compacting_ | 565   RecordWriteStub::Mode mode = is_compacting_ | 
| 564                                    ? RecordWriteStub::INCREMENTAL_COMPACTION | 566                                    ? RecordWriteStub::INCREMENTAL_COMPACTION | 
| 565                                    : RecordWriteStub::INCREMENTAL; | 567                                    : RecordWriteStub::INCREMENTAL; | 
| 566 | 568 | 
| 567   PatchIncrementalMarkingRecordWriteStubs(heap_, mode); | 569   PatchIncrementalMarkingRecordWriteStubs(heap_, mode); | 
| 568 | 570 | 
| 569   heap_->mark_compact_collector()->EnsureMarkingDequeIsCommittedAndInitialize( | 571   heap_->mark_compact_collector()->EnsureMarkingDequeIsCommittedAndInitialize( | 
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 615 void IncrementalMarking::MarkRoots() { | 617 void IncrementalMarking::MarkRoots() { | 
| 616   DCHECK(!finalize_marking_completed_); | 618   DCHECK(!finalize_marking_completed_); | 
| 617   DCHECK(IsMarking()); | 619   DCHECK(IsMarking()); | 
| 618 | 620 | 
| 619   IncrementalMarkingRootMarkingVisitor visitor(this); | 621   IncrementalMarkingRootMarkingVisitor visitor(this); | 
| 620   heap_->IterateStrongRoots(&visitor, VISIT_ONLY_STRONG); | 622   heap_->IterateStrongRoots(&visitor, VISIT_ONLY_STRONG); | 
| 621 } | 623 } | 
| 622 | 624 | 
| 623 | 625 | 
| 624 void IncrementalMarking::MarkObjectGroups() { | 626 void IncrementalMarking::MarkObjectGroups() { | 
|  | 627   TRACE_GC(heap_->tracer(), | 
|  | 628            GCTracer::Scope::MC_INCREMENTAL_FINALIZE_OBJECT_GROUPING); | 
|  | 629 | 
| 625   DCHECK(!heap_->UsingEmbedderHeapTracer()); | 630   DCHECK(!heap_->UsingEmbedderHeapTracer()); | 
| 626   DCHECK(!finalize_marking_completed_); | 631   DCHECK(!finalize_marking_completed_); | 
| 627   DCHECK(IsMarking()); | 632   DCHECK(IsMarking()); | 
| 628 | 633 | 
| 629   IncrementalMarkingRootMarkingVisitor visitor(this); | 634   IncrementalMarkingRootMarkingVisitor visitor(this); | 
| 630   heap_->mark_compact_collector()->MarkImplicitRefGroups(&MarkGrey); | 635   heap_->mark_compact_collector()->MarkImplicitRefGroups(&MarkGrey); | 
| 631   heap_->isolate()->global_handles()->IterateObjectGroups( | 636   heap_->isolate()->global_handles()->IterateObjectGroups( | 
| 632       &visitor, &MarkCompactCollector::IsUnmarkedHeapObjectWithHeap); | 637       &visitor, &MarkCompactCollector::IsUnmarkedHeapObjectWithHeap); | 
| 633   heap_->isolate()->global_handles()->RemoveImplicitRefGroups(); | 638   heap_->isolate()->global_handles()->RemoveImplicitRefGroups(); | 
| 634   heap_->isolate()->global_handles()->RemoveObjectGroups(); | 639   heap_->isolate()->global_handles()->RemoveObjectGroups(); | 
| (...skipping 561 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 1196 | 1201 | 
| 1197     // TODO(hpayer): Do not account for sweeping finalization while marking. | 1202     // TODO(hpayer): Do not account for sweeping finalization while marking. | 
| 1198     if (state_ == SWEEPING) { | 1203     if (state_ == SWEEPING) { | 
| 1199       FinalizeSweeping(); | 1204       FinalizeSweeping(); | 
| 1200     } | 1205     } | 
| 1201 | 1206 | 
| 1202     if (state_ == MARKING) { | 1207     if (state_ == MARKING) { | 
| 1203       bytes_processed = ProcessMarkingDeque(bytes_to_process); | 1208       bytes_processed = ProcessMarkingDeque(bytes_to_process); | 
| 1204       if (FLAG_incremental_marking_wrappers && | 1209       if (FLAG_incremental_marking_wrappers && | 
| 1205           heap_->UsingEmbedderHeapTracer()) { | 1210           heap_->UsingEmbedderHeapTracer()) { | 
|  | 1211         TRACE_GC(heap()->tracer(), | 
|  | 1212                  GCTracer::Scope::MC_INCREMENTAL_WRAPPER_TRACING); | 
| 1206         // This currently marks through all registered wrappers and does not | 1213         // This currently marks through all registered wrappers and does not | 
| 1207         // respect bytes_to_process. | 1214         // respect bytes_to_process. | 
| 1208         // TODO(hpayer): Integrate incremental marking of wrappers into | 1215         // TODO(hpayer): Integrate incremental marking of wrappers into | 
| 1209         // bytes_to_process logic. | 1216         // bytes_to_process logic. | 
| 1210         heap_->mark_compact_collector() | 1217         heap_->mark_compact_collector() | 
| 1211             ->RegisterWrappersWithEmbedderHeapTracer(); | 1218             ->RegisterWrappersWithEmbedderHeapTracer(); | 
| 1212         heap_->mark_compact_collector()->embedder_heap_tracer()->AdvanceTracing( | 1219         heap_->mark_compact_collector()->embedder_heap_tracer()->AdvanceTracing( | 
| 1213             0, | 1220             0, | 
| 1214             EmbedderHeapTracer::AdvanceTracingActions( | 1221             EmbedderHeapTracer::AdvanceTracingActions( | 
| 1215                 EmbedderHeapTracer::ForceCompletionAction::FORCE_COMPLETION)); | 1222                 EmbedderHeapTracer::ForceCompletionAction::FORCE_COMPLETION)); | 
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 1271 void IncrementalMarking::IncrementIdleMarkingDelayCounter() { | 1278 void IncrementalMarking::IncrementIdleMarkingDelayCounter() { | 
| 1272   idle_marking_delay_counter_++; | 1279   idle_marking_delay_counter_++; | 
| 1273 } | 1280 } | 
| 1274 | 1281 | 
| 1275 | 1282 | 
| 1276 void IncrementalMarking::ClearIdleMarkingDelayCounter() { | 1283 void IncrementalMarking::ClearIdleMarkingDelayCounter() { | 
| 1277   idle_marking_delay_counter_ = 0; | 1284   idle_marking_delay_counter_ = 0; | 
| 1278 } | 1285 } | 
| 1279 }  // namespace internal | 1286 }  // namespace internal | 
| 1280 }  // namespace v8 | 1287 }  // namespace v8 | 
| OLD | NEW | 
|---|