| 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 610 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 621 void UpdateMaximumCommitted(); | 621 void UpdateMaximumCommitted(); |
| 622 | 622 |
| 623 // Returns the available bytes in space w/o growing. | 623 // Returns the available bytes in space w/o growing. |
| 624 // Heap doesn't guarantee that it can allocate an object that requires | 624 // Heap doesn't guarantee that it can allocate an object that requires |
| 625 // all available bytes. Check MaxHeapObjectSize() instead. | 625 // all available bytes. Check MaxHeapObjectSize() instead. |
| 626 intptr_t Available(); | 626 intptr_t Available(); |
| 627 | 627 |
| 628 // Returns of size of all objects residing in the heap. | 628 // Returns of size of all objects residing in the heap. |
| 629 intptr_t SizeOfObjects(); | 629 intptr_t SizeOfObjects(); |
| 630 | 630 |
| 631 intptr_t old_generation_allocation_limit() const { |
| 632 return old_generation_allocation_limit_; |
| 633 } |
| 634 |
| 631 // Return the starting address and a mask for the new space. And-masking an | 635 // Return the starting address and a mask for the new space. And-masking an |
| 632 // address with the mask will result in the start address of the new space | 636 // address with the mask will result in the start address of the new space |
| 633 // for all addresses in either semispace. | 637 // for all addresses in either semispace. |
| 634 Address NewSpaceStart() { return new_space_.start(); } | 638 Address NewSpaceStart() { return new_space_.start(); } |
| 635 uintptr_t NewSpaceMask() { return new_space_.mask(); } | 639 uintptr_t NewSpaceMask() { return new_space_.mask(); } |
| 636 Address NewSpaceTop() { return new_space_.top(); } | 640 Address NewSpaceTop() { return new_space_.top(); } |
| 637 | 641 |
| 638 NewSpace* new_space() { return &new_space_; } | 642 NewSpace* new_space() { return &new_space_; } |
| 639 OldSpace* old_pointer_space() { return old_pointer_space_; } | 643 OldSpace* old_pointer_space() { return old_pointer_space_; } |
| 640 OldSpace* old_data_space() { return old_data_space_; } | 644 OldSpace* old_data_space() { return old_data_space_; } |
| (...skipping 464 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1105 // The executable size has to be a multiple of Page::kPageSize. | 1109 // The executable size has to be a multiple of Page::kPageSize. |
| 1106 // Sizes are in MB. | 1110 // Sizes are in MB. |
| 1107 static const int kMaxExecutableSizeLowMemoryDevice = 96 * kPointerMultiplier; | 1111 static const int kMaxExecutableSizeLowMemoryDevice = 96 * kPointerMultiplier; |
| 1108 static const int kMaxExecutableSizeMediumMemoryDevice = | 1112 static const int kMaxExecutableSizeMediumMemoryDevice = |
| 1109 192 * kPointerMultiplier; | 1113 192 * kPointerMultiplier; |
| 1110 static const int kMaxExecutableSizeHighMemoryDevice = | 1114 static const int kMaxExecutableSizeHighMemoryDevice = |
| 1111 256 * kPointerMultiplier; | 1115 256 * kPointerMultiplier; |
| 1112 static const int kMaxExecutableSizeHugeMemoryDevice = | 1116 static const int kMaxExecutableSizeHugeMemoryDevice = |
| 1113 256 * kPointerMultiplier; | 1117 256 * kPointerMultiplier; |
| 1114 | 1118 |
| 1115 intptr_t OldGenerationAllocationLimit(intptr_t old_gen_size, | 1119 // Calculates the allocation limit based on a given growing factor and a |
| 1116 int freed_global_handles); | 1120 // given old generation size. |
| 1121 intptr_t CalculateOldGenerationAllocationLimit(double factor, |
| 1122 intptr_t old_gen_size); |
| 1123 |
| 1124 // Sets the allocation limit to trigger the next full garbage collection. |
| 1125 void SetOldGenerationAllocationLimit(intptr_t old_gen_size, |
| 1126 int freed_global_handles); |
| 1117 | 1127 |
| 1118 // Indicates whether inline bump-pointer allocation has been disabled. | 1128 // Indicates whether inline bump-pointer allocation has been disabled. |
| 1119 bool inline_allocation_disabled() { return inline_allocation_disabled_; } | 1129 bool inline_allocation_disabled() { return inline_allocation_disabled_; } |
| 1120 | 1130 |
| 1121 // Switch whether inline bump-pointer allocation should be used. | 1131 // Switch whether inline bump-pointer allocation should be used. |
| 1122 void EnableInlineAllocation(); | 1132 void EnableInlineAllocation(); |
| 1123 void DisableInlineAllocation(); | 1133 void DisableInlineAllocation(); |
| 1124 | 1134 |
| 1125 // Implements the corresponding V8 API function. | 1135 // Implements the corresponding V8 API function. |
| 1126 bool IdleNotification(double deadline_in_seconds); | 1136 bool IdleNotification(double deadline_in_seconds); |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1212 inline void IncrementNodesCopiedInNewSpace() { nodes_copied_in_new_space_++; } | 1222 inline void IncrementNodesCopiedInNewSpace() { nodes_copied_in_new_space_++; } |
| 1213 | 1223 |
| 1214 inline void IncrementNodesPromoted() { nodes_promoted_++; } | 1224 inline void IncrementNodesPromoted() { nodes_promoted_++; } |
| 1215 | 1225 |
| 1216 inline void IncrementYoungSurvivorsCounter(int survived) { | 1226 inline void IncrementYoungSurvivorsCounter(int survived) { |
| 1217 DCHECK(survived >= 0); | 1227 DCHECK(survived >= 0); |
| 1218 survived_last_scavenge_ = survived; | 1228 survived_last_scavenge_ = survived; |
| 1219 survived_since_last_expansion_ += survived; | 1229 survived_since_last_expansion_ += survived; |
| 1220 } | 1230 } |
| 1221 | 1231 |
| 1222 inline bool NextGCIsLikelyToBeFull() { | 1232 inline bool NextGCIsLikelyToBeFull(intptr_t limit) { |
| 1223 if (FLAG_gc_global) return true; | 1233 if (FLAG_gc_global) return true; |
| 1224 | 1234 |
| 1225 if (FLAG_stress_compaction && (gc_count_ & 1) != 0) return true; | 1235 if (FLAG_stress_compaction && (gc_count_ & 1) != 0) return true; |
| 1226 | 1236 |
| 1227 intptr_t adjusted_allocation_limit = | 1237 intptr_t adjusted_allocation_limit = limit - new_space_.Capacity(); |
| 1228 old_generation_allocation_limit_ - new_space_.Capacity(); | |
| 1229 | 1238 |
| 1230 if (PromotedTotalSize() >= adjusted_allocation_limit) return true; | 1239 if (PromotedTotalSize() >= adjusted_allocation_limit) return true; |
| 1231 | 1240 |
| 1232 return false; | 1241 return false; |
| 1233 } | 1242 } |
| 1234 | 1243 |
| 1235 void UpdateNewSpaceReferencesInExternalStringTable( | 1244 void UpdateNewSpaceReferencesInExternalStringTable( |
| 1236 ExternalStringTableUpdaterCallback updater_func); | 1245 ExternalStringTableUpdaterCallback updater_func); |
| 1237 | 1246 |
| 1238 void UpdateReferencesInExternalStringTable( | 1247 void UpdateReferencesInExternalStringTable( |
| (...skipping 358 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1597 // remain until the next failure and garbage collection. | 1606 // remain until the next failure and garbage collection. |
| 1598 int allocation_timeout_; | 1607 int allocation_timeout_; |
| 1599 #endif // DEBUG | 1608 #endif // DEBUG |
| 1600 | 1609 |
| 1601 // Limit that triggers a global GC on the next (normally caused) GC. This | 1610 // Limit that triggers a global GC on the next (normally caused) GC. This |
| 1602 // is checked when we have already decided to do a GC to help determine | 1611 // is checked when we have already decided to do a GC to help determine |
| 1603 // which collector to invoke, before expanding a paged space in the old | 1612 // which collector to invoke, before expanding a paged space in the old |
| 1604 // generation and on every allocation in large object space. | 1613 // generation and on every allocation in large object space. |
| 1605 intptr_t old_generation_allocation_limit_; | 1614 intptr_t old_generation_allocation_limit_; |
| 1606 | 1615 |
| 1616 // The allocation limit when there is > kMinIdleTimeToStartIncrementalMarking |
| 1617 // idle time in the idle time handler. |
| 1618 intptr_t idle_old_generation_allocation_limit_; |
| 1619 |
| 1607 // Indicates that an allocation has failed in the old generation since the | 1620 // Indicates that an allocation has failed in the old generation since the |
| 1608 // last GC. | 1621 // last GC. |
| 1609 bool old_gen_exhausted_; | 1622 bool old_gen_exhausted_; |
| 1610 | 1623 |
| 1611 // Indicates that inline bump-pointer allocation has been globally disabled | 1624 // Indicates that inline bump-pointer allocation has been globally disabled |
| 1612 // for all spaces. This is used to disable allocations in generated code. | 1625 // for all spaces. This is used to disable allocations in generated code. |
| 1613 bool inline_allocation_disabled_; | 1626 bool inline_allocation_disabled_; |
| 1614 | 1627 |
| 1615 // Weak list heads, threaded through the objects. | 1628 // Weak list heads, threaded through the objects. |
| 1616 // List heads are initilized lazily and contain the undefined_value at start. | 1629 // List heads are initilized lazily and contain the undefined_value at start. |
| (...skipping 954 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2571 DisallowHeapAllocation no_allocation; // i.e. no gc allowed. | 2584 DisallowHeapAllocation no_allocation; // i.e. no gc allowed. |
| 2572 | 2585 |
| 2573 private: | 2586 private: |
| 2574 DISALLOW_IMPLICIT_CONSTRUCTORS(PathTracer); | 2587 DISALLOW_IMPLICIT_CONSTRUCTORS(PathTracer); |
| 2575 }; | 2588 }; |
| 2576 #endif // DEBUG | 2589 #endif // DEBUG |
| 2577 } | 2590 } |
| 2578 } // namespace v8::internal | 2591 } // namespace v8::internal |
| 2579 | 2592 |
| 2580 #endif // V8_HEAP_HEAP_H_ | 2593 #endif // V8_HEAP_HEAP_H_ |
| OLD | NEW |