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 #ifndef V8_HEAP_HEAP_H_ | 5 #ifndef V8_HEAP_HEAP_H_ |
6 #define V8_HEAP_HEAP_H_ | 6 #define V8_HEAP_HEAP_H_ |
7 | 7 |
8 #include <cmath> | 8 #include <cmath> |
9 #include <map> | 9 #include <map> |
10 | 10 |
(...skipping 932 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
943 } | 943 } |
944 | 944 |
945 bool IsMemoryConstrainedDevice() { | 945 bool IsMemoryConstrainedDevice() { |
946 return max_old_generation_size_ <= kMaxOldSpaceSizeMediumMemoryDevice; | 946 return max_old_generation_size_ <= kMaxOldSpaceSizeMediumMemoryDevice; |
947 } | 947 } |
948 | 948 |
949 bool HighMemoryPressure() { | 949 bool HighMemoryPressure() { |
950 return memory_pressure_level_.Value() != MemoryPressureLevel::kNone; | 950 return memory_pressure_level_.Value() != MemoryPressureLevel::kNone; |
951 } | 951 } |
952 | 952 |
953 void IncreaseHeapLimitForDebugging() { | |
954 const size_t kDebugHeapSizeFactor = 4; | |
955 size_t max_limit = std::numeric_limits<size_t>::max() / 4; | |
956 max_old_generation_size_ = | |
957 Max(max_old_generation_size_, | |
958 Min(max_limit, max_old_generation_size_ * kDebugHeapSizeFactor)); | |
Hannes Payer (out of office)
2016/12/22 11:50:29
Isn't the requirement on 32-bit to stay within 2G
ulan
2016/12/22 14:04:51
Yes, max_limit is 1GB on 32-bit.
| |
959 } | |
960 | |
961 void RestoreOriginalHeapLimit() { | |
962 // Do not set the limit lower than the live size + some slack. | |
963 size_t min_limit = SizeOfObjects() + SizeOfObjects() / 4; | |
Hannes Payer (out of office)
2016/12/22 11:50:29
If the restoring of the initial max_old_generation
ulan
2016/12/22 14:04:51
Yep, we have no choice there. It is probably ok, b
Hannes Payer (out of office)
2016/12/23 07:49:56
We could try to set it at the end of a full gc and
ulan
2016/12/27 12:41:35
It makes sense as mitigation, but there is no guar
| |
964 max_old_generation_size_ = | |
965 Min(max_old_generation_size_, | |
966 Max(initial_max_old_generation_size_, min_limit)); | |
967 } | |
968 | |
953 // =========================================================================== | 969 // =========================================================================== |
954 // Initialization. =========================================================== | 970 // Initialization. =========================================================== |
955 // =========================================================================== | 971 // =========================================================================== |
956 | 972 |
957 // Configure heap size in MB before setup. Return false if the heap has been | 973 // Configure heap size in MB before setup. Return false if the heap has been |
958 // set up already. | 974 // set up already. |
959 bool ConfigureHeap(size_t max_semi_space_size, size_t max_old_space_size, | 975 bool ConfigureHeap(size_t max_semi_space_size, size_t max_old_space_size, |
960 size_t max_executable_size, size_t code_range_size); | 976 size_t max_executable_size, size_t code_range_size); |
961 bool ConfigureHeapDefault(); | 977 bool ConfigureHeapDefault(); |
962 | 978 |
(...skipping 1161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2124 // This can be calculated directly from a pointer to the heap; however, it is | 2140 // This can be calculated directly from a pointer to the heap; however, it is |
2125 // more expedient to get at the isolate directly from within Heap methods. | 2141 // more expedient to get at the isolate directly from within Heap methods. |
2126 Isolate* isolate_; | 2142 Isolate* isolate_; |
2127 | 2143 |
2128 Object* roots_[kRootListLength]; | 2144 Object* roots_[kRootListLength]; |
2129 | 2145 |
2130 size_t code_range_size_; | 2146 size_t code_range_size_; |
2131 size_t max_semi_space_size_; | 2147 size_t max_semi_space_size_; |
2132 size_t initial_semispace_size_; | 2148 size_t initial_semispace_size_; |
2133 size_t max_old_generation_size_; | 2149 size_t max_old_generation_size_; |
2150 size_t initial_max_old_generation_size_; | |
2134 size_t initial_old_generation_size_; | 2151 size_t initial_old_generation_size_; |
2135 bool old_generation_size_configured_; | 2152 bool old_generation_size_configured_; |
2136 size_t max_executable_size_; | 2153 size_t max_executable_size_; |
2137 size_t maximum_committed_; | 2154 size_t maximum_committed_; |
2138 | 2155 |
2139 // For keeping track of how much data has survived | 2156 // For keeping track of how much data has survived |
2140 // scavenge since last new space expansion. | 2157 // scavenge since last new space expansion. |
2141 size_t survived_since_last_expansion_; | 2158 size_t survived_since_last_expansion_; |
2142 | 2159 |
2143 // ... and since the last scavenge. | 2160 // ... and since the last scavenge. |
(...skipping 516 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2660 friend class LargeObjectSpace; | 2677 friend class LargeObjectSpace; |
2661 friend class NewSpace; | 2678 friend class NewSpace; |
2662 friend class PagedSpace; | 2679 friend class PagedSpace; |
2663 DISALLOW_COPY_AND_ASSIGN(AllocationObserver); | 2680 DISALLOW_COPY_AND_ASSIGN(AllocationObserver); |
2664 }; | 2681 }; |
2665 | 2682 |
2666 } // namespace internal | 2683 } // namespace internal |
2667 } // namespace v8 | 2684 } // namespace v8 |
2668 | 2685 |
2669 #endif // V8_HEAP_HEAP_H_ | 2686 #endif // V8_HEAP_HEAP_H_ |
OLD | NEW |