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 | 9 |
10 #include "src/allocation.h" | 10 #include "src/allocation.h" |
(...skipping 1111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1122 // The executable size has to be a multiple of Page::kPageSize. | 1122 // The executable size has to be a multiple of Page::kPageSize. |
1123 // Sizes are in MB. | 1123 // Sizes are in MB. |
1124 static const int kMaxExecutableSizeLowMemoryDevice = 96 * kPointerMultiplier; | 1124 static const int kMaxExecutableSizeLowMemoryDevice = 96 * kPointerMultiplier; |
1125 static const int kMaxExecutableSizeMediumMemoryDevice = | 1125 static const int kMaxExecutableSizeMediumMemoryDevice = |
1126 192 * kPointerMultiplier; | 1126 192 * kPointerMultiplier; |
1127 static const int kMaxExecutableSizeHighMemoryDevice = | 1127 static const int kMaxExecutableSizeHighMemoryDevice = |
1128 256 * kPointerMultiplier; | 1128 256 * kPointerMultiplier; |
1129 static const int kMaxExecutableSizeHugeMemoryDevice = | 1129 static const int kMaxExecutableSizeHugeMemoryDevice = |
1130 256 * kPointerMultiplier; | 1130 256 * kPointerMultiplier; |
1131 | 1131 |
1132 intptr_t OldGenerationAllocationLimit(intptr_t old_gen_size, | 1132 void SetOldGenerationAllocationLimit(intptr_t old_gen_size, |
1133 int freed_global_handles); | 1133 int freed_global_handles); |
1134 | 1134 |
1135 // Indicates whether inline bump-pointer allocation has been disabled. | 1135 // Indicates whether inline bump-pointer allocation has been disabled. |
1136 bool inline_allocation_disabled() { return inline_allocation_disabled_; } | 1136 bool inline_allocation_disabled() { return inline_allocation_disabled_; } |
1137 | 1137 |
1138 // Switch whether inline bump-pointer allocation should be used. | 1138 // Switch whether inline bump-pointer allocation should be used. |
1139 void EnableInlineAllocation(); | 1139 void EnableInlineAllocation(); |
1140 void DisableInlineAllocation(); | 1140 void DisableInlineAllocation(); |
1141 | 1141 |
1142 // Implements the corresponding V8 API function. | 1142 // Implements the corresponding V8 API function. |
1143 bool IdleNotification(double deadline_in_seconds); | 1143 bool IdleNotification(double deadline_in_seconds); |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1237 } | 1237 } |
1238 | 1238 |
1239 inline bool NextGCIsLikelyToBeFull() { | 1239 inline bool NextGCIsLikelyToBeFull() { |
1240 if (FLAG_gc_global) return true; | 1240 if (FLAG_gc_global) return true; |
1241 | 1241 |
1242 if (FLAG_stress_compaction && (gc_count_ & 1) != 0) return true; | 1242 if (FLAG_stress_compaction && (gc_count_ & 1) != 0) return true; |
1243 | 1243 |
1244 intptr_t adjusted_allocation_limit = | 1244 intptr_t adjusted_allocation_limit = |
1245 old_generation_allocation_limit_ - new_space_.Capacity(); | 1245 old_generation_allocation_limit_ - new_space_.Capacity(); |
1246 | 1246 |
1247 if (PromotedTotalSize() >= adjusted_allocation_limit) return true; | 1247 if (PromotedTotalSize() >= adjusted_allocation_limit) { |
1248 if (FLAG_trace_gc) { | |
1249 PrintF("Next GC will be full: We are at %" V8_PTR_PREFIX | |
Hannes Payer (out of office)
2015/03/25 14:30:06
... likely to be full
Erik Corry Chromium.org
2015/03/25 15:16:06
Done.
| |
1250 "dMbytes out of %" V8_PTR_PREFIX "dMbytes\n", | |
1251 PromotedTotalSize() >> 20, | |
1252 old_generation_allocation_limit_ >> 20); | |
1253 } | |
1254 return true; | |
1255 } | |
1256 | |
1257 if (CommittedOldGenerationMemory() >= | |
1258 old_generation_committed_memory_limit_) { | |
1259 if (FLAG_trace_gc) { | |
1260 PrintF("Next GC will be full: We are at %" V8_PTR_PREFIX | |
Hannes Payer (out of office)
2015/03/25 14:30:06
... likely to be full
Erik Corry Chromium.org
2015/03/25 15:16:06
Done.
| |
1261 "dMbytes committed out of %" V8_PTR_PREFIX "dMbytes\n", | |
1262 CommittedOldGenerationMemory() >> 20, | |
1263 old_generation_committed_memory_limit_ >> 20); | |
1264 } | |
1265 return true; | |
1266 } | |
1248 | 1267 |
1249 return false; | 1268 return false; |
1250 } | 1269 } |
1251 | 1270 |
1252 void UpdateNewSpaceReferencesInExternalStringTable( | 1271 void UpdateNewSpaceReferencesInExternalStringTable( |
1253 ExternalStringTableUpdaterCallback updater_func); | 1272 ExternalStringTableUpdaterCallback updater_func); |
1254 | 1273 |
1255 void UpdateReferencesInExternalStringTable( | 1274 void UpdateReferencesInExternalStringTable( |
1256 ExternalStringTableUpdaterCallback updater_func); | 1275 ExternalStringTableUpdaterCallback updater_func); |
1257 | 1276 |
(...skipping 370 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1628 #ifdef DEBUG | 1647 #ifdef DEBUG |
1629 // If the --gc-interval flag is set to a positive value, this | 1648 // If the --gc-interval flag is set to a positive value, this |
1630 // variable holds the value indicating the number of allocations | 1649 // variable holds the value indicating the number of allocations |
1631 // remain until the next failure and garbage collection. | 1650 // remain until the next failure and garbage collection. |
1632 int allocation_timeout_; | 1651 int allocation_timeout_; |
1633 #endif // DEBUG | 1652 #endif // DEBUG |
1634 | 1653 |
1635 // Limit that triggers a global GC on the next (normally caused) GC. This | 1654 // Limit that triggers a global GC on the next (normally caused) GC. This |
1636 // is checked when we have already decided to do a GC to help determine | 1655 // is checked when we have already decided to do a GC to help determine |
1637 // which collector to invoke, before expanding a paged space in the old | 1656 // which collector to invoke, before expanding a paged space in the old |
1638 // generation and on every allocation in large object space. | 1657 // generation and on every allocation in large object space. This only |
1658 // measures objects, so it may be underreporting if we have fragmentation. | |
1639 intptr_t old_generation_allocation_limit_; | 1659 intptr_t old_generation_allocation_limit_; |
1640 | 1660 |
1661 // As above, but counts pages, not objects, so is more likely to trigger | |
1662 // when we have fragmentation. | |
1663 intptr_t old_generation_committed_memory_limit_; | |
1664 | |
1641 // Indicates that an allocation has failed in the old generation since the | 1665 // Indicates that an allocation has failed in the old generation since the |
1642 // last GC. | 1666 // last GC. |
1643 bool old_gen_exhausted_; | 1667 bool old_gen_exhausted_; |
1644 | 1668 |
1645 // Indicates that inline bump-pointer allocation has been globally disabled | 1669 // Indicates that inline bump-pointer allocation has been globally disabled |
1646 // for all spaces. This is used to disable allocations in generated code. | 1670 // for all spaces. This is used to disable allocations in generated code. |
1647 bool inline_allocation_disabled_; | 1671 bool inline_allocation_disabled_; |
1648 | 1672 |
1649 // Weak list heads, threaded through the objects. | 1673 // Weak list heads, threaded through the objects. |
1650 // List heads are initialized lazily and contain the undefined_value at start. | 1674 // List heads are initialized lazily and contain the undefined_value at start. |
(...skipping 412 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2063 void ConfigureInitialOldGenerationSize(); | 2087 void ConfigureInitialOldGenerationSize(); |
2064 | 2088 |
2065 void SelectScavengingVisitorsTable(); | 2089 void SelectScavengingVisitorsTable(); |
2066 | 2090 |
2067 void IdleMarkCompact(const char* message); | 2091 void IdleMarkCompact(const char* message); |
2068 | 2092 |
2069 bool TryFinalizeIdleIncrementalMarking( | 2093 bool TryFinalizeIdleIncrementalMarking( |
2070 double idle_time_in_ms, size_t size_of_objects, | 2094 double idle_time_in_ms, size_t size_of_objects, |
2071 size_t mark_compact_speed_in_bytes_per_ms); | 2095 size_t mark_compact_speed_in_bytes_per_ms); |
2072 | 2096 |
2073 bool WorthActivatingIncrementalMarking(); | |
2074 | |
2075 void ClearObjectStats(bool clear_last_time_stats = false); | 2097 void ClearObjectStats(bool clear_last_time_stats = false); |
2076 | 2098 |
2077 inline void UpdateAllocationsHash(HeapObject* object); | 2099 inline void UpdateAllocationsHash(HeapObject* object); |
2078 inline void UpdateAllocationsHash(uint32_t value); | 2100 inline void UpdateAllocationsHash(uint32_t value); |
2079 inline void PrintAlloctionsHash(); | 2101 inline void PrintAlloctionsHash(); |
2080 | 2102 |
2081 // Object counts and used memory by InstanceType | 2103 // Object counts and used memory by InstanceType |
2082 size_t object_counts_[OBJECT_STATS_COUNT]; | 2104 size_t object_counts_[OBJECT_STATS_COUNT]; |
2083 size_t object_counts_last_time_[OBJECT_STATS_COUNT]; | 2105 size_t object_counts_last_time_[OBJECT_STATS_COUNT]; |
2084 size_t object_sizes_[OBJECT_STATS_COUNT]; | 2106 size_t object_sizes_[OBJECT_STATS_COUNT]; |
(...skipping 533 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2618 DisallowHeapAllocation no_allocation; // i.e. no gc allowed. | 2640 DisallowHeapAllocation no_allocation; // i.e. no gc allowed. |
2619 | 2641 |
2620 private: | 2642 private: |
2621 DISALLOW_IMPLICIT_CONSTRUCTORS(PathTracer); | 2643 DISALLOW_IMPLICIT_CONSTRUCTORS(PathTracer); |
2622 }; | 2644 }; |
2623 #endif // DEBUG | 2645 #endif // DEBUG |
2624 } | 2646 } |
2625 } // namespace v8::internal | 2647 } // namespace v8::internal |
2626 | 2648 |
2627 #endif // V8_HEAP_HEAP_H_ | 2649 #endif // V8_HEAP_HEAP_H_ |
OLD | NEW |