| 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 49 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 60       amount_of_external_allocated_memory_at_last_global_gc_(0), | 60       amount_of_external_allocated_memory_at_last_global_gc_(0), | 
| 61       isolate_(NULL), | 61       isolate_(NULL), | 
| 62       code_range_size_(0), | 62       code_range_size_(0), | 
| 63       // semispace_size_ should be a power of 2 and old_generation_size_ should | 63       // semispace_size_ should be a power of 2 and old_generation_size_ should | 
| 64       // be a multiple of Page::kPageSize. | 64       // be a multiple of Page::kPageSize. | 
| 65       reserved_semispace_size_(8 * (kPointerSize / 4) * MB), | 65       reserved_semispace_size_(8 * (kPointerSize / 4) * MB), | 
| 66       max_semi_space_size_(8 * (kPointerSize / 4) * MB), | 66       max_semi_space_size_(8 * (kPointerSize / 4) * MB), | 
| 67       initial_semispace_size_(Page::kPageSize), | 67       initial_semispace_size_(Page::kPageSize), | 
| 68       target_semispace_size_(Page::kPageSize), | 68       target_semispace_size_(Page::kPageSize), | 
| 69       max_old_generation_size_(700ul * (kPointerSize / 4) * MB), | 69       max_old_generation_size_(700ul * (kPointerSize / 4) * MB), | 
| 70       initial_old_generation_size_(max_old_generation_size_ / 2), | 70       initial_old_generation_size_(max_old_generation_size_), | 
| 71       old_generation_size_configured_(false), | 71       old_generation_size_configured_(false), | 
| 72       max_executable_size_(256ul * (kPointerSize / 4) * MB), | 72       max_executable_size_(256ul * (kPointerSize / 4) * MB), | 
| 73       // Variables set based on semispace_size_ and old_generation_size_ in | 73       // Variables set based on semispace_size_ and old_generation_size_ in | 
| 74       // ConfigureHeap. | 74       // ConfigureHeap. | 
| 75       // Will be 4 * reserved_semispace_size_ to ensure that young | 75       // Will be 4 * reserved_semispace_size_ to ensure that young | 
| 76       // generation can be aligned to its size. | 76       // generation can be aligned to its size. | 
| 77       maximum_committed_(0), | 77       maximum_committed_(0), | 
| 78       survived_since_last_expansion_(0), | 78       survived_since_last_expansion_(0), | 
| 79       survived_last_scavenge_(0), | 79       survived_last_scavenge_(0), | 
| 80       sweep_generation_(0), | 80       sweep_generation_(0), | 
| (...skipping 960 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 1041   } | 1041   } | 
| 1042 } | 1042 } | 
| 1043 | 1043 | 
| 1044 | 1044 | 
| 1045 void Heap::UpdateSurvivalStatistics(int start_new_space_size) { | 1045 void Heap::UpdateSurvivalStatistics(int start_new_space_size) { | 
| 1046   if (start_new_space_size == 0) return; | 1046   if (start_new_space_size == 0) return; | 
| 1047 | 1047 | 
| 1048   promotion_ratio_ = (static_cast<double>(promoted_objects_size_) / | 1048   promotion_ratio_ = (static_cast<double>(promoted_objects_size_) / | 
| 1049                       static_cast<double>(start_new_space_size) * 100); | 1049                       static_cast<double>(start_new_space_size) * 100); | 
| 1050 | 1050 | 
|  | 1051   if (gc_count_ > 1) tracer()->AddPromotionRatio(promotion_ratio_); | 
|  | 1052 | 
| 1051   if (previous_semi_space_copied_object_size_ > 0) { | 1053   if (previous_semi_space_copied_object_size_ > 0) { | 
| 1052     promotion_rate_ = | 1054     promotion_rate_ = | 
| 1053         (static_cast<double>(promoted_objects_size_) / | 1055         (static_cast<double>(promoted_objects_size_) / | 
| 1054          static_cast<double>(previous_semi_space_copied_object_size_) * 100); | 1056          static_cast<double>(previous_semi_space_copied_object_size_) * 100); | 
| 1055   } else { | 1057   } else { | 
| 1056     promotion_rate_ = 0; | 1058     promotion_rate_ = 0; | 
| 1057   } | 1059   } | 
| 1058 | 1060 | 
| 1059   semi_space_copied_rate_ = | 1061   semi_space_copied_rate_ = | 
| 1060       (static_cast<double>(semi_space_copied_object_size_) / | 1062       (static_cast<double>(semi_space_copied_object_size_) / | 
| 1061        static_cast<double>(start_new_space_size) * 100); | 1063        static_cast<double>(start_new_space_size) * 100); | 
| 1062 | 1064 | 
| 1063   double survival_rate = promotion_ratio_ + semi_space_copied_rate_; | 1065   double survival_rate = promotion_ratio_ + semi_space_copied_rate_; | 
| 1064   tracer()->AddSurvivalRate(survival_rate); |  | 
| 1065 |  | 
| 1066   if (survival_rate > kYoungSurvivalRateHighThreshold) { | 1066   if (survival_rate > kYoungSurvivalRateHighThreshold) { | 
| 1067     high_survival_rate_period_length_++; | 1067     high_survival_rate_period_length_++; | 
| 1068   } else { | 1068   } else { | 
| 1069     high_survival_rate_period_length_ = 0; | 1069     high_survival_rate_period_length_ = 0; | 
| 1070   } | 1070   } | 
| 1071 } | 1071 } | 
| 1072 | 1072 | 
| 1073 bool Heap::PerformGarbageCollection( | 1073 bool Heap::PerformGarbageCollection( | 
| 1074     GarbageCollector collector, const v8::GCCallbackFlags gc_callback_flags) { | 1074     GarbageCollector collector, const v8::GCCallbackFlags gc_callback_flags) { | 
| 1075   int freed_global_handles = 0; | 1075   int freed_global_handles = 0; | 
| (...skipping 1289 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 2365   map->GetHeap()->DoScavengeObject(map, p, object); | 2365   map->GetHeap()->DoScavengeObject(map, p, object); | 
| 2366 } | 2366 } | 
| 2367 | 2367 | 
| 2368 | 2368 | 
| 2369 void Heap::ConfigureInitialOldGenerationSize() { | 2369 void Heap::ConfigureInitialOldGenerationSize() { | 
| 2370   if (!old_generation_size_configured_ && tracer()->SurvivalEventsRecorded()) { | 2370   if (!old_generation_size_configured_ && tracer()->SurvivalEventsRecorded()) { | 
| 2371     old_generation_allocation_limit_ = | 2371     old_generation_allocation_limit_ = | 
| 2372         Max(kMinimumOldGenerationAllocationLimit, | 2372         Max(kMinimumOldGenerationAllocationLimit, | 
| 2373             static_cast<intptr_t>( | 2373             static_cast<intptr_t>( | 
| 2374                 static_cast<double>(initial_old_generation_size_) * | 2374                 static_cast<double>(initial_old_generation_size_) * | 
| 2375                 (tracer()->AverageSurvivalRate() / 100))); | 2375                 (tracer()->AveragePromotionRatio() / 100))); | 
| 2376   } | 2376   } | 
| 2377 } | 2377 } | 
| 2378 | 2378 | 
| 2379 | 2379 | 
| 2380 AllocationResult Heap::AllocatePartialMap(InstanceType instance_type, | 2380 AllocationResult Heap::AllocatePartialMap(InstanceType instance_type, | 
| 2381                                           int instance_size) { | 2381                                           int instance_size) { | 
| 2382   Object* result; | 2382   Object* result; | 
| 2383   AllocationResult allocation = AllocateRaw(Map::kSize, MAP_SPACE, MAP_SPACE); | 2383   AllocationResult allocation = AllocateRaw(Map::kSize, MAP_SPACE, MAP_SPACE); | 
| 2384   if (!allocation.To(&result)) return allocation; | 2384   if (!allocation.To(&result)) return allocation; | 
| 2385 | 2385 | 
| (...skipping 4052 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 6438       static_cast<int>(object_sizes_last_time_[index])); | 6438       static_cast<int>(object_sizes_last_time_[index])); | 
| 6439   CODE_AGE_LIST_COMPLETE(ADJUST_LAST_TIME_OBJECT_COUNT) | 6439   CODE_AGE_LIST_COMPLETE(ADJUST_LAST_TIME_OBJECT_COUNT) | 
| 6440 #undef ADJUST_LAST_TIME_OBJECT_COUNT | 6440 #undef ADJUST_LAST_TIME_OBJECT_COUNT | 
| 6441 | 6441 | 
| 6442   MemCopy(object_counts_last_time_, object_counts_, sizeof(object_counts_)); | 6442   MemCopy(object_counts_last_time_, object_counts_, sizeof(object_counts_)); | 
| 6443   MemCopy(object_sizes_last_time_, object_sizes_, sizeof(object_sizes_)); | 6443   MemCopy(object_sizes_last_time_, object_sizes_, sizeof(object_sizes_)); | 
| 6444   ClearObjectStats(); | 6444   ClearObjectStats(); | 
| 6445 } | 6445 } | 
| 6446 } | 6446 } | 
| 6447 }  // namespace v8::internal | 6447 }  // namespace v8::internal | 
| OLD | NEW | 
|---|