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 568 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
579 | 579 |
580 // Support for partial snapshots. After calling this we have a linear | 580 // Support for partial snapshots. After calling this we have a linear |
581 // space to write objects in each space. | 581 // space to write objects in each space. |
582 struct Chunk { | 582 struct Chunk { |
583 uint32_t size; | 583 uint32_t size; |
584 Address start; | 584 Address start; |
585 Address end; | 585 Address end; |
586 }; | 586 }; |
587 typedef List<Chunk> Reservation; | 587 typedef List<Chunk> Reservation; |
588 | 588 |
589 static const int kInitalOldGenerationLimitFactor = 2; | |
590 | |
591 #if V8_OS_ANDROID | 589 #if V8_OS_ANDROID |
592 // Don't apply pointer multiplier on Android since it has no swap space and | 590 // Don't apply pointer multiplier on Android since it has no swap space and |
593 // should instead adapt it's heap size based on available physical memory. | 591 // should instead adapt it's heap size based on available physical memory. |
594 static const int kPointerMultiplier = 1; | 592 static const int kPointerMultiplier = 1; |
595 #else | 593 #else |
596 static const int kPointerMultiplier = i::kPointerSize / 4; | 594 static const int kPointerMultiplier = i::kPointerSize / 4; |
597 #endif | 595 #endif |
598 | 596 |
599 // The new space size has to be a power of 2. Sizes are in MB. | 597 // The new space size has to be a power of 2. Sizes are in MB. |
600 static const int kMaxSemiSpaceSizeLowMemoryDevice = 1 * kPointerMultiplier; | 598 static const int kMaxSemiSpaceSizeLowMemoryDevice = 1 * kPointerMultiplier; |
(...skipping 1100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1701 | 1699 |
1702 // Record statistics before and after garbage collection. | 1700 // Record statistics before and after garbage collection. |
1703 void ReportStatisticsBeforeGC(); | 1701 void ReportStatisticsBeforeGC(); |
1704 void ReportStatisticsAfterGC(); | 1702 void ReportStatisticsAfterGC(); |
1705 | 1703 |
1706 // Creates and installs the full-sized number string cache. | 1704 // Creates and installs the full-sized number string cache. |
1707 int FullSizeNumberStringCacheLength(); | 1705 int FullSizeNumberStringCacheLength(); |
1708 // Flush the number to string cache. | 1706 // Flush the number to string cache. |
1709 void FlushNumberStringCache(); | 1707 void FlushNumberStringCache(); |
1710 | 1708 |
1711 void ConfigureInitialOldGenerationSize(); | |
1712 | |
1713 bool HasLowYoungGenerationAllocationRate(); | 1709 bool HasLowYoungGenerationAllocationRate(); |
1714 bool HasLowOldGenerationAllocationRate(); | 1710 bool HasLowOldGenerationAllocationRate(); |
1715 double YoungGenerationMutatorUtilization(); | 1711 double YoungGenerationMutatorUtilization(); |
1716 double OldGenerationMutatorUtilization(); | 1712 double OldGenerationMutatorUtilization(); |
1717 | 1713 |
1718 void ReduceNewSpaceSize(); | 1714 void ReduceNewSpaceSize(); |
1719 | 1715 |
1720 GCIdleTimeHeapState ComputeHeapState(); | 1716 GCIdleTimeHeapState ComputeHeapState(); |
1721 | 1717 |
1722 bool PerformIdleTimeAction(GCIdleTimeAction action, | 1718 bool PerformIdleTimeAction(GCIdleTimeAction action, |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1791 void ProcessAllWeakReferences(WeakObjectRetainer* retainer); | 1787 void ProcessAllWeakReferences(WeakObjectRetainer* retainer); |
1792 void ProcessYoungWeakReferences(WeakObjectRetainer* retainer); | 1788 void ProcessYoungWeakReferences(WeakObjectRetainer* retainer); |
1793 void ProcessNativeContexts(WeakObjectRetainer* retainer); | 1789 void ProcessNativeContexts(WeakObjectRetainer* retainer); |
1794 void ProcessAllocationSites(WeakObjectRetainer* retainer); | 1790 void ProcessAllocationSites(WeakObjectRetainer* retainer); |
1795 void ProcessWeakListRoots(WeakObjectRetainer* retainer); | 1791 void ProcessWeakListRoots(WeakObjectRetainer* retainer); |
1796 | 1792 |
1797 // =========================================================================== | 1793 // =========================================================================== |
1798 // GC statistics. ============================================================ | 1794 // GC statistics. ============================================================ |
1799 // =========================================================================== | 1795 // =========================================================================== |
1800 | 1796 |
1801 inline intptr_t OldGenerationSpaceAvailable() { | 1797 intptr_t OldGenerationSpaceAvailable(); |
1802 return old_generation_allocation_limit_ - PromotedTotalSize(); | |
1803 } | |
1804 | 1798 |
1805 void UpdateTotalGCTime(double duration); | 1799 void UpdateTotalGCTime(double duration); |
1806 | 1800 |
1807 bool MaximumSizeScavenge() { return maximum_size_scavenges_ > 0; } | 1801 bool MaximumSizeScavenge() { return maximum_size_scavenges_ > 0; } |
1808 | 1802 |
1809 // =========================================================================== | 1803 // =========================================================================== |
1810 // Growing strategy. ========================================================= | 1804 // Growing strategy. ========================================================= |
1811 // =========================================================================== | 1805 // =========================================================================== |
1812 | 1806 |
1807 static const int kInitalOldGenerationLimitFactor = 2; | |
1808 | |
1809 // For some webpages RAIL mode does not switch from PERFORMANCE_LOAD. | |
1810 // This constant limits the effect of load RAIL mode on GC. | |
1811 // The value is arbitrary and chosen as the largest load time observed in | |
1812 // v8 browsing benchmarks. | |
1813 static const int kMaxLoadTimeMs = 3000; | |
Hannes Payer (out of office)
2016/10/11 09:02:09
Why 3 seconds? Load was originally aiming for 1 se
ulan
2016/12/02 11:42:28
The value is chosen as the largest load time obser
| |
1814 | |
1815 bool ShouldOptimizeForLoadTime(); | |
1816 | |
1813 // Decrease the allocation limit if the new limit based on the given | 1817 // Decrease the allocation limit if the new limit based on the given |
1814 // parameters is lower than the current limit. | 1818 // parameters is lower than the current limit. |
1815 void DampenOldGenerationAllocationLimit(intptr_t old_gen_size, | 1819 void DampenOldGenerationAllocationLimit(intptr_t old_gen_size, |
1816 double gc_speed, | 1820 double gc_speed, |
1817 double mutator_speed); | 1821 double mutator_speed); |
1818 | 1822 |
1819 | 1823 |
1820 // Calculates the allocation limit based on a given growing factor and a | 1824 // Calculates the allocation limit based on a given growing factor and a |
1821 // given old generation size. | 1825 // given old generation size. |
1822 intptr_t CalculateOldGenerationAllocationLimit(double factor, | 1826 intptr_t CalculateOldGenerationAllocationLimit(double factor, |
(...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2089 // This can be calculated directly from a pointer to the heap; however, it is | 2093 // This can be calculated directly from a pointer to the heap; however, it is |
2090 // more expedient to get at the isolate directly from within Heap methods. | 2094 // more expedient to get at the isolate directly from within Heap methods. |
2091 Isolate* isolate_; | 2095 Isolate* isolate_; |
2092 | 2096 |
2093 Object* roots_[kRootListLength]; | 2097 Object* roots_[kRootListLength]; |
2094 | 2098 |
2095 size_t code_range_size_; | 2099 size_t code_range_size_; |
2096 int max_semi_space_size_; | 2100 int max_semi_space_size_; |
2097 int initial_semispace_size_; | 2101 int initial_semispace_size_; |
2098 intptr_t max_old_generation_size_; | 2102 intptr_t max_old_generation_size_; |
2099 intptr_t initial_old_generation_size_; | |
2100 bool old_generation_size_configured_; | |
2101 intptr_t max_executable_size_; | 2103 intptr_t max_executable_size_; |
2102 size_t maximum_committed_; | 2104 size_t maximum_committed_; |
2103 | 2105 |
2104 // For keeping track of how much data has survived | 2106 // For keeping track of how much data has survived |
2105 // scavenge since last new space expansion. | 2107 // scavenge since last new space expansion. |
2106 intptr_t survived_since_last_expansion_; | 2108 intptr_t survived_since_last_expansion_; |
2107 | 2109 |
2108 // ... and since the last scavenge. | 2110 // ... and since the last scavenge. |
2109 intptr_t survived_last_scavenge_; | 2111 intptr_t survived_last_scavenge_; |
2110 | 2112 |
(...skipping 528 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2639 } | 2641 } |
2640 | 2642 |
2641 private: | 2643 private: |
2642 Heap* heap_; | 2644 Heap* heap_; |
2643 }; | 2645 }; |
2644 | 2646 |
2645 } // namespace internal | 2647 } // namespace internal |
2646 } // namespace v8 | 2648 } // namespace v8 |
2647 | 2649 |
2648 #endif // V8_HEAP_HEAP_H_ | 2650 #endif // V8_HEAP_HEAP_H_ |
OLD | NEW |