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/once.h" | 9 #include "src/base/once.h" |
10 #include "src/bootstrapper.h" | 10 #include "src/bootstrapper.h" |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
53 reserved_semispace_size_(8 * (kPointerSize / 4) * MB), | 53 reserved_semispace_size_(8 * (kPointerSize / 4) * MB), |
54 max_semi_space_size_(8 * (kPointerSize / 4) * MB), | 54 max_semi_space_size_(8 * (kPointerSize / 4) * MB), |
55 initial_semispace_size_(Page::kPageSize), | 55 initial_semispace_size_(Page::kPageSize), |
56 max_old_generation_size_(700ul * (kPointerSize / 4) * MB), | 56 max_old_generation_size_(700ul * (kPointerSize / 4) * MB), |
57 max_executable_size_(256ul * (kPointerSize / 4) * MB), | 57 max_executable_size_(256ul * (kPointerSize / 4) * MB), |
58 // Variables set based on semispace_size_ and old_generation_size_ in | 58 // Variables set based on semispace_size_ and old_generation_size_ in |
59 // ConfigureHeap. | 59 // ConfigureHeap. |
60 // Will be 4 * reserved_semispace_size_ to ensure that young | 60 // Will be 4 * reserved_semispace_size_ to ensure that young |
61 // generation can be aligned to its size. | 61 // generation can be aligned to its size. |
62 maximum_committed_(0), | 62 maximum_committed_(0), |
| 63 old_space_growing_factor_(4), |
63 survived_since_last_expansion_(0), | 64 survived_since_last_expansion_(0), |
64 sweep_generation_(0), | 65 sweep_generation_(0), |
65 always_allocate_scope_depth_(0), | 66 always_allocate_scope_depth_(0), |
66 linear_allocation_scope_depth_(0), | 67 linear_allocation_scope_depth_(0), |
67 contexts_disposed_(0), | 68 contexts_disposed_(0), |
68 global_ic_age_(0), | 69 global_ic_age_(0), |
69 flush_monomorphic_ics_(false), | 70 flush_monomorphic_ics_(false), |
70 scan_on_scavenge_pages_(0), | 71 scan_on_scavenge_pages_(0), |
71 new_space_(this), | 72 new_space_(this), |
72 old_pointer_space_(NULL), | 73 old_pointer_space_(NULL), |
(...skipping 4942 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5015 max_old_generation_size_); | 5016 max_old_generation_size_); |
5016 | 5017 |
5017 // We rely on being able to allocate new arrays in paged spaces. | 5018 // We rely on being able to allocate new arrays in paged spaces. |
5018 ASSERT(Page::kMaxRegularHeapObjectSize >= | 5019 ASSERT(Page::kMaxRegularHeapObjectSize >= |
5019 (JSArray::kSize + | 5020 (JSArray::kSize + |
5020 FixedArray::SizeFor(JSObject::kInitialMaxFastElementArray) + | 5021 FixedArray::SizeFor(JSObject::kInitialMaxFastElementArray) + |
5021 AllocationMemento::kSize)); | 5022 AllocationMemento::kSize)); |
5022 | 5023 |
5023 code_range_size_ = code_range_size * MB; | 5024 code_range_size_ = code_range_size * MB; |
5024 | 5025 |
| 5026 // We set the old generation growing factor to 2 to grow the heap slower on |
| 5027 // memory-constrained devices. |
| 5028 if (max_old_generation_size_ <= kMaxOldSpaceSizeMediumMemoryDevice) { |
| 5029 old_space_growing_factor_ = 2; |
| 5030 } |
| 5031 |
5025 configured_ = true; | 5032 configured_ = true; |
5026 return true; | 5033 return true; |
5027 } | 5034 } |
5028 | 5035 |
5029 | 5036 |
5030 bool Heap::ConfigureHeapDefault() { | 5037 bool Heap::ConfigureHeapDefault() { |
5031 return ConfigureHeap(0, 0, 0, 0); | 5038 return ConfigureHeap(0, 0, 0, 0); |
5032 } | 5039 } |
5033 | 5040 |
5034 | 5041 |
(...skipping 1388 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6423 static_cast<int>(object_sizes_last_time_[index])); | 6430 static_cast<int>(object_sizes_last_time_[index])); |
6424 CODE_AGE_LIST_COMPLETE(ADJUST_LAST_TIME_OBJECT_COUNT) | 6431 CODE_AGE_LIST_COMPLETE(ADJUST_LAST_TIME_OBJECT_COUNT) |
6425 #undef ADJUST_LAST_TIME_OBJECT_COUNT | 6432 #undef ADJUST_LAST_TIME_OBJECT_COUNT |
6426 | 6433 |
6427 MemCopy(object_counts_last_time_, object_counts_, sizeof(object_counts_)); | 6434 MemCopy(object_counts_last_time_, object_counts_, sizeof(object_counts_)); |
6428 MemCopy(object_sizes_last_time_, object_sizes_, sizeof(object_sizes_)); | 6435 MemCopy(object_sizes_last_time_, object_sizes_, sizeof(object_sizes_)); |
6429 ClearObjectStats(); | 6436 ClearObjectStats(); |
6430 } | 6437 } |
6431 | 6438 |
6432 } } // namespace v8::internal | 6439 } } // namespace v8::internal |
OLD | NEW |