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 5157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5168 return amount_of_external_allocated_memory_ - | 5168 return amount_of_external_allocated_memory_ - |
5169 amount_of_external_allocated_memory_at_last_global_gc_; | 5169 amount_of_external_allocated_memory_at_last_global_gc_; |
5170 } | 5170 } |
5171 | 5171 |
5172 | 5172 |
5173 intptr_t Heap::OldGenerationAllocationLimit(intptr_t old_gen_size, | 5173 intptr_t Heap::OldGenerationAllocationLimit(intptr_t old_gen_size, |
5174 int freed_global_handles) { | 5174 int freed_global_handles) { |
5175 const int kMaxHandles = 1000; | 5175 const int kMaxHandles = 1000; |
5176 const int kMinHandles = 100; | 5176 const int kMinHandles = 100; |
5177 double min_factor = 1.1; | 5177 double min_factor = 1.1; |
5178 double max_factor = 4; | 5178 double max_factor = 1.5; |
5179 // We set the old generation growing factor to 2 to grow the heap slower on | 5179 // We set the old generation growing factor to 2 to grow the heap slower on |
5180 // memory-constrained devices. | 5180 // memory-constrained devices. |
5181 if (max_old_generation_size_ <= kMaxOldSpaceSizeMediumMemoryDevice) { | 5181 if (max_old_generation_size_ <= kMaxOldSpaceSizeMediumMemoryDevice) { |
5182 max_factor = 2; | 5182 max_factor = 1.5; |
5183 } | 5183 } |
5184 // If there are many freed global handles, then the next full GC will | 5184 // If there are many freed global handles, then the next full GC will |
5185 // likely collect a lot of garbage. Choose the heap growing factor | 5185 // likely collect a lot of garbage. Choose the heap growing factor |
5186 // depending on freed global handles. | 5186 // depending on freed global handles. |
5187 // TODO(ulan, hpayer): Take into account mutator utilization. | 5187 // TODO(ulan, hpayer): Take into account mutator utilization. |
5188 double factor; | 5188 double factor; |
5189 if (freed_global_handles <= kMinHandles) { | 5189 if (freed_global_handles <= kMinHandles) { |
5190 factor = max_factor; | 5190 factor = max_factor; |
5191 } else if (freed_global_handles >= kMaxHandles) { | 5191 } else if (freed_global_handles >= kMaxHandles) { |
5192 factor = min_factor; | 5192 factor = min_factor; |
(...skipping 1108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6301 static_cast<int>(object_sizes_last_time_[index])); | 6301 static_cast<int>(object_sizes_last_time_[index])); |
6302 CODE_AGE_LIST_COMPLETE(ADJUST_LAST_TIME_OBJECT_COUNT) | 6302 CODE_AGE_LIST_COMPLETE(ADJUST_LAST_TIME_OBJECT_COUNT) |
6303 #undef ADJUST_LAST_TIME_OBJECT_COUNT | 6303 #undef ADJUST_LAST_TIME_OBJECT_COUNT |
6304 | 6304 |
6305 MemCopy(object_counts_last_time_, object_counts_, sizeof(object_counts_)); | 6305 MemCopy(object_counts_last_time_, object_counts_, sizeof(object_counts_)); |
6306 MemCopy(object_sizes_last_time_, object_sizes_, sizeof(object_sizes_)); | 6306 MemCopy(object_sizes_last_time_, object_sizes_, sizeof(object_sizes_)); |
6307 ClearObjectStats(); | 6307 ClearObjectStats(); |
6308 } | 6308 } |
6309 } | 6309 } |
6310 } // namespace v8::internal | 6310 } // namespace v8::internal |
OLD | NEW |