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 1805 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1816 // =========================================================================== | 1816 // =========================================================================== |
1817 // GC statistics. ============================================================ | 1817 // GC statistics. ============================================================ |
1818 // =========================================================================== | 1818 // =========================================================================== |
1819 | 1819 |
1820 inline size_t OldGenerationSpaceAvailable() { | 1820 inline size_t OldGenerationSpaceAvailable() { |
1821 if (old_generation_allocation_limit_ <= PromotedTotalSize()) return 0; | 1821 if (old_generation_allocation_limit_ <= PromotedTotalSize()) return 0; |
1822 return old_generation_allocation_limit_ - | 1822 return old_generation_allocation_limit_ - |
1823 static_cast<size_t>(PromotedTotalSize()); | 1823 static_cast<size_t>(PromotedTotalSize()); |
1824 } | 1824 } |
1825 | 1825 |
| 1826 // We allow incremental marking to overshoot the allocation limit for |
| 1827 // performace reasons. If the overshoot is too large then we are more |
| 1828 // eager to finalize incremental marking. |
| 1829 inline bool AllocationLimitOvershotByLargeMargin() { |
| 1830 if (old_generation_allocation_limit_ >= PromotedTotalSize()) return false; |
| 1831 uint64_t overshoot = PromotedTotalSize() - old_generation_allocation_limit_; |
| 1832 // Overshoot margin is 50% of allocation limit or half-way to the max heap. |
| 1833 uint64_t margin = |
| 1834 Min(old_generation_allocation_limit_ / 2, |
| 1835 (max_old_generation_size_ - old_generation_allocation_limit_) / 2); |
| 1836 return overshoot >= margin; |
| 1837 } |
| 1838 |
1826 void UpdateTotalGCTime(double duration); | 1839 void UpdateTotalGCTime(double duration); |
1827 | 1840 |
1828 bool MaximumSizeScavenge() { return maximum_size_scavenges_ > 0; } | 1841 bool MaximumSizeScavenge() { return maximum_size_scavenges_ > 0; } |
1829 | 1842 |
1830 // =========================================================================== | 1843 // =========================================================================== |
1831 // Growing strategy. ========================================================= | 1844 // Growing strategy. ========================================================= |
1832 // =========================================================================== | 1845 // =========================================================================== |
1833 | 1846 |
1834 // Decrease the allocation limit if the new limit based on the given | 1847 // Decrease the allocation limit if the new limit based on the given |
1835 // parameters is lower than the current limit. | 1848 // parameters is lower than the current limit. |
(...skipping 813 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2649 friend class LargeObjectSpace; | 2662 friend class LargeObjectSpace; |
2650 friend class NewSpace; | 2663 friend class NewSpace; |
2651 friend class PagedSpace; | 2664 friend class PagedSpace; |
2652 DISALLOW_COPY_AND_ASSIGN(AllocationObserver); | 2665 DISALLOW_COPY_AND_ASSIGN(AllocationObserver); |
2653 }; | 2666 }; |
2654 | 2667 |
2655 } // namespace internal | 2668 } // namespace internal |
2656 } // namespace v8 | 2669 } // namespace v8 |
2657 | 2670 |
2658 #endif // V8_HEAP_HEAP_H_ | 2671 #endif // V8_HEAP_HEAP_H_ |
OLD | NEW |