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 848 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
859 // barriers before we get here and check them (marking can only take place on | 859 // barriers before we get here and check them (marking can only take place on |
860 // allocation), so to reduce the lumpiness we don't use the write barriers | 860 // allocation), so to reduce the lumpiness we don't use the write barriers |
861 // invoked since last step directly to determine the amount of work to do. | 861 // invoked since last step directly to determine the amount of work to do. |
862 intptr_t bytes_to_process = | 862 intptr_t bytes_to_process = |
863 marking_speed_ * Max(allocated_, write_barriers_invoked_since_last_step_); | 863 marking_speed_ * Max(allocated_, write_barriers_invoked_since_last_step_); |
864 allocated_ = 0; | 864 allocated_ = 0; |
865 write_barriers_invoked_since_last_step_ = 0; | 865 write_barriers_invoked_since_last_step_ = 0; |
866 | 866 |
867 bytes_scanned_ += bytes_to_process; | 867 bytes_scanned_ += bytes_to_process; |
868 | 868 |
869 double start = 0; | 869 double start = base::OS::TimeCurrentMillis(); |
870 | |
871 if (FLAG_trace_incremental_marking || FLAG_trace_gc || | |
872 FLAG_print_cumulative_gc_stat) { | |
873 start = base::OS::TimeCurrentMillis(); | |
874 } | |
875 | 870 |
876 if (state_ == SWEEPING) { | 871 if (state_ == SWEEPING) { |
877 if (heap_->mark_compact_collector()->sweeping_in_progress() && | 872 if (heap_->mark_compact_collector()->sweeping_in_progress() && |
878 heap_->mark_compact_collector()->IsSweepingCompleted()) { | 873 heap_->mark_compact_collector()->IsSweepingCompleted()) { |
879 heap_->mark_compact_collector()->EnsureSweepingCompleted(); | 874 heap_->mark_compact_collector()->EnsureSweepingCompleted(); |
880 } | 875 } |
881 if (!heap_->mark_compact_collector()->sweeping_in_progress()) { | 876 if (!heap_->mark_compact_collector()->sweeping_in_progress()) { |
882 bytes_scanned_ = 0; | 877 bytes_scanned_ = 0; |
883 StartMarking(PREVENT_COMPACTION); | 878 StartMarking(PREVENT_COMPACTION); |
884 } | 879 } |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
945 marking_speed_ += kMarkingSpeedAccelleration; | 940 marking_speed_ += kMarkingSpeedAccelleration; |
946 marking_speed_ = static_cast<int>( | 941 marking_speed_ = static_cast<int>( |
947 Min(kMaxMarkingSpeed, | 942 Min(kMaxMarkingSpeed, |
948 static_cast<intptr_t>(marking_speed_ * 1.3))); | 943 static_cast<intptr_t>(marking_speed_ * 1.3))); |
949 if (FLAG_trace_gc) { | 944 if (FLAG_trace_gc) { |
950 PrintPID("Marking speed increased to %d\n", marking_speed_); | 945 PrintPID("Marking speed increased to %d\n", marking_speed_); |
951 } | 946 } |
952 } | 947 } |
953 } | 948 } |
954 | 949 |
955 if (FLAG_trace_incremental_marking || FLAG_trace_gc || | 950 double end = base::OS::TimeCurrentMillis(); |
956 FLAG_print_cumulative_gc_stat) { | 951 double delta = (end - start); |
957 double end = base::OS::TimeCurrentMillis(); | 952 heap_->tracer()->AddIncrementalMarkingStep(delta); |
958 double delta = (end - start); | 953 heap_->AddMarkingTime(delta); |
959 heap_->tracer()->AddIncrementalMarkingStep(delta); | |
960 heap_->AddMarkingTime(delta); | |
961 } | |
962 } | 954 } |
963 | 955 |
964 | 956 |
965 void IncrementalMarking::ResetStepCounters() { | 957 void IncrementalMarking::ResetStepCounters() { |
966 steps_count_ = 0; | 958 steps_count_ = 0; |
967 old_generation_space_available_at_start_of_incremental_ = | 959 old_generation_space_available_at_start_of_incremental_ = |
968 SpaceLeftInOldSpace(); | 960 SpaceLeftInOldSpace(); |
969 old_generation_space_used_at_start_of_incremental_ = | 961 old_generation_space_used_at_start_of_incremental_ = |
970 heap_->PromotedTotalSize(); | 962 heap_->PromotedTotalSize(); |
971 bytes_rescanned_ = 0; | 963 bytes_rescanned_ = 0; |
972 marking_speed_ = kInitialMarkingSpeed; | 964 marking_speed_ = kInitialMarkingSpeed; |
973 bytes_scanned_ = 0; | 965 bytes_scanned_ = 0; |
974 write_barriers_invoked_since_last_step_ = 0; | 966 write_barriers_invoked_since_last_step_ = 0; |
975 } | 967 } |
976 | 968 |
977 | 969 |
978 int64_t IncrementalMarking::SpaceLeftInOldSpace() { | 970 int64_t IncrementalMarking::SpaceLeftInOldSpace() { |
979 return heap_->MaxOldGenerationSize() - heap_->PromotedSpaceSizeOfObjects(); | 971 return heap_->MaxOldGenerationSize() - heap_->PromotedSpaceSizeOfObjects(); |
980 } | 972 } |
981 | 973 |
982 } } // namespace v8::internal | 974 } } // namespace v8::internal |
OLD | NEW |