| 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_H_ | 5 #ifndef V8_HEAP_H_ |
| 6 #define V8_HEAP_H_ | 6 #define V8_HEAP_H_ |
| 7 | 7 |
| 8 #include <cmath> | 8 #include <cmath> |
| 9 | 9 |
| 10 #include "allocation.h" | 10 #include "allocation.h" |
| (...skipping 1169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1180 // by pointer size. | 1180 // by pointer size. |
| 1181 static inline void CopyBlock(Address dst, Address src, int byte_size); | 1181 static inline void CopyBlock(Address dst, Address src, int byte_size); |
| 1182 | 1182 |
| 1183 // Optimized version of memmove for blocks with pointer size aligned sizes and | 1183 // Optimized version of memmove for blocks with pointer size aligned sizes and |
| 1184 // pointer size aligned addresses. | 1184 // pointer size aligned addresses. |
| 1185 static inline void MoveBlock(Address dst, Address src, int byte_size); | 1185 static inline void MoveBlock(Address dst, Address src, int byte_size); |
| 1186 | 1186 |
| 1187 // Check new space expansion criteria and expand semispaces if it was hit. | 1187 // Check new space expansion criteria and expand semispaces if it was hit. |
| 1188 void CheckNewSpaceExpansionCriteria(); | 1188 void CheckNewSpaceExpansionCriteria(); |
| 1189 | 1189 |
| 1190 inline void IncrementPromotedObjectsSize(int object_size) { |
| 1191 ASSERT(object_size > 0); |
| 1192 promoted_objects_size_ += object_size; |
| 1193 } |
| 1194 |
| 1195 inline void IncrementSemiSpaceCopiedObjectSize(int object_size) { |
| 1196 ASSERT(object_size > 0); |
| 1197 semi_space_copied_object_size_ += object_size; |
| 1198 } |
| 1199 |
| 1190 inline void IncrementYoungSurvivorsCounter(int survived) { | 1200 inline void IncrementYoungSurvivorsCounter(int survived) { |
| 1191 ASSERT(survived >= 0); | 1201 ASSERT(survived >= 0); |
| 1192 young_survivors_after_last_gc_ = survived; | |
| 1193 survived_since_last_expansion_ += survived; | 1202 survived_since_last_expansion_ += survived; |
| 1194 } | 1203 } |
| 1195 | 1204 |
| 1196 inline bool NextGCIsLikelyToBeFull() { | 1205 inline bool NextGCIsLikelyToBeFull() { |
| 1197 if (FLAG_gc_global) return true; | 1206 if (FLAG_gc_global) return true; |
| 1198 | 1207 |
| 1199 if (FLAG_stress_compaction && (gc_count_ & 1) != 0) return true; | 1208 if (FLAG_stress_compaction && (gc_count_ & 1) != 0) return true; |
| 1200 | 1209 |
| 1201 intptr_t adjusted_allocation_limit = | 1210 intptr_t adjusted_allocation_limit = |
| 1202 old_generation_allocation_limit_ - new_space_.Capacity(); | 1211 old_generation_allocation_limit_ - new_space_.Capacity(); |
| (...skipping 817 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2020 void UpdateSurvivalRateTrend(int start_new_space_size); | 2029 void UpdateSurvivalRateTrend(int start_new_space_size); |
| 2021 | 2030 |
| 2022 enum SurvivalRateTrend { INCREASING, STABLE, DECREASING, FLUCTUATING }; | 2031 enum SurvivalRateTrend { INCREASING, STABLE, DECREASING, FLUCTUATING }; |
| 2023 | 2032 |
| 2024 static const int kYoungSurvivalRateHighThreshold = 90; | 2033 static const int kYoungSurvivalRateHighThreshold = 90; |
| 2025 static const int kYoungSurvivalRateLowThreshold = 10; | 2034 static const int kYoungSurvivalRateLowThreshold = 10; |
| 2026 static const int kYoungSurvivalRateAllowedDeviation = 15; | 2035 static const int kYoungSurvivalRateAllowedDeviation = 15; |
| 2027 | 2036 |
| 2028 static const int kOldSurvivalRateLowThreshold = 10; | 2037 static const int kOldSurvivalRateLowThreshold = 10; |
| 2029 | 2038 |
| 2030 int young_survivors_after_last_gc_; | |
| 2031 int high_survival_rate_period_length_; | 2039 int high_survival_rate_period_length_; |
| 2032 int low_survival_rate_period_length_; | 2040 int low_survival_rate_period_length_; |
| 2033 double survival_rate_; | 2041 double survival_rate_; |
| 2042 intptr_t promoted_objects_size_; |
| 2043 double promotion_rate_; |
| 2044 intptr_t semi_space_copied_object_size_; |
| 2045 double semi_space_copied_rate_; |
| 2034 SurvivalRateTrend previous_survival_rate_trend_; | 2046 SurvivalRateTrend previous_survival_rate_trend_; |
| 2035 SurvivalRateTrend survival_rate_trend_; | 2047 SurvivalRateTrend survival_rate_trend_; |
| 2036 | 2048 |
| 2037 void set_survival_rate_trend(SurvivalRateTrend survival_rate_trend) { | 2049 void set_survival_rate_trend(SurvivalRateTrend survival_rate_trend) { |
| 2038 ASSERT(survival_rate_trend != FLUCTUATING); | 2050 ASSERT(survival_rate_trend != FLUCTUATING); |
| 2039 previous_survival_rate_trend_ = survival_rate_trend_; | 2051 previous_survival_rate_trend_ = survival_rate_trend_; |
| 2040 survival_rate_trend_ = survival_rate_trend; | 2052 survival_rate_trend_ = survival_rate_trend; |
| 2041 } | 2053 } |
| 2042 | 2054 |
| 2043 SurvivalRateTrend survival_rate_trend() { | 2055 SurvivalRateTrend survival_rate_trend() { |
| (...skipping 549 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2593 | 2605 |
| 2594 // Sets the collector. | 2606 // Sets the collector. |
| 2595 void set_collector(GarbageCollector collector) { collector_ = collector; } | 2607 void set_collector(GarbageCollector collector) { collector_ = collector; } |
| 2596 | 2608 |
| 2597 // Sets the GC count. | 2609 // Sets the GC count. |
| 2598 void set_gc_count(unsigned int count) { gc_count_ = count; } | 2610 void set_gc_count(unsigned int count) { gc_count_ = count; } |
| 2599 | 2611 |
| 2600 // Sets the full GC count. | 2612 // Sets the full GC count. |
| 2601 void set_full_gc_count(int count) { full_gc_count_ = count; } | 2613 void set_full_gc_count(int count) { full_gc_count_ = count; } |
| 2602 | 2614 |
| 2603 void increment_promoted_objects_size(int object_size) { | |
| 2604 promoted_objects_size_ += object_size; | |
| 2605 } | |
| 2606 | |
| 2607 void increment_nodes_died_in_new_space() { | 2615 void increment_nodes_died_in_new_space() { |
| 2608 nodes_died_in_new_space_++; | 2616 nodes_died_in_new_space_++; |
| 2609 } | 2617 } |
| 2610 | 2618 |
| 2611 void increment_nodes_copied_in_new_space() { | 2619 void increment_nodes_copied_in_new_space() { |
| 2612 nodes_copied_in_new_space_++; | 2620 nodes_copied_in_new_space_++; |
| 2613 } | 2621 } |
| 2614 | 2622 |
| 2615 void increment_nodes_promoted() { | 2623 void increment_nodes_promoted() { |
| 2616 nodes_promoted_++; | 2624 nodes_promoted_++; |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2650 intptr_t in_free_list_or_wasted_before_gc_; | 2658 intptr_t in_free_list_or_wasted_before_gc_; |
| 2651 | 2659 |
| 2652 // Difference between space used in the heap at the beginning of the current | 2660 // Difference between space used in the heap at the beginning of the current |
| 2653 // collection and the end of the previous collection. | 2661 // collection and the end of the previous collection. |
| 2654 intptr_t allocated_since_last_gc_; | 2662 intptr_t allocated_since_last_gc_; |
| 2655 | 2663 |
| 2656 // Amount of time spent in mutator that is time elapsed between end of the | 2664 // Amount of time spent in mutator that is time elapsed between end of the |
| 2657 // previous collection and the beginning of the current one. | 2665 // previous collection and the beginning of the current one. |
| 2658 double spent_in_mutator_; | 2666 double spent_in_mutator_; |
| 2659 | 2667 |
| 2660 // Size of objects promoted during the current collection. | |
| 2661 intptr_t promoted_objects_size_; | |
| 2662 | |
| 2663 // Number of died nodes in the new space. | 2668 // Number of died nodes in the new space. |
| 2664 int nodes_died_in_new_space_; | 2669 int nodes_died_in_new_space_; |
| 2665 | 2670 |
| 2666 // Number of copied nodes to the new space. | 2671 // Number of copied nodes to the new space. |
| 2667 int nodes_copied_in_new_space_; | 2672 int nodes_copied_in_new_space_; |
| 2668 | 2673 |
| 2669 // Number of promoted nodes to the old space. | 2674 // Number of promoted nodes to the old space. |
| 2670 int nodes_promoted_; | 2675 int nodes_promoted_; |
| 2671 | 2676 |
| 2672 // Incremental marking steps counters. | 2677 // Incremental marking steps counters. |
| (...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2818 DisallowHeapAllocation no_allocation; // i.e. no gc allowed. | 2823 DisallowHeapAllocation no_allocation; // i.e. no gc allowed. |
| 2819 | 2824 |
| 2820 private: | 2825 private: |
| 2821 DISALLOW_IMPLICIT_CONSTRUCTORS(PathTracer); | 2826 DISALLOW_IMPLICIT_CONSTRUCTORS(PathTracer); |
| 2822 }; | 2827 }; |
| 2823 #endif // DEBUG | 2828 #endif // DEBUG |
| 2824 | 2829 |
| 2825 } } // namespace v8::internal | 2830 } } // namespace v8::internal |
| 2826 | 2831 |
| 2827 #endif // V8_HEAP_H_ | 2832 #endif // V8_HEAP_H_ |
| OLD | NEW |