OLD | NEW |
1 // Copyright 2009 the V8 project authors. All rights reserved. | 1 // Copyright 2009 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
124 | 124 |
125 int Heap::always_allocate_scope_depth_ = 0; | 125 int Heap::always_allocate_scope_depth_ = 0; |
126 int Heap::linear_allocation_scope_depth_ = 0; | 126 int Heap::linear_allocation_scope_depth_ = 0; |
127 int Heap::contexts_disposed_ = 0; | 127 int Heap::contexts_disposed_ = 0; |
128 | 128 |
129 int Heap::young_survivors_after_last_gc_ = 0; | 129 int Heap::young_survivors_after_last_gc_ = 0; |
130 int Heap::high_survival_rate_period_length_ = 0; | 130 int Heap::high_survival_rate_period_length_ = 0; |
131 double Heap::survival_rate_ = 0; | 131 double Heap::survival_rate_ = 0; |
132 Heap::SurvivalRateTrend Heap::previous_survival_rate_trend_ = Heap::STABLE; | 132 Heap::SurvivalRateTrend Heap::previous_survival_rate_trend_ = Heap::STABLE; |
133 Heap::SurvivalRateTrend Heap::survival_rate_trend_ = Heap::STABLE; | 133 Heap::SurvivalRateTrend Heap::survival_rate_trend_ = Heap::STABLE; |
134 bool Heap::bumped_old_gen_limits_ = false; | |
135 | 134 |
136 #ifdef DEBUG | 135 #ifdef DEBUG |
137 bool Heap::allocation_allowed_ = true; | 136 bool Heap::allocation_allowed_ = true; |
138 | 137 |
139 int Heap::allocation_timeout_ = 0; | 138 int Heap::allocation_timeout_ = 0; |
140 bool Heap::disallow_allocation_failure_ = false; | 139 bool Heap::disallow_allocation_failure_ = false; |
141 #endif // DEBUG | 140 #endif // DEBUG |
142 | 141 |
143 int GCTracer::alive_after_last_gc_ = 0; | 142 int GCTracer::alive_after_last_gc_ = 0; |
144 double GCTracer::last_gc_end_timestamp_ = 0.0; | 143 double GCTracer::last_gc_end_timestamp_ = 0.0; |
(...skipping 514 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
659 if (high_survival_rate_during_scavenges && | 658 if (high_survival_rate_during_scavenges && |
660 IsStableOrIncreasingSurvivalTrend()) { | 659 IsStableOrIncreasingSurvivalTrend()) { |
661 // Stable high survival rates of young objects both during partial and | 660 // Stable high survival rates of young objects both during partial and |
662 // full collection indicate that mutator is either building or modifying | 661 // full collection indicate that mutator is either building or modifying |
663 // a structure with a long lifetime. | 662 // a structure with a long lifetime. |
664 // In this case we aggressively raise old generation memory limits to | 663 // In this case we aggressively raise old generation memory limits to |
665 // postpone subsequent mark-sweep collection and thus trade memory | 664 // postpone subsequent mark-sweep collection and thus trade memory |
666 // space for the mutation speed. | 665 // space for the mutation speed. |
667 old_gen_promotion_limit_ *= 2; | 666 old_gen_promotion_limit_ *= 2; |
668 old_gen_allocation_limit_ *= 2; | 667 old_gen_allocation_limit_ *= 2; |
669 bumped_old_gen_limits_ = true; | |
670 } | 668 } |
671 | 669 |
672 old_gen_exhausted_ = false; | 670 old_gen_exhausted_ = false; |
673 } else { | 671 } else { |
674 tracer_ = tracer; | 672 tracer_ = tracer; |
675 Scavenge(); | 673 Scavenge(); |
676 tracer_ = NULL; | 674 tracer_ = NULL; |
677 | 675 |
678 UpdateSurvivalRateTrend(start_new_space_size); | 676 UpdateSurvivalRateTrend(start_new_space_size); |
679 | |
680 if (bumped_old_gen_limits_ && | |
681 !IsHighSurvivalRate() && | |
682 !IsIncreasingSurvivalTrend()) { | |
683 // We previously observed high survival rates in young space and decided | |
684 // to bump old space allocation limits to trade the space for the speed | |
685 // but now survival rates are dropping which indicates that mutator | |
686 // finished updating tenured data structure. So we can decrease old space | |
687 // limits to guarantee an early full GC cycle and reduce memory footprint. | |
688 old_gen_promotion_limit_ /= 2; | |
689 old_gen_allocation_limit_ /= 2; | |
690 bumped_old_gen_limits_ = false; | |
691 } | |
692 } | 677 } |
693 | 678 |
694 Counters::objs_since_last_young.Set(0); | 679 Counters::objs_since_last_young.Set(0); |
695 | 680 |
696 if (collector == MARK_COMPACTOR) { | 681 if (collector == MARK_COMPACTOR) { |
697 DisableAssertNoAllocation allow_allocation; | 682 DisableAssertNoAllocation allow_allocation; |
698 GCTracer::Scope scope(tracer, GCTracer::Scope::EXTERNAL); | 683 GCTracer::Scope scope(tracer, GCTracer::Scope::EXTERNAL); |
699 GlobalHandles::PostGarbageCollectionProcessing(); | 684 GlobalHandles::PostGarbageCollectionProcessing(); |
700 } | 685 } |
701 | 686 |
(...skipping 4133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4835 void ExternalStringTable::TearDown() { | 4820 void ExternalStringTable::TearDown() { |
4836 new_space_strings_.Free(); | 4821 new_space_strings_.Free(); |
4837 old_space_strings_.Free(); | 4822 old_space_strings_.Free(); |
4838 } | 4823 } |
4839 | 4824 |
4840 | 4825 |
4841 List<Object*> ExternalStringTable::new_space_strings_; | 4826 List<Object*> ExternalStringTable::new_space_strings_; |
4842 List<Object*> ExternalStringTable::old_space_strings_; | 4827 List<Object*> ExternalStringTable::old_space_strings_; |
4843 | 4828 |
4844 } } // namespace v8::internal | 4829 } } // namespace v8::internal |
OLD | NEW |