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, |
| 959 initial_max_old_generation_size_ * kDebugHeapSizeFactor)); |
| 960 } |
| 961 |
| 962 void RestoreOriginalHeapLimit() { |
| 963 // Do not set the limit lower than the live size + some slack. |
| 964 size_t min_limit = SizeOfObjects() + SizeOfObjects() / 4; |
| 965 max_old_generation_size_ = |
| 966 Min(max_old_generation_size_, |
| 967 Max(initial_max_old_generation_size_, min_limit)); |
| 968 } |
| 969 |
953 // =========================================================================== | 970 // =========================================================================== |
954 // Initialization. =========================================================== | 971 // Initialization. =========================================================== |
955 // =========================================================================== | 972 // =========================================================================== |
956 | 973 |
957 // Configure heap size in MB before setup. Return false if the heap has been | 974 // Configure heap size in MB before setup. Return false if the heap has been |
958 // set up already. | 975 // set up already. |
959 bool ConfigureHeap(size_t max_semi_space_size, size_t max_old_space_size, | 976 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); | 977 size_t max_executable_size, size_t code_range_size); |
961 bool ConfigureHeapDefault(); | 978 bool ConfigureHeapDefault(); |
962 | 979 |
(...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 | 2141 // 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. | 2142 // more expedient to get at the isolate directly from within Heap methods. |
2126 Isolate* isolate_; | 2143 Isolate* isolate_; |
2127 | 2144 |
2128 Object* roots_[kRootListLength]; | 2145 Object* roots_[kRootListLength]; |
2129 | 2146 |
2130 size_t code_range_size_; | 2147 size_t code_range_size_; |
2131 size_t max_semi_space_size_; | 2148 size_t max_semi_space_size_; |
2132 size_t initial_semispace_size_; | 2149 size_t initial_semispace_size_; |
2133 size_t max_old_generation_size_; | 2150 size_t max_old_generation_size_; |
| 2151 size_t initial_max_old_generation_size_; |
2134 size_t initial_old_generation_size_; | 2152 size_t initial_old_generation_size_; |
2135 bool old_generation_size_configured_; | 2153 bool old_generation_size_configured_; |
2136 size_t max_executable_size_; | 2154 size_t max_executable_size_; |
2137 size_t maximum_committed_; | 2155 size_t maximum_committed_; |
2138 | 2156 |
2139 // For keeping track of how much data has survived | 2157 // For keeping track of how much data has survived |
2140 // scavenge since last new space expansion. | 2158 // scavenge since last new space expansion. |
2141 size_t survived_since_last_expansion_; | 2159 size_t survived_since_last_expansion_; |
2142 | 2160 |
2143 // ... and since the last scavenge. | 2161 // ... and since the last scavenge. |
(...skipping 516 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2660 friend class LargeObjectSpace; | 2678 friend class LargeObjectSpace; |
2661 friend class NewSpace; | 2679 friend class NewSpace; |
2662 friend class PagedSpace; | 2680 friend class PagedSpace; |
2663 DISALLOW_COPY_AND_ASSIGN(AllocationObserver); | 2681 DISALLOW_COPY_AND_ASSIGN(AllocationObserver); |
2664 }; | 2682 }; |
2665 | 2683 |
2666 } // namespace internal | 2684 } // namespace internal |
2667 } // namespace v8 | 2685 } // namespace v8 |
2668 | 2686 |
2669 #endif // V8_HEAP_HEAP_H_ | 2687 #endif // V8_HEAP_HEAP_H_ |
OLD | NEW |