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/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" |
(...skipping 803 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
814 was_activated_ = false; | 814 was_activated_ = false; |
815 weak_closure_was_overapproximated_ = false; | 815 weak_closure_was_overapproximated_ = false; |
816 weak_closure_approximation_rounds_ = 0; | 816 weak_closure_approximation_rounds_ = 0; |
817 } | 817 } |
818 | 818 |
819 | 819 |
820 void IncrementalMarking::OldSpaceStep(intptr_t allocated) { | 820 void IncrementalMarking::OldSpaceStep(intptr_t allocated) { |
821 if (IsStopped() && ShouldActivate()) { | 821 if (IsStopped() && ShouldActivate()) { |
822 Start(); | 822 Start(); |
823 } else { | 823 } else { |
824 Step(allocated * kFastMarking / kInitialMarkingSpeed, GC_VIA_STACK_GUARD); | 824 Step(allocated * kOldSpaceAllocationMarkingFactor, GC_VIA_STACK_GUARD); |
825 } | 825 } |
826 } | 826 } |
827 | 827 |
828 | 828 |
829 void IncrementalMarking::SpeedUp() { | 829 void IncrementalMarking::SpeedUp() { |
830 bool speed_up = false; | 830 bool speed_up = false; |
831 | 831 |
832 if ((steps_count_ % kMarkingSpeedAccellerationInterval) == 0) { | 832 if ((steps_count_ % kMarkingSpeedAccellerationInterval) == 0) { |
833 if (FLAG_trace_gc) { | 833 if (FLAG_trace_gc) { |
834 PrintPID("Speed up marking after %d steps\n", | 834 PrintPID("Speed up marking after %d steps\n", |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
890 } | 890 } |
891 } | 891 } |
892 } | 892 } |
893 | 893 |
894 | 894 |
895 intptr_t IncrementalMarking::Step(intptr_t allocated_bytes, | 895 intptr_t IncrementalMarking::Step(intptr_t allocated_bytes, |
896 CompletionAction action, | 896 CompletionAction action, |
897 ForceMarkingAction marking, | 897 ForceMarkingAction marking, |
898 ForceCompletionAction completion) { | 898 ForceCompletionAction completion) { |
899 if (heap_->gc_state() != Heap::NOT_IN_GC || !FLAG_incremental_marking || | 899 if (heap_->gc_state() != Heap::NOT_IN_GC || !FLAG_incremental_marking || |
900 !FLAG_incremental_marking_steps || | 900 !CanDoSteps()) { |
901 (state_ != SWEEPING && state_ != MARKING)) { | |
902 return 0; | 901 return 0; |
903 } | 902 } |
904 | 903 |
905 allocated_ += allocated_bytes; | 904 allocated_ += allocated_bytes; |
906 | 905 |
907 if (marking == DO_NOT_FORCE_MARKING && allocated_ < kAllocatedThreshold && | 906 if (marking == DO_NOT_FORCE_MARKING && allocated_ < kAllocatedThreshold && |
908 write_barriers_invoked_since_last_step_ < | 907 write_barriers_invoked_since_last_step_ < |
909 kWriteBarriersInvokedThreshold) { | 908 kWriteBarriersInvokedThreshold) { |
910 return 0; | 909 return 0; |
911 } | 910 } |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1010 void IncrementalMarking::IncrementIdleMarkingDelayCounter() { | 1009 void IncrementalMarking::IncrementIdleMarkingDelayCounter() { |
1011 idle_marking_delay_counter_++; | 1010 idle_marking_delay_counter_++; |
1012 } | 1011 } |
1013 | 1012 |
1014 | 1013 |
1015 void IncrementalMarking::ClearIdleMarkingDelayCounter() { | 1014 void IncrementalMarking::ClearIdleMarkingDelayCounter() { |
1016 idle_marking_delay_counter_ = 0; | 1015 idle_marking_delay_counter_ = 0; |
1017 } | 1016 } |
1018 } | 1017 } |
1019 } // namespace v8::internal | 1018 } // namespace v8::internal |
OLD | NEW |