OLD | NEW |
---|---|
1 // Copyright 2010 the V8 project authors. All rights reserved. | 1 // Copyright 2010 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 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
126 | 126 |
127 // Will be 4 * reserved_semispace_size_ to ensure that young | 127 // Will be 4 * reserved_semispace_size_ to ensure that young |
128 // generation can be aligned to its size. | 128 // generation can be aligned to its size. |
129 int Heap::survived_since_last_expansion_ = 0; | 129 int Heap::survived_since_last_expansion_ = 0; |
130 intptr_t Heap::external_allocation_limit_ = 0; | 130 intptr_t Heap::external_allocation_limit_ = 0; |
131 | 131 |
132 Heap::HeapState Heap::gc_state_ = NOT_IN_GC; | 132 Heap::HeapState Heap::gc_state_ = NOT_IN_GC; |
133 | 133 |
134 int Heap::mc_count_ = 0; | 134 int Heap::mc_count_ = 0; |
135 int Heap::ms_count_ = 0; | 135 int Heap::ms_count_ = 0; |
136 int Heap::gc_count_ = 0; | 136 unsigned int Heap::gc_count_ = 0; |
137 | 137 |
138 GCTracer* Heap::tracer_ = NULL; | 138 GCTracer* Heap::tracer_ = NULL; |
139 | 139 |
140 int Heap::unflattened_strings_length_ = 0; | 140 int Heap::unflattened_strings_length_ = 0; |
141 | 141 |
142 int Heap::always_allocate_scope_depth_ = 0; | 142 int Heap::always_allocate_scope_depth_ = 0; |
143 int Heap::linear_allocation_scope_depth_ = 0; | 143 int Heap::linear_allocation_scope_depth_ = 0; |
144 int Heap::contexts_disposed_ = 0; | 144 int Heap::contexts_disposed_ = 0; |
145 | 145 |
146 int Heap::young_survivors_after_last_gc_ = 0; | 146 int Heap::young_survivors_after_last_gc_ = 0; |
(...skipping 3604 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3751 Struct::cast(result)->InitializeBody(size); | 3751 Struct::cast(result)->InitializeBody(size); |
3752 return result; | 3752 return result; |
3753 } | 3753 } |
3754 | 3754 |
3755 | 3755 |
3756 bool Heap::IdleNotification() { | 3756 bool Heap::IdleNotification() { |
3757 static const int kIdlesBeforeScavenge = 4; | 3757 static const int kIdlesBeforeScavenge = 4; |
3758 static const int kIdlesBeforeMarkSweep = 7; | 3758 static const int kIdlesBeforeMarkSweep = 7; |
3759 static const int kIdlesBeforeMarkCompact = 8; | 3759 static const int kIdlesBeforeMarkCompact = 8; |
3760 static const int kMaxIdleCount = kIdlesBeforeMarkCompact + 1; | 3760 static const int kMaxIdleCount = kIdlesBeforeMarkCompact + 1; |
3761 static const int kGCsBetweenCleanup = 4; | 3761 static const unsigned int kGCsBetweenCleanup = 4; |
3762 static int number_idle_notifications = 0; | 3762 static int number_idle_notifications = 0; |
3763 static int last_gc_count = gc_count_; | 3763 static unsigned int last_gc_count = gc_count_; |
Vyacheslav Egorov (Chromium)
2011/02/21 15:35:14
There is a bug here: last_gc_count will be initial
| |
3764 | 3764 |
3765 bool uncommit = true; | 3765 bool uncommit = true; |
3766 bool finished = false; | 3766 bool finished = false; |
3767 | 3767 |
3768 // Reset the number of idle notifications received when a number of | 3768 // Reset the number of idle notifications received when a number of |
3769 // GCs have taken place. This allows another round of cleanup based | 3769 // GCs have taken place. This allows another round of cleanup based |
3770 // on idle notifications if enough work has been carried out to | 3770 // on idle notifications if enough work has been carried out to |
3771 // provoke a number of garbage collections. | 3771 // provoke a number of garbage collections. |
3772 if (gc_count_ < last_gc_count + kGCsBetweenCleanup) { | 3772 if (gc_count_ - last_gc_count < kGCsBetweenCleanup) { |
3773 number_idle_notifications = | 3773 number_idle_notifications = |
3774 Min(number_idle_notifications + 1, kMaxIdleCount); | 3774 Min(number_idle_notifications + 1, kMaxIdleCount); |
3775 } else { | 3775 } else { |
3776 number_idle_notifications = 0; | 3776 number_idle_notifications = 0; |
3777 last_gc_count = gc_count_; | 3777 last_gc_count = gc_count_; |
3778 } | 3778 } |
3779 | 3779 |
3780 if (number_idle_notifications == kIdlesBeforeScavenge) { | 3780 if (number_idle_notifications == kIdlesBeforeScavenge) { |
3781 if (contexts_disposed_ > 0) { | 3781 if (contexts_disposed_ > 0) { |
3782 HistogramTimerScope scope(&Counters::gc_context); | 3782 HistogramTimerScope scope(&Counters::gc_context); |
(...skipping 1665 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
5448 void ExternalStringTable::TearDown() { | 5448 void ExternalStringTable::TearDown() { |
5449 new_space_strings_.Free(); | 5449 new_space_strings_.Free(); |
5450 old_space_strings_.Free(); | 5450 old_space_strings_.Free(); |
5451 } | 5451 } |
5452 | 5452 |
5453 | 5453 |
5454 List<Object*> ExternalStringTable::new_space_strings_; | 5454 List<Object*> ExternalStringTable::new_space_strings_; |
5455 List<Object*> ExternalStringTable::old_space_strings_; | 5455 List<Object*> ExternalStringTable::old_space_strings_; |
5456 | 5456 |
5457 } } // namespace v8::internal | 5457 } } // namespace v8::internal |
OLD | NEW |