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

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

Issue 1273483002: GC: Refactor public incremental marking interface in heap (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Addressed nit Created 5 years, 4 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/incremental-marking.h ('k') | no next file » | 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/v8.h" 5 #include "src/v8.h"
6 6
7 #include "src/heap/incremental-marking.h" 7 #include "src/heap/incremental-marking.h"
8 8
9 #include "src/code-stubs.h" 9 #include "src/code-stubs.h"
10 #include "src/compilation-cache.h" 10 #include "src/compilation-cache.h"
11 #include "src/conversions.h" 11 #include "src/conversions.h"
12 #include "src/heap/objects-visiting.h" 12 #include "src/heap/objects-visiting.h"
13 #include "src/heap/objects-visiting-inl.h" 13 #include "src/heap/objects-visiting-inl.h"
14 14
15 namespace v8 { 15 namespace v8 {
16 namespace internal { 16 namespace internal {
17 17
18 18
19 IncrementalMarking::StepActions IncrementalMarking::NoForcedStepActions() {
20 return StepActions(IncrementalMarking::NO_GC_VIA_STACK_GUARD,
21 IncrementalMarking::DO_NOT_FORCE_MARKING,
22 IncrementalMarking::DO_NOT_FORCE_COMPLETION);
23 }
24
25
19 IncrementalMarking::IncrementalMarking(Heap* heap) 26 IncrementalMarking::IncrementalMarking(Heap* heap)
20 : heap_(heap), 27 : heap_(heap),
21 state_(STOPPED), 28 state_(STOPPED),
22 steps_count_(0), 29 steps_count_(0),
23 old_generation_space_available_at_start_of_incremental_(0), 30 old_generation_space_available_at_start_of_incremental_(0),
24 old_generation_space_used_at_start_of_incremental_(0), 31 old_generation_space_used_at_start_of_incremental_(0),
25 should_hurry_(false), 32 should_hurry_(false),
26 marking_speed_(0), 33 marking_speed_(0),
27 allocated_(0), 34 allocated_(0),
28 idle_marking_delay_counter_(0), 35 idle_marking_delay_counter_(0),
(...skipping 434 matching lines...) Expand 10 before | Expand all | Expand 10 after
463 Object* e = stubs->ValueAt(i); 470 Object* e = stubs->ValueAt(i);
464 if (e->IsCode()) { 471 if (e->IsCode()) {
465 RecordWriteStub::Patch(Code::cast(e), mode); 472 RecordWriteStub::Patch(Code::cast(e), mode);
466 } 473 }
467 } 474 }
468 } 475 }
469 } 476 }
470 } 477 }
471 478
472 479
473 void IncrementalMarking::Start(int mark_compact_flags) { 480 void IncrementalMarking::Start(int mark_compact_flags,
481 const GCCallbackFlags gc_callback_flags,
482 const char* reason) {
474 if (FLAG_trace_incremental_marking) { 483 if (FLAG_trace_incremental_marking) {
475 PrintF("[IncrementalMarking] Start\n"); 484 PrintF("[IncrementalMarking] Start (%s)\n",
485 (reason == nullptr) ? "unknown reason" : reason);
476 } 486 }
477 DCHECK(FLAG_incremental_marking); 487 DCHECK(FLAG_incremental_marking);
478 DCHECK(FLAG_incremental_marking_steps); 488 DCHECK(FLAG_incremental_marking_steps);
479 DCHECK(state_ == STOPPED); 489 DCHECK(state_ == STOPPED);
480 DCHECK(heap_->gc_state() == Heap::NOT_IN_GC); 490 DCHECK(heap_->gc_state() == Heap::NOT_IN_GC);
481 DCHECK(!heap_->isolate()->serializer_enabled()); 491 DCHECK(!heap_->isolate()->serializer_enabled());
482 492
483 ResetStepCounters(); 493 ResetStepCounters();
484 494
495 gc_callback_flags_ = gc_callback_flags;
485 was_activated_ = true; 496 was_activated_ = true;
486 497
487 if (!heap_->mark_compact_collector()->sweeping_in_progress()) { 498 if (!heap_->mark_compact_collector()->sweeping_in_progress()) {
488 heap_->mark_compact_collector()->SetFlags(mark_compact_flags); 499 heap_->mark_compact_collector()->SetFlags(mark_compact_flags);
489 StartMarking(); 500 StartMarking();
490 heap_->mark_compact_collector()->SetFlags(Heap::kNoGCFlags); 501 heap_->mark_compact_collector()->SetFlags(Heap::kNoGCFlags);
491 } else { 502 } else {
492 if (FLAG_trace_incremental_marking) { 503 if (FLAG_trace_incremental_marking) {
493 PrintF("[IncrementalMarking] Start sweeping.\n"); 504 PrintF("[IncrementalMarking] Start sweeping.\n");
494 } 505 }
(...skipping 322 matching lines...) Expand 10 before | Expand all | Expand 10 after
817 828
818 void IncrementalMarking::Epilogue() { 829 void IncrementalMarking::Epilogue() {
819 was_activated_ = false; 830 was_activated_ = false;
820 weak_closure_was_overapproximated_ = false; 831 weak_closure_was_overapproximated_ = false;
821 weak_closure_approximation_rounds_ = 0; 832 weak_closure_approximation_rounds_ = 0;
822 } 833 }
823 834
824 835
825 void IncrementalMarking::OldSpaceStep(intptr_t allocated) { 836 void IncrementalMarking::OldSpaceStep(intptr_t allocated) {
826 if (IsStopped() && ShouldActivateEvenWithoutIdleNotification()) { 837 if (IsStopped() && ShouldActivateEvenWithoutIdleNotification()) {
827 Start(Heap::kNoGCFlags); 838 Start(Heap::kNoGCFlags, kNoGCCallbackFlags, "old space step");
828 } else { 839 } else {
829 Step(allocated * kFastMarking / kInitialMarkingSpeed, GC_VIA_STACK_GUARD); 840 Step(allocated * kFastMarking / kInitialMarkingSpeed, GC_VIA_STACK_GUARD);
830 } 841 }
831 } 842 }
832 843
833 844
834 void IncrementalMarking::SpeedUp() { 845 void IncrementalMarking::SpeedUp() {
835 bool speed_up = false; 846 bool speed_up = false;
836 847
837 if ((steps_count_ % kMarkingSpeedAccellerationInterval) == 0) { 848 if ((steps_count_ % kMarkingSpeedAccellerationInterval) == 0) {
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after
1021 void IncrementalMarking::IncrementIdleMarkingDelayCounter() { 1032 void IncrementalMarking::IncrementIdleMarkingDelayCounter() {
1022 idle_marking_delay_counter_++; 1033 idle_marking_delay_counter_++;
1023 } 1034 }
1024 1035
1025 1036
1026 void IncrementalMarking::ClearIdleMarkingDelayCounter() { 1037 void IncrementalMarking::ClearIdleMarkingDelayCounter() {
1027 idle_marking_delay_counter_ = 0; 1038 idle_marking_delay_counter_ = 0;
1028 } 1039 }
1029 } // namespace internal 1040 } // namespace internal
1030 } // namespace v8 1041 } // namespace v8
OLDNEW
« no previous file with comments | « src/heap/incremental-marking.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698