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 616 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
627 void UpdateMaximumCommitted(); | 627 void UpdateMaximumCommitted(); |
628 | 628 |
629 // Returns the available bytes in space w/o growing. | 629 // Returns the available bytes in space w/o growing. |
630 // Heap doesn't guarantee that it can allocate an object that requires | 630 // Heap doesn't guarantee that it can allocate an object that requires |
631 // all available bytes. Check MaxHeapObjectSize() instead. | 631 // all available bytes. Check MaxHeapObjectSize() instead. |
632 intptr_t Available(); | 632 intptr_t Available(); |
633 | 633 |
634 // Returns of size of all objects residing in the heap. | 634 // Returns of size of all objects residing in the heap. |
635 intptr_t SizeOfObjects(); | 635 intptr_t SizeOfObjects(); |
636 | 636 |
| 637 intptr_t old_generation_allocation_limit() const { |
| 638 return old_generation_allocation_limit_; |
| 639 } |
| 640 |
637 // Return the starting address and a mask for the new space. And-masking an | 641 // Return the starting address and a mask for the new space. And-masking an |
638 // address with the mask will result in the start address of the new space | 642 // address with the mask will result in the start address of the new space |
639 // for all addresses in either semispace. | 643 // for all addresses in either semispace. |
640 Address NewSpaceStart() { return new_space_.start(); } | 644 Address NewSpaceStart() { return new_space_.start(); } |
641 uintptr_t NewSpaceMask() { return new_space_.mask(); } | 645 uintptr_t NewSpaceMask() { return new_space_.mask(); } |
642 Address NewSpaceTop() { return new_space_.top(); } | 646 Address NewSpaceTop() { return new_space_.top(); } |
643 | 647 |
644 NewSpace* new_space() { return &new_space_; } | 648 NewSpace* new_space() { return &new_space_; } |
645 OldSpace* old_space() { return old_space_; } | 649 OldSpace* old_space() { return old_space_; } |
646 OldSpace* code_space() { return code_space_; } | 650 OldSpace* code_space() { return code_space_; } |
(...skipping 466 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1113 // The executable size has to be a multiple of Page::kPageSize. | 1117 // The executable size has to be a multiple of Page::kPageSize. |
1114 // Sizes are in MB. | 1118 // Sizes are in MB. |
1115 static const int kMaxExecutableSizeLowMemoryDevice = 96 * kPointerMultiplier; | 1119 static const int kMaxExecutableSizeLowMemoryDevice = 96 * kPointerMultiplier; |
1116 static const int kMaxExecutableSizeMediumMemoryDevice = | 1120 static const int kMaxExecutableSizeMediumMemoryDevice = |
1117 192 * kPointerMultiplier; | 1121 192 * kPointerMultiplier; |
1118 static const int kMaxExecutableSizeHighMemoryDevice = | 1122 static const int kMaxExecutableSizeHighMemoryDevice = |
1119 256 * kPointerMultiplier; | 1123 256 * kPointerMultiplier; |
1120 static const int kMaxExecutableSizeHugeMemoryDevice = | 1124 static const int kMaxExecutableSizeHugeMemoryDevice = |
1121 256 * kPointerMultiplier; | 1125 256 * kPointerMultiplier; |
1122 | 1126 |
1123 intptr_t OldGenerationAllocationLimit(intptr_t old_gen_size, | 1127 // Calculates the allocation limit based on a given growing factor and a |
1124 int freed_global_handles); | 1128 // given old generation size. |
| 1129 intptr_t CalculateOldGenerationAllocationLimit(double factor, |
| 1130 intptr_t old_gen_size); |
| 1131 |
| 1132 // Sets the allocation limit to trigger the next full garbage collection. |
| 1133 void SetOldGenerationAllocationLimit(intptr_t old_gen_size, |
| 1134 int freed_global_handles); |
1125 | 1135 |
1126 // Indicates whether inline bump-pointer allocation has been disabled. | 1136 // Indicates whether inline bump-pointer allocation has been disabled. |
1127 bool inline_allocation_disabled() { return inline_allocation_disabled_; } | 1137 bool inline_allocation_disabled() { return inline_allocation_disabled_; } |
1128 | 1138 |
1129 // Switch whether inline bump-pointer allocation should be used. | 1139 // Switch whether inline bump-pointer allocation should be used. |
1130 void EnableInlineAllocation(); | 1140 void EnableInlineAllocation(); |
1131 void DisableInlineAllocation(); | 1141 void DisableInlineAllocation(); |
1132 | 1142 |
1133 // Implements the corresponding V8 API function. | 1143 // Implements the corresponding V8 API function. |
1134 bool IdleNotification(double deadline_in_seconds); | 1144 bool IdleNotification(double deadline_in_seconds); |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1220 inline void IncrementNodesCopiedInNewSpace() { nodes_copied_in_new_space_++; } | 1230 inline void IncrementNodesCopiedInNewSpace() { nodes_copied_in_new_space_++; } |
1221 | 1231 |
1222 inline void IncrementNodesPromoted() { nodes_promoted_++; } | 1232 inline void IncrementNodesPromoted() { nodes_promoted_++; } |
1223 | 1233 |
1224 inline void IncrementYoungSurvivorsCounter(int survived) { | 1234 inline void IncrementYoungSurvivorsCounter(int survived) { |
1225 DCHECK(survived >= 0); | 1235 DCHECK(survived >= 0); |
1226 survived_last_scavenge_ = survived; | 1236 survived_last_scavenge_ = survived; |
1227 survived_since_last_expansion_ += survived; | 1237 survived_since_last_expansion_ += survived; |
1228 } | 1238 } |
1229 | 1239 |
1230 inline bool NextGCIsLikelyToBeFull() { | 1240 inline bool NextGCIsLikelyToBeFull(intptr_t limit) { |
1231 if (FLAG_gc_global) return true; | 1241 if (FLAG_gc_global) return true; |
1232 | 1242 |
1233 if (FLAG_stress_compaction && (gc_count_ & 1) != 0) return true; | 1243 if (FLAG_stress_compaction && (gc_count_ & 1) != 0) return true; |
1234 | 1244 |
1235 intptr_t adjusted_allocation_limit = | 1245 intptr_t adjusted_allocation_limit = limit - new_space_.Capacity(); |
1236 old_generation_allocation_limit_ - new_space_.Capacity(); | |
1237 | 1246 |
1238 if (PromotedTotalSize() >= adjusted_allocation_limit) return true; | 1247 if (PromotedTotalSize() >= adjusted_allocation_limit) return true; |
1239 | 1248 |
1240 return false; | 1249 return false; |
1241 } | 1250 } |
1242 | 1251 |
1243 void UpdateNewSpaceReferencesInExternalStringTable( | 1252 void UpdateNewSpaceReferencesInExternalStringTable( |
1244 ExternalStringTableUpdaterCallback updater_func); | 1253 ExternalStringTableUpdaterCallback updater_func); |
1245 | 1254 |
1246 void UpdateReferencesInExternalStringTable( | 1255 void UpdateReferencesInExternalStringTable( |
(...skipping 382 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1629 // remain until the next failure and garbage collection. | 1638 // remain until the next failure and garbage collection. |
1630 int allocation_timeout_; | 1639 int allocation_timeout_; |
1631 #endif // DEBUG | 1640 #endif // DEBUG |
1632 | 1641 |
1633 // Limit that triggers a global GC on the next (normally caused) GC. This | 1642 // Limit that triggers a global GC on the next (normally caused) GC. This |
1634 // is checked when we have already decided to do a GC to help determine | 1643 // is checked when we have already decided to do a GC to help determine |
1635 // which collector to invoke, before expanding a paged space in the old | 1644 // which collector to invoke, before expanding a paged space in the old |
1636 // generation and on every allocation in large object space. | 1645 // generation and on every allocation in large object space. |
1637 intptr_t old_generation_allocation_limit_; | 1646 intptr_t old_generation_allocation_limit_; |
1638 | 1647 |
| 1648 // The allocation limit when there is >16.66ms idle time in the idle time |
| 1649 // handler. |
| 1650 intptr_t idle_old_generation_allocation_limit_; |
| 1651 |
1639 // Indicates that an allocation has failed in the old generation since the | 1652 // Indicates that an allocation has failed in the old generation since the |
1640 // last GC. | 1653 // last GC. |
1641 bool old_gen_exhausted_; | 1654 bool old_gen_exhausted_; |
1642 | 1655 |
1643 // Indicates that inline bump-pointer allocation has been globally disabled | 1656 // Indicates that inline bump-pointer allocation has been globally disabled |
1644 // for all spaces. This is used to disable allocations in generated code. | 1657 // for all spaces. This is used to disable allocations in generated code. |
1645 bool inline_allocation_disabled_; | 1658 bool inline_allocation_disabled_; |
1646 | 1659 |
1647 // Weak list heads, threaded through the objects. | 1660 // Weak list heads, threaded through the objects. |
1648 // List heads are initialized lazily and contain the undefined_value at start. | 1661 // List heads are initialized lazily and contain the undefined_value at start. |
(...skipping 960 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2609 DisallowHeapAllocation no_allocation; // i.e. no gc allowed. | 2622 DisallowHeapAllocation no_allocation; // i.e. no gc allowed. |
2610 | 2623 |
2611 private: | 2624 private: |
2612 DISALLOW_IMPLICIT_CONSTRUCTORS(PathTracer); | 2625 DISALLOW_IMPLICIT_CONSTRUCTORS(PathTracer); |
2613 }; | 2626 }; |
2614 #endif // DEBUG | 2627 #endif // DEBUG |
2615 } | 2628 } |
2616 } // namespace v8::internal | 2629 } // namespace v8::internal |
2617 | 2630 |
2618 #endif // V8_HEAP_HEAP_H_ | 2631 #endif // V8_HEAP_HEAP_H_ |
OLD | NEW |