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/incremental-marking.h" | 7 #include "src/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 816 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
827 if (IsStopped() && WorthActivating() && heap_->NextGCIsLikelyToBeFull()) { | 827 if (IsStopped() && WorthActivating() && heap_->NextGCIsLikelyToBeFull()) { |
828 // TODO(hpayer): Let's play safe for now, but compaction should be | 828 // TODO(hpayer): Let's play safe for now, but compaction should be |
829 // in principle possible. | 829 // in principle possible. |
830 Start(PREVENT_COMPACTION); | 830 Start(PREVENT_COMPACTION); |
831 } else { | 831 } else { |
832 Step(allocated * kFastMarking / kInitialMarkingSpeed, GC_VIA_STACK_GUARD); | 832 Step(allocated * kFastMarking / kInitialMarkingSpeed, GC_VIA_STACK_GUARD); |
833 } | 833 } |
834 } | 834 } |
835 | 835 |
836 | 836 |
837 void IncrementalMarking::Step(intptr_t allocated_bytes, | 837 void IncrementalMarking::Step(intptr_t allocated_bytes, CompletionAction action, |
838 CompletionAction action) { | 838 bool force_marking) { |
839 if (heap_->gc_state() != Heap::NOT_IN_GC || | 839 if (heap_->gc_state() != Heap::NOT_IN_GC || |
840 !FLAG_incremental_marking || | 840 !FLAG_incremental_marking || |
841 !FLAG_incremental_marking_steps || | 841 !FLAG_incremental_marking_steps || |
842 (state_ != SWEEPING && state_ != MARKING)) { | 842 (state_ != SWEEPING && state_ != MARKING)) { |
843 return; | 843 return; |
844 } | 844 } |
845 | 845 |
846 allocated_ += allocated_bytes; | 846 allocated_ += allocated_bytes; |
847 | 847 |
848 if (allocated_ < kAllocatedThreshold && | 848 if (!force_marking && allocated_ < kAllocatedThreshold && |
849 write_barriers_invoked_since_last_step_ < | 849 write_barriers_invoked_since_last_step_ < |
850 kWriteBarriersInvokedThreshold) { | 850 kWriteBarriersInvokedThreshold) { |
851 return; | 851 return; |
852 } | 852 } |
853 | 853 |
854 if (state_ == MARKING && no_marking_scope_depth_ > 0) return; | 854 if (state_ == MARKING && no_marking_scope_depth_ > 0) return; |
855 | 855 |
856 { | 856 { |
857 HistogramTimerScope incremental_marking_scope( | 857 HistogramTimerScope incremental_marking_scope( |
858 heap_->isolate()->counters()->gc_incremental_marking()); | 858 heap_->isolate()->counters()->gc_incremental_marking()); |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
973 bytes_scanned_ = 0; | 973 bytes_scanned_ = 0; |
974 write_barriers_invoked_since_last_step_ = 0; | 974 write_barriers_invoked_since_last_step_ = 0; |
975 } | 975 } |
976 | 976 |
977 | 977 |
978 int64_t IncrementalMarking::SpaceLeftInOldSpace() { | 978 int64_t IncrementalMarking::SpaceLeftInOldSpace() { |
979 return heap_->MaxOldGenerationSize() - heap_->PromotedSpaceSizeOfObjects(); | 979 return heap_->MaxOldGenerationSize() - heap_->PromotedSpaceSizeOfObjects(); |
980 } | 980 } |
981 | 981 |
982 } } // namespace v8::internal | 982 } } // namespace v8::internal |
OLD | NEW |