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/accessors.h" | 7 #include "src/accessors.h" |
8 #include "src/api.h" | 8 #include "src/api.h" |
9 #include "src/base/bits.h" | 9 #include "src/base/bits.h" |
10 #include "src/base/once.h" | 10 #include "src/base/once.h" |
(...skipping 1074 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1085 } | 1085 } |
1086 } | 1086 } |
1087 | 1087 |
1088 | 1088 |
1089 void Heap::UpdateSurvivalStatistics(int start_new_space_size) { | 1089 void Heap::UpdateSurvivalStatistics(int start_new_space_size) { |
1090 if (start_new_space_size == 0) return; | 1090 if (start_new_space_size == 0) return; |
1091 | 1091 |
1092 promotion_ratio_ = (static_cast<double>(promoted_objects_size_) / | 1092 promotion_ratio_ = (static_cast<double>(promoted_objects_size_) / |
1093 static_cast<double>(start_new_space_size) * 100); | 1093 static_cast<double>(start_new_space_size) * 100); |
1094 | 1094 |
1095 if (gc_count_ > 1) tracer()->AddPromotionRatio(promotion_ratio_); | |
1096 | |
1097 if (previous_semi_space_copied_object_size_ > 0) { | 1095 if (previous_semi_space_copied_object_size_ > 0) { |
1098 promotion_rate_ = | 1096 promotion_rate_ = |
1099 (static_cast<double>(promoted_objects_size_) / | 1097 (static_cast<double>(promoted_objects_size_) / |
1100 static_cast<double>(previous_semi_space_copied_object_size_) * 100); | 1098 static_cast<double>(previous_semi_space_copied_object_size_) * 100); |
1101 } else { | 1099 } else { |
1102 promotion_rate_ = 0; | 1100 promotion_rate_ = 0; |
1103 } | 1101 } |
1104 | 1102 |
1105 semi_space_copied_rate_ = | 1103 semi_space_copied_rate_ = |
1106 (static_cast<double>(semi_space_copied_object_size_) / | 1104 (static_cast<double>(semi_space_copied_object_size_) / |
1107 static_cast<double>(start_new_space_size) * 100); | 1105 static_cast<double>(start_new_space_size) * 100); |
1108 | 1106 |
1109 double survival_rate = promotion_ratio_ + semi_space_copied_rate_; | 1107 double survival_rate = promotion_ratio_ + semi_space_copied_rate_; |
| 1108 tracer()->AddSurvivalRatio(survival_rate); |
1110 if (survival_rate > kYoungSurvivalRateHighThreshold) { | 1109 if (survival_rate > kYoungSurvivalRateHighThreshold) { |
1111 high_survival_rate_period_length_++; | 1110 high_survival_rate_period_length_++; |
1112 } else { | 1111 } else { |
1113 high_survival_rate_period_length_ = 0; | 1112 high_survival_rate_period_length_ = 0; |
1114 } | 1113 } |
1115 } | 1114 } |
1116 | 1115 |
1117 bool Heap::PerformGarbageCollection( | 1116 bool Heap::PerformGarbageCollection( |
1118 GarbageCollector collector, const v8::GCCallbackFlags gc_callback_flags) { | 1117 GarbageCollector collector, const v8::GCCallbackFlags gc_callback_flags) { |
1119 int freed_global_handles = 0; | 1118 int freed_global_handles = 0; |
(...skipping 1291 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2411 Map* map = first_word.ToMap(); | 2410 Map* map = first_word.ToMap(); |
2412 map->GetHeap()->DoScavengeObject(map, p, object); | 2411 map->GetHeap()->DoScavengeObject(map, p, object); |
2413 } | 2412 } |
2414 | 2413 |
2415 | 2414 |
2416 void Heap::ConfigureInitialOldGenerationSize() { | 2415 void Heap::ConfigureInitialOldGenerationSize() { |
2417 if (!old_generation_size_configured_ && tracer()->SurvivalEventsRecorded()) { | 2416 if (!old_generation_size_configured_ && tracer()->SurvivalEventsRecorded()) { |
2418 old_generation_allocation_limit_ = | 2417 old_generation_allocation_limit_ = |
2419 Max(kMinimumOldGenerationAllocationLimit, | 2418 Max(kMinimumOldGenerationAllocationLimit, |
2420 static_cast<intptr_t>( | 2419 static_cast<intptr_t>( |
2421 static_cast<double>(initial_old_generation_size_) * | 2420 static_cast<double>(old_generation_allocation_limit_) * |
2422 (tracer()->AveragePromotionRatio() / 100))); | 2421 (tracer()->AverageSurvivalRatio() / 100))); |
2423 } | 2422 } |
2424 } | 2423 } |
2425 | 2424 |
2426 | 2425 |
2427 AllocationResult Heap::AllocatePartialMap(InstanceType instance_type, | 2426 AllocationResult Heap::AllocatePartialMap(InstanceType instance_type, |
2428 int instance_size) { | 2427 int instance_size) { |
2429 Object* result; | 2428 Object* result; |
2430 AllocationResult allocation = AllocateRaw(Map::kSize, MAP_SPACE, MAP_SPACE); | 2429 AllocationResult allocation = AllocateRaw(Map::kSize, MAP_SPACE, MAP_SPACE); |
2431 if (!allocation.To(&result)) return allocation; | 2430 if (!allocation.To(&result)) return allocation; |
2432 | 2431 |
(...skipping 4089 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6522 static_cast<int>(object_sizes_last_time_[index])); | 6521 static_cast<int>(object_sizes_last_time_[index])); |
6523 CODE_AGE_LIST_COMPLETE(ADJUST_LAST_TIME_OBJECT_COUNT) | 6522 CODE_AGE_LIST_COMPLETE(ADJUST_LAST_TIME_OBJECT_COUNT) |
6524 #undef ADJUST_LAST_TIME_OBJECT_COUNT | 6523 #undef ADJUST_LAST_TIME_OBJECT_COUNT |
6525 | 6524 |
6526 MemCopy(object_counts_last_time_, object_counts_, sizeof(object_counts_)); | 6525 MemCopy(object_counts_last_time_, object_counts_, sizeof(object_counts_)); |
6527 MemCopy(object_sizes_last_time_, object_sizes_, sizeof(object_sizes_)); | 6526 MemCopy(object_sizes_last_time_, object_sizes_, sizeof(object_sizes_)); |
6528 ClearObjectStats(); | 6527 ClearObjectStats(); |
6529 } | 6528 } |
6530 } | 6529 } |
6531 } // namespace v8::internal | 6530 } // namespace v8::internal |
OLD | NEW |