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

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

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