| 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 } |
| 828 if (IsStopped() && ShouldActivateEvenWithoutIdleNotification()) { | 834 if (IsStopped() && ShouldActivateEvenWithoutIdleNotification()) { |
| 829 Start(Heap::kNoGCFlags); | 835 Start(Heap::kNoGCFlags); |
| 830 } else { | 836 } else { |
| 831 Step(allocated * kFastMarking / kInitialMarkingSpeed, GC_VIA_STACK_GUARD); | 837 Step(allocated * kOldSpaceAllocationMarkingFactor, GC_VIA_STACK_GUARD); |
| 832 } | 838 } |
| 833 } | 839 } |
| 834 | 840 |
| 835 | 841 |
| 836 void IncrementalMarking::SpeedUp() { | 842 void IncrementalMarking::SpeedUp() { |
| 837 bool speed_up = false; | 843 bool speed_up = false; |
| 838 | 844 |
| 839 if ((steps_count_ % kMarkingSpeedAccellerationInterval) == 0) { | 845 if ((steps_count_ % kMarkingSpeedAccellerationInterval) == 0) { |
| 840 if (FLAG_trace_incremental_marking) { | 846 if (FLAG_trace_incremental_marking) { |
| 841 PrintIsolate(heap()->isolate(), "Speed up marking after %d steps\n", | 847 PrintIsolate(heap()->isolate(), "Speed up marking after %d steps\n", |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 903 } | 909 } |
| 904 } | 910 } |
| 905 } | 911 } |
| 906 | 912 |
| 907 | 913 |
| 908 intptr_t IncrementalMarking::Step(intptr_t allocated_bytes, | 914 intptr_t IncrementalMarking::Step(intptr_t allocated_bytes, |
| 909 CompletionAction action, | 915 CompletionAction action, |
| 910 ForceMarkingAction marking, | 916 ForceMarkingAction marking, |
| 911 ForceCompletionAction completion) { | 917 ForceCompletionAction completion) { |
| 912 if (heap_->gc_state() != Heap::NOT_IN_GC || !FLAG_incremental_marking || | 918 if (heap_->gc_state() != Heap::NOT_IN_GC || !FLAG_incremental_marking || |
| 913 !FLAG_incremental_marking_steps || | 919 !CanDoSteps()) { |
| 914 (state_ != SWEEPING && state_ != MARKING)) { | |
| 915 return 0; | 920 return 0; |
| 916 } | 921 } |
| 917 | 922 |
| 918 allocated_ += allocated_bytes; | 923 allocated_ += allocated_bytes; |
| 919 | 924 |
| 920 if (marking == DO_NOT_FORCE_MARKING && allocated_ < kAllocatedThreshold && | 925 if (marking == DO_NOT_FORCE_MARKING && allocated_ < kAllocatedThreshold && |
| 921 write_barriers_invoked_since_last_step_ < | 926 write_barriers_invoked_since_last_step_ < |
| 922 kWriteBarriersInvokedThreshold) { | 927 kWriteBarriersInvokedThreshold) { |
| 923 return 0; | 928 return 0; |
| 924 } | 929 } |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1023 void IncrementalMarking::IncrementIdleMarkingDelayCounter() { | 1028 void IncrementalMarking::IncrementIdleMarkingDelayCounter() { |
| 1024 idle_marking_delay_counter_++; | 1029 idle_marking_delay_counter_++; |
| 1025 } | 1030 } |
| 1026 | 1031 |
| 1027 | 1032 |
| 1028 void IncrementalMarking::ClearIdleMarkingDelayCounter() { | 1033 void IncrementalMarking::ClearIdleMarkingDelayCounter() { |
| 1029 idle_marking_delay_counter_ = 0; | 1034 idle_marking_delay_counter_ = 0; |
| 1030 } | 1035 } |
| 1031 } // namespace internal | 1036 } // namespace internal |
| 1032 } // namespace v8 | 1037 } // namespace v8 |
| OLD | NEW |