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 "src/allocation.h" | 10 #include "src/allocation.h" |
(...skipping 1164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1175 inline void IncrementPromotedObjectsSize(int object_size) { | 1175 inline void IncrementPromotedObjectsSize(int object_size) { |
1176 ASSERT(object_size > 0); | 1176 ASSERT(object_size > 0); |
1177 promoted_objects_size_ += object_size; | 1177 promoted_objects_size_ += object_size; |
1178 } | 1178 } |
1179 | 1179 |
1180 inline void IncrementSemiSpaceCopiedObjectSize(int object_size) { | 1180 inline void IncrementSemiSpaceCopiedObjectSize(int object_size) { |
1181 ASSERT(object_size > 0); | 1181 ASSERT(object_size > 0); |
1182 semi_space_copied_object_size_ += object_size; | 1182 semi_space_copied_object_size_ += object_size; |
1183 } | 1183 } |
1184 | 1184 |
| 1185 inline void IncrementNodesDiedInNewSpace() { |
| 1186 nodes_died_in_new_space_++; |
| 1187 } |
| 1188 |
| 1189 inline void IncrementNodesCopiedInNewSpace() { |
| 1190 nodes_copied_in_new_space_++; |
| 1191 } |
| 1192 |
| 1193 inline void IncrementNodesPromoted() { |
| 1194 nodes_promoted_++; |
| 1195 } |
| 1196 |
1185 inline void IncrementYoungSurvivorsCounter(int survived) { | 1197 inline void IncrementYoungSurvivorsCounter(int survived) { |
1186 ASSERT(survived >= 0); | 1198 ASSERT(survived >= 0); |
1187 survived_since_last_expansion_ += survived; | 1199 survived_since_last_expansion_ += survived; |
1188 } | 1200 } |
1189 | 1201 |
1190 inline bool NextGCIsLikelyToBeFull() { | 1202 inline bool NextGCIsLikelyToBeFull() { |
1191 if (FLAG_gc_global) return true; | 1203 if (FLAG_gc_global) return true; |
1192 | 1204 |
1193 if (FLAG_stress_compaction && (gc_count_ & 1) != 0) return true; | 1205 if (FLAG_stress_compaction && (gc_count_ & 1) != 0) return true; |
1194 | 1206 |
(...skipping 824 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2019 static const int kYoungSurvivalRateHighThreshold = 90; | 2031 static const int kYoungSurvivalRateHighThreshold = 90; |
2020 static const int kYoungSurvivalRateAllowedDeviation = 15; | 2032 static const int kYoungSurvivalRateAllowedDeviation = 15; |
2021 | 2033 |
2022 static const int kOldSurvivalRateLowThreshold = 10; | 2034 static const int kOldSurvivalRateLowThreshold = 10; |
2023 | 2035 |
2024 int high_survival_rate_period_length_; | 2036 int high_survival_rate_period_length_; |
2025 intptr_t promoted_objects_size_; | 2037 intptr_t promoted_objects_size_; |
2026 double promotion_rate_; | 2038 double promotion_rate_; |
2027 intptr_t semi_space_copied_object_size_; | 2039 intptr_t semi_space_copied_object_size_; |
2028 double semi_space_copied_rate_; | 2040 double semi_space_copied_rate_; |
| 2041 int nodes_died_in_new_space_; |
| 2042 int nodes_copied_in_new_space_; |
| 2043 int nodes_promoted_; |
2029 | 2044 |
2030 // This is the pretenuring trigger for allocation sites that are in maybe | 2045 // This is the pretenuring trigger for allocation sites that are in maybe |
2031 // tenure state. When we switched to the maximum new space size we deoptimize | 2046 // tenure state. When we switched to the maximum new space size we deoptimize |
2032 // the code that belongs to the allocation site and derive the lifetime | 2047 // the code that belongs to the allocation site and derive the lifetime |
2033 // of the allocation site. | 2048 // of the allocation site. |
2034 unsigned int maximum_size_scavenges_; | 2049 unsigned int maximum_size_scavenges_; |
2035 | 2050 |
2036 // TODO(hpayer): Allocation site pretenuring may make this method obsolete. | 2051 // TODO(hpayer): Allocation site pretenuring may make this method obsolete. |
2037 // Re-visit incremental marking heuristics. | 2052 // Re-visit incremental marking heuristics. |
2038 bool IsHighSurvivalRate() { | 2053 bool IsHighSurvivalRate() { |
(...skipping 523 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2562 | 2577 |
2563 DISALLOW_COPY_AND_ASSIGN(Scope); | 2578 DISALLOW_COPY_AND_ASSIGN(Scope); |
2564 }; | 2579 }; |
2565 | 2580 |
2566 explicit GCTracer(Heap* heap, | 2581 explicit GCTracer(Heap* heap, |
2567 GarbageCollector collector, | 2582 GarbageCollector collector, |
2568 const char* gc_reason, | 2583 const char* gc_reason, |
2569 const char* collector_reason); | 2584 const char* collector_reason); |
2570 ~GCTracer(); | 2585 ~GCTracer(); |
2571 | 2586 |
2572 void increment_nodes_died_in_new_space() { | |
2573 nodes_died_in_new_space_++; | |
2574 } | |
2575 | |
2576 void increment_nodes_copied_in_new_space() { | |
2577 nodes_copied_in_new_space_++; | |
2578 } | |
2579 | |
2580 void increment_nodes_promoted() { | |
2581 nodes_promoted_++; | |
2582 } | |
2583 | |
2584 private: | 2587 private: |
2585 // Returns a string matching the collector. | 2588 // Returns a string matching the collector. |
2586 const char* CollectorString() const; | 2589 const char* CollectorString() const; |
2587 | 2590 |
2588 // Print one detailed trace line in name=value format. | 2591 // Print one detailed trace line in name=value format. |
2589 void PrintNVP() const; | 2592 void PrintNVP() const; |
2590 | 2593 |
2591 // Print one trace line. | 2594 // Print one trace line. |
2592 void Print() const; | 2595 void Print() const; |
2593 | 2596 |
(...skipping 26 matching lines...) Expand all Loading... |
2620 intptr_t in_free_list_or_wasted_before_gc_; | 2623 intptr_t in_free_list_or_wasted_before_gc_; |
2621 | 2624 |
2622 // Difference between space used in the heap at the beginning of the current | 2625 // Difference between space used in the heap at the beginning of the current |
2623 // collection and the end of the previous collection. | 2626 // collection and the end of the previous collection. |
2624 intptr_t allocated_since_last_gc_; | 2627 intptr_t allocated_since_last_gc_; |
2625 | 2628 |
2626 // Amount of time spent in mutator that is time elapsed between end of the | 2629 // Amount of time spent in mutator that is time elapsed between end of the |
2627 // previous collection and the beginning of the current one. | 2630 // previous collection and the beginning of the current one. |
2628 double spent_in_mutator_; | 2631 double spent_in_mutator_; |
2629 | 2632 |
2630 // Number of died nodes in the new space. | |
2631 int nodes_died_in_new_space_; | |
2632 | |
2633 // Number of copied nodes to the new space. | |
2634 int nodes_copied_in_new_space_; | |
2635 | |
2636 // Number of promoted nodes to the old space. | |
2637 int nodes_promoted_; | |
2638 | |
2639 // Incremental marking steps counters. | 2633 // Incremental marking steps counters. |
2640 int steps_count_; | 2634 int steps_count_; |
2641 double steps_took_; | 2635 double steps_took_; |
2642 double longest_step_; | 2636 double longest_step_; |
2643 int steps_count_since_last_gc_; | 2637 int steps_count_since_last_gc_; |
2644 double steps_took_since_last_gc_; | 2638 double steps_took_since_last_gc_; |
2645 | 2639 |
2646 Heap* heap_; | 2640 Heap* heap_; |
2647 | 2641 |
2648 const char* gc_reason_; | 2642 const char* gc_reason_; |
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2787 DisallowHeapAllocation no_allocation; // i.e. no gc allowed. | 2781 DisallowHeapAllocation no_allocation; // i.e. no gc allowed. |
2788 | 2782 |
2789 private: | 2783 private: |
2790 DISALLOW_IMPLICIT_CONSTRUCTORS(PathTracer); | 2784 DISALLOW_IMPLICIT_CONSTRUCTORS(PathTracer); |
2791 }; | 2785 }; |
2792 #endif // DEBUG | 2786 #endif // DEBUG |
2793 | 2787 |
2794 } } // namespace v8::internal | 2788 } } // namespace v8::internal |
2795 | 2789 |
2796 #endif // V8_HEAP_H_ | 2790 #endif // V8_HEAP_H_ |
OLD | NEW |