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 807 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
818 | 818 |
819 | 819 |
820 void IncrementalMarking::Epilogue() { | 820 void IncrementalMarking::Epilogue() { |
821 was_activated_ = false; | 821 was_activated_ = false; |
822 weak_closure_was_overapproximated_ = false; | 822 weak_closure_was_overapproximated_ = false; |
823 weak_closure_approximation_rounds_ = 0; | 823 weak_closure_approximation_rounds_ = 0; |
824 } | 824 } |
825 | 825 |
826 | 826 |
827 void IncrementalMarking::OldSpaceStep(intptr_t allocated) { | 827 void IncrementalMarking::OldSpaceStep(intptr_t allocated) { |
828 // If we are stressing the GC, then always return the bump allocation area to | |
829 // the free list here, which will cause a crash if the top and limit are not | |
830 // up to date. | |
831 if (FLAG_gc_interval != -1) { | |
832 heap()->old_space()->ReturnLinearAllocationAreaToFreeList(); | |
833 } | |
834 if (IsStopped() && ShouldActivateEvenWithoutIdleNotification()) { | 828 if (IsStopped() && ShouldActivateEvenWithoutIdleNotification()) { |
835 Start(Heap::kNoGCFlags); | 829 Start(Heap::kNoGCFlags); |
836 } else { | 830 } else { |
837 Step(allocated * kOldSpaceAllocationMarkingFactor, GC_VIA_STACK_GUARD); | 831 Step(allocated * kFastMarking / kInitialMarkingSpeed, GC_VIA_STACK_GUARD); |
838 } | 832 } |
839 } | 833 } |
840 | 834 |
841 | 835 |
842 void IncrementalMarking::SpeedUp() { | 836 void IncrementalMarking::SpeedUp() { |
843 bool speed_up = false; | 837 bool speed_up = false; |
844 | 838 |
845 if ((steps_count_ % kMarkingSpeedAccellerationInterval) == 0) { | 839 if ((steps_count_ % kMarkingSpeedAccellerationInterval) == 0) { |
846 if (FLAG_trace_incremental_marking) { | 840 if (FLAG_trace_incremental_marking) { |
847 PrintIsolate(heap()->isolate(), "Speed up marking after %d steps\n", | 841 PrintIsolate(heap()->isolate(), "Speed up marking after %d steps\n", |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
909 } | 903 } |
910 } | 904 } |
911 } | 905 } |
912 | 906 |
913 | 907 |
914 intptr_t IncrementalMarking::Step(intptr_t allocated_bytes, | 908 intptr_t IncrementalMarking::Step(intptr_t allocated_bytes, |
915 CompletionAction action, | 909 CompletionAction action, |
916 ForceMarkingAction marking, | 910 ForceMarkingAction marking, |
917 ForceCompletionAction completion) { | 911 ForceCompletionAction completion) { |
918 if (heap_->gc_state() != Heap::NOT_IN_GC || !FLAG_incremental_marking || | 912 if (heap_->gc_state() != Heap::NOT_IN_GC || !FLAG_incremental_marking || |
919 !CanDoSteps()) { | 913 !FLAG_incremental_marking_steps || |
| 914 (state_ != SWEEPING && state_ != MARKING)) { |
920 return 0; | 915 return 0; |
921 } | 916 } |
922 | 917 |
923 allocated_ += allocated_bytes; | 918 allocated_ += allocated_bytes; |
924 | 919 |
925 if (marking == DO_NOT_FORCE_MARKING && allocated_ < kAllocatedThreshold && | 920 if (marking == DO_NOT_FORCE_MARKING && allocated_ < kAllocatedThreshold && |
926 write_barriers_invoked_since_last_step_ < | 921 write_barriers_invoked_since_last_step_ < |
927 kWriteBarriersInvokedThreshold) { | 922 kWriteBarriersInvokedThreshold) { |
928 return 0; | 923 return 0; |
929 } | 924 } |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1028 void IncrementalMarking::IncrementIdleMarkingDelayCounter() { | 1023 void IncrementalMarking::IncrementIdleMarkingDelayCounter() { |
1029 idle_marking_delay_counter_++; | 1024 idle_marking_delay_counter_++; |
1030 } | 1025 } |
1031 | 1026 |
1032 | 1027 |
1033 void IncrementalMarking::ClearIdleMarkingDelayCounter() { | 1028 void IncrementalMarking::ClearIdleMarkingDelayCounter() { |
1034 idle_marking_delay_counter_ = 0; | 1029 idle_marking_delay_counter_ = 0; |
1035 } | 1030 } |
1036 } // namespace internal | 1031 } // namespace internal |
1037 } // namespace v8 | 1032 } // namespace v8 |
OLD | NEW |