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 | |
| 1161 // Calculates the allocation limit based on a given growing factor and a | 1166 // Calculates the allocation limit based on a given growing factor and a |
| 1162 // given old generation size. | 1167 // given old generation size. |
| 1163 intptr_t CalculateOldGenerationAllocationLimit(double factor, | 1168 intptr_t CalculateOldGenerationAllocationLimit(double factor, |
| 1164 intptr_t old_gen_size); | 1169 intptr_t old_gen_size); |
| 1165 | 1170 |
| 1166 // Sets the allocation limit to trigger the next full garbage collection. | 1171 // Sets the allocation limit to trigger the next full garbage collection. |
| 1167 void SetOldGenerationAllocationLimit(intptr_t old_gen_size, | 1172 void SetOldGenerationAllocationLimit(intptr_t old_gen_size, double factor); |
| 1168 size_t current_allocation_throughput); | 1173 |
| 1174 // Calculates the factor for old generation allocation limit. | |
| 1175 double HeapGrowingFactor(int freed_global_handles, | |
| 1176 size_t allocation_throughput, | |
| 1177 int fragmentation_percent); | |
| 1178 | |
| 1179 // Percentage of free space in old generation space that have compaction | |
| 1180 // enabled. | |
| 1181 int FragmentationOfCompactedSpacesInPercent() { | |
| 1182 size_t live = old_space_->SizeOfObjects(); | |
| 1183 size_t committed = old_space_->CommittedMemory(); | |
| 1184 if (FLAG_compact_code_space && FLAG_incremental_code_compaction) { | |
| 1185 live += code_space_->SizeOfObjects(); | |
| 1186 committed += code_space_->CommittedMemory(); | |
| 1187 } | |
| 1188 // Allow slack of one page for each space. | |
|
Hannes Payer (out of office)
2015/06/02 08:23:00
I think this function should only return the real
ulan
2015/06/02 12:27:05
Done.
| |
| 1189 const size_t kSlack = 2 * Page::kPageSize; | |
| 1190 if (live + kSlack >= committed || FLAG_never_compact) return 0; | |
| 1191 return 100 - static_cast<int>(100.0 * live / committed); | |
| 1192 } | |
| 1169 | 1193 |
| 1170 // Indicates whether inline bump-pointer allocation has been disabled. | 1194 // Indicates whether inline bump-pointer allocation has been disabled. |
| 1171 bool inline_allocation_disabled() { return inline_allocation_disabled_; } | 1195 bool inline_allocation_disabled() { return inline_allocation_disabled_; } |
| 1172 | 1196 |
| 1173 // Switch whether inline bump-pointer allocation should be used. | 1197 // Switch whether inline bump-pointer allocation should be used. |
| 1174 void EnableInlineAllocation(); | 1198 void EnableInlineAllocation(); |
| 1175 void DisableInlineAllocation(); | 1199 void DisableInlineAllocation(); |
| 1176 | 1200 |
| 1177 // Implements the corresponding V8 API function. | 1201 // Implements the corresponding V8 API function. |
| 1178 bool IdleNotification(double deadline_in_seconds); | 1202 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. | 2770 DisallowHeapAllocation no_allocation; // i.e. no gc allowed. |
| 2747 | 2771 |
| 2748 private: | 2772 private: |
| 2749 DISALLOW_IMPLICIT_CONSTRUCTORS(PathTracer); | 2773 DISALLOW_IMPLICIT_CONSTRUCTORS(PathTracer); |
| 2750 }; | 2774 }; |
| 2751 #endif // DEBUG | 2775 #endif // DEBUG |
| 2752 } | 2776 } |
| 2753 } // namespace v8::internal | 2777 } // namespace v8::internal |
| 2754 | 2778 |
| 2755 #endif // V8_HEAP_HEAP_H_ | 2779 #endif // V8_HEAP_HEAP_H_ |
| OLD | NEW |