Chromium Code Reviews| 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 1140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1151 static const int kMaxExecutableSizeLowMemoryDevice = 96 * kPointerMultiplier; | 1151 static const int kMaxExecutableSizeLowMemoryDevice = 96 * kPointerMultiplier; |
| 1152 static const int kMaxExecutableSizeMediumMemoryDevice = | 1152 static const int kMaxExecutableSizeMediumMemoryDevice = |
| 1153 192 * kPointerMultiplier; | 1153 192 * kPointerMultiplier; |
| 1154 static const int kMaxExecutableSizeHighMemoryDevice = | 1154 static const int kMaxExecutableSizeHighMemoryDevice = |
| 1155 256 * kPointerMultiplier; | 1155 256 * kPointerMultiplier; |
| 1156 static const int kMaxExecutableSizeHugeMemoryDevice = | 1156 static const int kMaxExecutableSizeHugeMemoryDevice = |
| 1157 256 * kPointerMultiplier; | 1157 256 * kPointerMultiplier; |
| 1158 | 1158 |
| 1159 static const int kTraceRingBufferSize = 512; | 1159 static const int kTraceRingBufferSize = 512; |
| 1160 | 1160 |
| 1161 // These constant are used in HeapGrowingFactor() and to estimate if | |
| 1162 // the next GC is likely to free more memory. | |
| 1163 static const int kLowFragmentationPercent = 40; | |
| 1164 static const int kHighFragmentationPercent = 80; | |
| 1165 | |
| 1166 bool NextGCLikelyToFreeMore(int freed_handles, int fragmentation_percent) { | |
| 1167 return freed_handles > 0 || | |
| 1168 fragmentation_percent >= kLowFragmentationPercent; | |
| 1169 } | |
| 1170 | |
| 1161 // Calculates the allocation limit based on a given growing factor and a | 1171 // Calculates the allocation limit based on a given growing factor and a |
| 1162 // given old generation size. | 1172 // given old generation size. |
| 1163 intptr_t CalculateOldGenerationAllocationLimit(double factor, | 1173 intptr_t CalculateOldGenerationAllocationLimit(double factor, |
| 1164 intptr_t old_gen_size); | 1174 intptr_t old_gen_size); |
| 1165 | 1175 |
| 1166 // Sets the allocation limit to trigger the next full garbage collection. | 1176 // Sets the allocation limit to trigger the next full garbage collection. |
| 1167 void SetOldGenerationAllocationLimit(intptr_t old_gen_size, | 1177 void SetOldGenerationAllocationLimit(intptr_t old_gen_size, double factor); |
| 1168 size_t current_allocation_throughput); | 1178 |
| 1179 // Calculates the factor for old generation allocation limit. | |
| 1180 double HeapGrowingFactor(int freed_global_handles, | |
| 1181 size_t allocation_throughput, | |
| 1182 int fragmentation_percent); | |
| 1183 | |
| 1184 // Percentage of free space in old generation space that have compaction | |
| 1185 // enabled. | |
| 1186 int FragmentationOfCompactedSpacesInPercent(size_t* total_committed) { | |
| 1187 size_t live = old_space_->SizeOfObjects(); | |
| 1188 size_t committed = old_space_->CommittedMemory(); | |
| 1189 if (FLAG_compact_code_space && FLAG_incremental_code_compaction) { | |
| 1190 live += code_space_->SizeOfObjects(); | |
| 1191 committed += code_space_->CommittedMemory(); | |
| 1192 } | |
| 1193 *total_committed = committed; | |
| 1194 return 100 - static_cast<int>(100.0 * live / committed); | |
|
Hannes Payer (out of office)
2015/06/03 06:32:57
committed should never be 0 in current v8, but can
| |
| 1195 } | |
| 1169 | 1196 |
| 1170 // Indicates whether inline bump-pointer allocation has been disabled. | 1197 // Indicates whether inline bump-pointer allocation has been disabled. |
| 1171 bool inline_allocation_disabled() { return inline_allocation_disabled_; } | 1198 bool inline_allocation_disabled() { return inline_allocation_disabled_; } |
| 1172 | 1199 |
| 1173 // Switch whether inline bump-pointer allocation should be used. | 1200 // Switch whether inline bump-pointer allocation should be used. |
| 1174 void EnableInlineAllocation(); | 1201 void EnableInlineAllocation(); |
| 1175 void DisableInlineAllocation(); | 1202 void DisableInlineAllocation(); |
| 1176 | 1203 |
| 1177 // Implements the corresponding V8 API function. | 1204 // Implements the corresponding V8 API function. |
| 1178 bool IdleNotification(double deadline_in_seconds); | 1205 bool IdleNotification(double deadline_in_seconds); |
| (...skipping 1567 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2746 DisallowHeapAllocation no_allocation; // i.e. no gc allowed. | 2773 DisallowHeapAllocation no_allocation; // i.e. no gc allowed. |
| 2747 | 2774 |
| 2748 private: | 2775 private: |
| 2749 DISALLOW_IMPLICIT_CONSTRUCTORS(PathTracer); | 2776 DISALLOW_IMPLICIT_CONSTRUCTORS(PathTracer); |
| 2750 }; | 2777 }; |
| 2751 #endif // DEBUG | 2778 #endif // DEBUG |
| 2752 } | 2779 } |
| 2753 } // namespace v8::internal | 2780 } // namespace v8::internal |
| 2754 | 2781 |
| 2755 #endif // V8_HEAP_HEAP_H_ | 2782 #endif // V8_HEAP_HEAP_H_ |
| OLD | NEW |