| 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 2094 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2105 | 2105 |
| 2106 // Initializes the allocation sites scratchpad with undefined values. | 2106 // Initializes the allocation sites scratchpad with undefined values. |
| 2107 void InitializeAllocationSitesScratchpad(); | 2107 void InitializeAllocationSitesScratchpad(); |
| 2108 | 2108 |
| 2109 // Adds an allocation site to the scratchpad if there is space left. | 2109 // Adds an allocation site to the scratchpad if there is space left. |
| 2110 void AddAllocationSiteToScratchpad(AllocationSite* site, | 2110 void AddAllocationSiteToScratchpad(AllocationSite* site, |
| 2111 ScratchpadSlotMode mode); | 2111 ScratchpadSlotMode mode); |
| 2112 | 2112 |
| 2113 void UpdateSurvivalStatistics(int start_new_space_size); | 2113 void UpdateSurvivalStatistics(int start_new_space_size); |
| 2114 | 2114 |
| 2115 enum SurvivalRateTrend { INCREASING, STABLE, DECREASING, FLUCTUATING }; |
| 2116 |
| 2115 static const int kYoungSurvivalRateHighThreshold = 90; | 2117 static const int kYoungSurvivalRateHighThreshold = 90; |
| 2118 static const int kYoungSurvivalRateLowThreshold = 10; |
| 2116 static const int kYoungSurvivalRateAllowedDeviation = 15; | 2119 static const int kYoungSurvivalRateAllowedDeviation = 15; |
| 2117 | 2120 |
| 2118 static const int kOldSurvivalRateLowThreshold = 10; | 2121 static const int kOldSurvivalRateLowThreshold = 10; |
| 2119 | 2122 |
| 2123 bool new_space_high_promotion_mode_active_; |
| 2120 int high_survival_rate_period_length_; | 2124 int high_survival_rate_period_length_; |
| 2121 intptr_t promoted_objects_size_; | 2125 intptr_t promoted_objects_size_; |
| 2126 int low_survival_rate_period_length_; |
| 2127 double survival_rate_; |
| 2122 double promotion_ratio_; | 2128 double promotion_ratio_; |
| 2123 double promotion_rate_; | 2129 double promotion_rate_; |
| 2124 intptr_t semi_space_copied_object_size_; | 2130 intptr_t semi_space_copied_object_size_; |
| 2125 intptr_t previous_semi_space_copied_object_size_; | 2131 intptr_t previous_semi_space_copied_object_size_; |
| 2126 double semi_space_copied_rate_; | 2132 double semi_space_copied_rate_; |
| 2127 int nodes_died_in_new_space_; | 2133 int nodes_died_in_new_space_; |
| 2128 int nodes_copied_in_new_space_; | 2134 int nodes_copied_in_new_space_; |
| 2129 int nodes_promoted_; | 2135 int nodes_promoted_; |
| 2130 | 2136 |
| 2131 // This is the pretenuring trigger for allocation sites that are in maybe | 2137 // This is the pretenuring trigger for allocation sites that are in maybe |
| 2132 // tenure state. When we switched to the maximum new space size we deoptimize | 2138 // tenure state. When we switched to the maximum new space size we deoptimize |
| 2133 // the code that belongs to the allocation site and derive the lifetime | 2139 // the code that belongs to the allocation site and derive the lifetime |
| 2134 // of the allocation site. | 2140 // of the allocation site. |
| 2135 unsigned int maximum_size_scavenges_; | 2141 unsigned int maximum_size_scavenges_; |
| 2136 | 2142 |
| 2143 SurvivalRateTrend previous_survival_rate_trend_; |
| 2144 SurvivalRateTrend survival_rate_trend_; |
| 2145 |
| 2146 void set_survival_rate_trend(SurvivalRateTrend survival_rate_trend) { |
| 2147 DCHECK(survival_rate_trend != FLUCTUATING); |
| 2148 previous_survival_rate_trend_ = survival_rate_trend_; |
| 2149 survival_rate_trend_ = survival_rate_trend; |
| 2150 } |
| 2151 |
| 2152 SurvivalRateTrend survival_rate_trend() { |
| 2153 if (survival_rate_trend_ == STABLE) { |
| 2154 return STABLE; |
| 2155 } else if (previous_survival_rate_trend_ == STABLE) { |
| 2156 return survival_rate_trend_; |
| 2157 } else if (survival_rate_trend_ != previous_survival_rate_trend_) { |
| 2158 return FLUCTUATING; |
| 2159 } else { |
| 2160 return survival_rate_trend_; |
| 2161 } |
| 2162 } |
| 2163 |
| 2164 bool IsStableOrIncreasingSurvivalTrend() { |
| 2165 switch (survival_rate_trend()) { |
| 2166 case STABLE: |
| 2167 case INCREASING: |
| 2168 return true; |
| 2169 default: |
| 2170 return false; |
| 2171 } |
| 2172 } |
| 2173 |
| 2174 bool IsStableOrDecreasingSurvivalTrend() { |
| 2175 switch (survival_rate_trend()) { |
| 2176 case STABLE: |
| 2177 case DECREASING: |
| 2178 return true; |
| 2179 default: |
| 2180 return false; |
| 2181 } |
| 2182 } |
| 2183 |
| 2184 bool IsIncreasingSurvivalTrend() { |
| 2185 return survival_rate_trend() == INCREASING; |
| 2186 } |
| 2187 |
| 2188 bool IsLowSurvivalRate() { return low_survival_rate_period_length_ > 0; } |
| 2189 |
| 2137 // TODO(hpayer): Allocation site pretenuring may make this method obsolete. | 2190 // TODO(hpayer): Allocation site pretenuring may make this method obsolete. |
| 2138 // Re-visit incremental marking heuristics. | 2191 // Re-visit incremental marking heuristics. |
| 2139 bool IsHighSurvivalRate() { return high_survival_rate_period_length_ > 0; } | 2192 bool IsHighSurvivalRate() { return high_survival_rate_period_length_ > 0; } |
| 2140 | 2193 |
| 2141 void ConfigureInitialOldGenerationSize(); | 2194 void ConfigureInitialOldGenerationSize(); |
| 2142 | 2195 |
| 2196 void ConfigureNewGenerationSize(); |
| 2197 |
| 2143 void SelectScavengingVisitorsTable(); | 2198 void SelectScavengingVisitorsTable(); |
| 2144 | 2199 |
| 2145 bool HasLowAllocationRate(size_t allocaion_rate); | 2200 bool HasLowAllocationRate(size_t allocaion_rate); |
| 2146 | 2201 |
| 2147 void ReduceNewSpaceSize(size_t allocaion_rate); | 2202 void ReduceNewSpaceSize(size_t allocaion_rate); |
| 2148 | 2203 |
| 2149 bool TryFinalizeIdleIncrementalMarking( | 2204 bool TryFinalizeIdleIncrementalMarking( |
| 2150 double idle_time_in_ms, size_t size_of_objects, | 2205 double idle_time_in_ms, size_t size_of_objects, |
| 2151 size_t mark_compact_speed_in_bytes_per_ms); | 2206 size_t mark_compact_speed_in_bytes_per_ms); |
| 2152 | 2207 |
| (...skipping 574 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2727 DisallowHeapAllocation no_allocation; // i.e. no gc allowed. | 2782 DisallowHeapAllocation no_allocation; // i.e. no gc allowed. |
| 2728 | 2783 |
| 2729 private: | 2784 private: |
| 2730 DISALLOW_IMPLICIT_CONSTRUCTORS(PathTracer); | 2785 DISALLOW_IMPLICIT_CONSTRUCTORS(PathTracer); |
| 2731 }; | 2786 }; |
| 2732 #endif // DEBUG | 2787 #endif // DEBUG |
| 2733 } | 2788 } |
| 2734 } // namespace v8::internal | 2789 } // namespace v8::internal |
| 2735 | 2790 |
| 2736 #endif // V8_HEAP_HEAP_H_ | 2791 #endif // V8_HEAP_HEAP_H_ |
| OLD | NEW |