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/heap/heap.h" | 5 #include "src/heap/heap.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/ast/context-slot-cache.h" | 9 #include "src/ast/context-slot-cache.h" |
10 #include "src/base/bits.h" | 10 #include "src/base/bits.h" |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
108 ms_count_(0), | 108 ms_count_(0), |
109 gc_count_(0), | 109 gc_count_(0), |
110 remembered_unmapped_pages_index_(0), | 110 remembered_unmapped_pages_index_(0), |
111 #ifdef DEBUG | 111 #ifdef DEBUG |
112 allocation_timeout_(0), | 112 allocation_timeout_(0), |
113 #endif // DEBUG | 113 #endif // DEBUG |
114 old_generation_allocation_limit_(initial_old_generation_size_), | 114 old_generation_allocation_limit_(initial_old_generation_size_), |
115 inline_allocation_disabled_(false), | 115 inline_allocation_disabled_(false), |
116 total_regexp_code_generated_(0), | 116 total_regexp_code_generated_(0), |
117 tracer_(nullptr), | 117 tracer_(nullptr), |
118 high_survival_rate_period_length_(0), | |
119 promoted_objects_size_(0), | 118 promoted_objects_size_(0), |
120 promotion_ratio_(0), | 119 promotion_ratio_(0), |
121 semi_space_copied_object_size_(0), | 120 semi_space_copied_object_size_(0), |
122 previous_semi_space_copied_object_size_(0), | 121 previous_semi_space_copied_object_size_(0), |
123 semi_space_copied_rate_(0), | 122 semi_space_copied_rate_(0), |
124 nodes_died_in_new_space_(0), | 123 nodes_died_in_new_space_(0), |
125 nodes_copied_in_new_space_(0), | 124 nodes_copied_in_new_space_(0), |
126 nodes_promoted_(0), | 125 nodes_promoted_(0), |
127 maximum_size_scavenges_(0), | 126 maximum_size_scavenges_(0), |
128 max_gc_pause_(0.0), | 127 max_gc_pause_(0.0), |
(...skipping 1140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1269 } else { | 1268 } else { |
1270 promotion_rate_ = 0; | 1269 promotion_rate_ = 0; |
1271 } | 1270 } |
1272 | 1271 |
1273 semi_space_copied_rate_ = | 1272 semi_space_copied_rate_ = |
1274 (static_cast<double>(semi_space_copied_object_size_) / | 1273 (static_cast<double>(semi_space_copied_object_size_) / |
1275 static_cast<double>(start_new_space_size) * 100); | 1274 static_cast<double>(start_new_space_size) * 100); |
1276 | 1275 |
1277 double survival_rate = promotion_ratio_ + semi_space_copied_rate_; | 1276 double survival_rate = promotion_ratio_ + semi_space_copied_rate_; |
1278 tracer()->AddSurvivalRatio(survival_rate); | 1277 tracer()->AddSurvivalRatio(survival_rate); |
1279 if (survival_rate > kYoungSurvivalRateHighThreshold) { | |
1280 high_survival_rate_period_length_++; | |
1281 } else { | |
1282 high_survival_rate_period_length_ = 0; | |
1283 } | |
1284 } | 1278 } |
1285 | 1279 |
1286 bool Heap::PerformGarbageCollection( | 1280 bool Heap::PerformGarbageCollection( |
1287 GarbageCollector collector, const v8::GCCallbackFlags gc_callback_flags) { | 1281 GarbageCollector collector, const v8::GCCallbackFlags gc_callback_flags) { |
1288 int freed_global_handles = 0; | 1282 int freed_global_handles = 0; |
1289 | 1283 |
1290 if (collector != SCAVENGER) { | 1284 if (collector != SCAVENGER) { |
1291 PROFILE(isolate_, CodeMovingGCEvent()); | 1285 PROFILE(isolate_, CodeMovingGCEvent()); |
1292 } | 1286 } |
1293 | 1287 |
(...skipping 16 matching lines...) Expand all Loading... |
1310 VMState<EXTERNAL> state(isolate_); | 1304 VMState<EXTERNAL> state(isolate_); |
1311 HandleScope handle_scope(isolate_); | 1305 HandleScope handle_scope(isolate_); |
1312 CallGCPrologueCallbacks(gc_type, kNoGCCallbackFlags); | 1306 CallGCPrologueCallbacks(gc_type, kNoGCCallbackFlags); |
1313 } | 1307 } |
1314 } | 1308 } |
1315 | 1309 |
1316 EnsureFromSpaceIsCommitted(); | 1310 EnsureFromSpaceIsCommitted(); |
1317 | 1311 |
1318 int start_new_space_size = Heap::new_space()->SizeAsInt(); | 1312 int start_new_space_size = Heap::new_space()->SizeAsInt(); |
1319 | 1313 |
1320 if (IsHighSurvivalRate()) { | |
1321 // We speed up the incremental marker if it is running so that it | |
1322 // does not fall behind the rate of promotion, which would cause a | |
1323 // constantly growing old space. | |
1324 incremental_marking()->NotifyOfHighPromotionRate(); | |
1325 } | |
1326 | |
1327 { | 1314 { |
1328 Heap::PretenuringScope pretenuring_scope(this); | 1315 Heap::PretenuringScope pretenuring_scope(this); |
1329 | 1316 |
1330 if (collector == MARK_COMPACTOR) { | 1317 if (collector == MARK_COMPACTOR) { |
1331 UpdateOldGenerationAllocationCounter(); | 1318 UpdateOldGenerationAllocationCounter(); |
1332 // Perform mark-sweep with optional compaction. | 1319 // Perform mark-sweep with optional compaction. |
1333 MarkCompact(); | 1320 MarkCompact(); |
1334 old_generation_size_configured_ = true; | 1321 old_generation_size_configured_ = true; |
1335 // This should be updated before PostGarbageCollectionProcessing, which | 1322 // This should be updated before PostGarbageCollectionProcessing, which |
1336 // can cause another GC. Take into account the objects promoted during GC. | 1323 // can cause another GC. Take into account the objects promoted during GC. |
(...skipping 5219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6556 } | 6543 } |
6557 | 6544 |
6558 | 6545 |
6559 // static | 6546 // static |
6560 int Heap::GetStaticVisitorIdForMap(Map* map) { | 6547 int Heap::GetStaticVisitorIdForMap(Map* map) { |
6561 return StaticVisitorBase::GetVisitorId(map); | 6548 return StaticVisitorBase::GetVisitorId(map); |
6562 } | 6549 } |
6563 | 6550 |
6564 } // namespace internal | 6551 } // namespace internal |
6565 } // namespace v8 | 6552 } // namespace v8 |
OLD | NEW |