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 4945 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5018 max_old_generation_size_); | 5019 max_old_generation_size_); |
5019 | 5020 |
5020 // We rely on being able to allocate new arrays in paged spaces. | 5021 // We rely on being able to allocate new arrays in paged spaces. |
5021 ASSERT(Page::kMaxRegularHeapObjectSize >= | 5022 ASSERT(Page::kMaxRegularHeapObjectSize >= |
5022 (JSArray::kSize + | 5023 (JSArray::kSize + |
5023 FixedArray::SizeFor(JSObject::kInitialMaxFastElementArray) + | 5024 FixedArray::SizeFor(JSObject::kInitialMaxFastElementArray) + |
5024 AllocationMemento::kSize)); | 5025 AllocationMemento::kSize)); |
5025 | 5026 |
5026 code_range_size_ = code_range_size * MB; | 5027 code_range_size_ = code_range_size * MB; |
5027 | 5028 |
| 5029 // We set the old generation growing factor to 2 to grow the heap slower on |
| 5030 // memory-constrained devices. |
| 5031 if (max_old_generation_size_ <= kMaxOldSpaceSizeMediumMemoryDevice) { |
| 5032 old_space_growing_factor_ = 2; |
| 5033 } |
| 5034 |
5028 configured_ = true; | 5035 configured_ = true; |
5029 return true; | 5036 return true; |
5030 } | 5037 } |
5031 | 5038 |
5032 | 5039 |
5033 bool Heap::ConfigureHeapDefault() { | 5040 bool Heap::ConfigureHeapDefault() { |
5034 return ConfigureHeap(0, 0, 0, 0); | 5041 return ConfigureHeap(0, 0, 0, 0); |
5035 } | 5042 } |
5036 | 5043 |
5037 | 5044 |
(...skipping 1388 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6426 static_cast<int>(object_sizes_last_time_[index])); | 6433 static_cast<int>(object_sizes_last_time_[index])); |
6427 CODE_AGE_LIST_COMPLETE(ADJUST_LAST_TIME_OBJECT_COUNT) | 6434 CODE_AGE_LIST_COMPLETE(ADJUST_LAST_TIME_OBJECT_COUNT) |
6428 #undef ADJUST_LAST_TIME_OBJECT_COUNT | 6435 #undef ADJUST_LAST_TIME_OBJECT_COUNT |
6429 | 6436 |
6430 MemCopy(object_counts_last_time_, object_counts_, sizeof(object_counts_)); | 6437 MemCopy(object_counts_last_time_, object_counts_, sizeof(object_counts_)); |
6431 MemCopy(object_sizes_last_time_, object_sizes_, sizeof(object_sizes_)); | 6438 MemCopy(object_sizes_last_time_, object_sizes_, sizeof(object_sizes_)); |
6432 ClearObjectStats(); | 6439 ClearObjectStats(); |
6433 } | 6440 } |
6434 | 6441 |
6435 } } // namespace v8::internal | 6442 } } // namespace v8::internal |
OLD | NEW |