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 #include "src/v8.h" | 5 #include "src/v8.h" |
6 | 6 |
7 #include "src/accessors.h" | 7 #include "src/accessors.h" |
8 #include "src/api.h" | 8 #include "src/api.h" |
9 #include "src/base/bits.h" | 9 #include "src/base/bits.h" |
10 #include "src/base/once.h" | 10 #include "src/base/once.h" |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
63 initial_semispace_size_(Page::kPageSize), | 63 initial_semispace_size_(Page::kPageSize), |
64 target_semispace_size_(Page::kPageSize), | 64 target_semispace_size_(Page::kPageSize), |
65 max_old_generation_size_(700ul * (kPointerSize / 4) * MB), | 65 max_old_generation_size_(700ul * (kPointerSize / 4) * MB), |
66 max_executable_size_(256ul * (kPointerSize / 4) * MB), | 66 max_executable_size_(256ul * (kPointerSize / 4) * MB), |
67 // Variables set based on semispace_size_ and old_generation_size_ in | 67 // Variables set based on semispace_size_ and old_generation_size_ in |
68 // ConfigureHeap. | 68 // ConfigureHeap. |
69 // Will be 4 * reserved_semispace_size_ to ensure that young | 69 // Will be 4 * reserved_semispace_size_ to ensure that young |
70 // generation can be aligned to its size. | 70 // generation can be aligned to its size. |
71 maximum_committed_(0), | 71 maximum_committed_(0), |
72 survived_since_last_expansion_(0), | 72 survived_since_last_expansion_(0), |
| 73 survived_last_scavenge_(0), |
73 sweep_generation_(0), | 74 sweep_generation_(0), |
74 always_allocate_scope_depth_(0), | 75 always_allocate_scope_depth_(0), |
75 contexts_disposed_(0), | 76 contexts_disposed_(0), |
76 global_ic_age_(0), | 77 global_ic_age_(0), |
77 flush_monomorphic_ics_(false), | 78 flush_monomorphic_ics_(false), |
78 scan_on_scavenge_pages_(0), | 79 scan_on_scavenge_pages_(0), |
79 new_space_(this), | 80 new_space_(this), |
80 old_pointer_space_(NULL), | 81 old_pointer_space_(NULL), |
81 old_data_space_(NULL), | 82 old_data_space_(NULL), |
82 code_space_(NULL), | 83 code_space_(NULL), |
(...skipping 1211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1294 | 1295 |
1295 HeapObjectIterator data_it(heap->old_data_space()); | 1296 HeapObjectIterator data_it(heap->old_data_space()); |
1296 for (HeapObject* object = data_it.Next(); object != NULL; | 1297 for (HeapObject* object = data_it.Next(); object != NULL; |
1297 object = data_it.Next()) | 1298 object = data_it.Next()) |
1298 object->Iterate(&v); | 1299 object->Iterate(&v); |
1299 } | 1300 } |
1300 #endif // VERIFY_HEAP | 1301 #endif // VERIFY_HEAP |
1301 | 1302 |
1302 | 1303 |
1303 void Heap::CheckNewSpaceExpansionCriteria() { | 1304 void Heap::CheckNewSpaceExpansionCriteria() { |
1304 if (new_space_.TotalCapacity() < new_space_.MaximumCapacity() && | 1305 if (FLAG_experimental_new_space_growth_heuristic) { |
1305 survived_since_last_expansion_ > new_space_.TotalCapacity()) { | 1306 if (new_space_.TotalCapacity() < new_space_.MaximumCapacity() && |
1306 // Grow the size of new space if there is room to grow, enough data | 1307 survived_last_scavenge_ * 100 / new_space_.TotalCapacity() >= 10) { |
1307 // has survived scavenge since the last expansion and we are not in | 1308 // Grow the size of new space if there is room to grow, and more than 10% |
1308 // high promotion mode. | 1309 // have survived the last scavenge. |
| 1310 new_space_.Grow(); |
| 1311 survived_since_last_expansion_ = 0; |
| 1312 } |
| 1313 } else if (new_space_.TotalCapacity() < new_space_.MaximumCapacity() && |
| 1314 survived_since_last_expansion_ > new_space_.TotalCapacity()) { |
| 1315 // Grow the size of new space if there is room to grow, and enough data |
| 1316 // has survived scavenge since the last expansion. |
1309 new_space_.Grow(); | 1317 new_space_.Grow(); |
1310 survived_since_last_expansion_ = 0; | 1318 survived_since_last_expansion_ = 0; |
1311 } | 1319 } |
1312 } | 1320 } |
1313 | 1321 |
1314 | 1322 |
1315 static bool IsUnscavengedHeapObject(Heap* heap, Object** p) { | 1323 static bool IsUnscavengedHeapObject(Heap* heap, Object** p) { |
1316 return heap->InNewSpace(*p) && | 1324 return heap->InNewSpace(*p) && |
1317 !HeapObject::cast(*p)->map_word().IsForwardingAddress(); | 1325 !HeapObject::cast(*p)->map_word().IsForwardingAddress(); |
1318 } | 1326 } |
(...skipping 4993 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6312 static_cast<int>(object_sizes_last_time_[index])); | 6320 static_cast<int>(object_sizes_last_time_[index])); |
6313 CODE_AGE_LIST_COMPLETE(ADJUST_LAST_TIME_OBJECT_COUNT) | 6321 CODE_AGE_LIST_COMPLETE(ADJUST_LAST_TIME_OBJECT_COUNT) |
6314 #undef ADJUST_LAST_TIME_OBJECT_COUNT | 6322 #undef ADJUST_LAST_TIME_OBJECT_COUNT |
6315 | 6323 |
6316 MemCopy(object_counts_last_time_, object_counts_, sizeof(object_counts_)); | 6324 MemCopy(object_counts_last_time_, object_counts_, sizeof(object_counts_)); |
6317 MemCopy(object_sizes_last_time_, object_sizes_, sizeof(object_sizes_)); | 6325 MemCopy(object_sizes_last_time_, object_sizes_, sizeof(object_sizes_)); |
6318 ClearObjectStats(); | 6326 ClearObjectStats(); |
6319 } | 6327 } |
6320 } | 6328 } |
6321 } // namespace v8::internal | 6329 } // namespace v8::internal |
OLD | NEW |