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 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
105 gc_post_processing_depth_(0), | 105 gc_post_processing_depth_(0), |
106 allocations_count_(0), | 106 allocations_count_(0), |
107 raw_allocations_hash_(0), | 107 raw_allocations_hash_(0), |
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 old_gen_exhausted_(false), | |
116 inline_allocation_disabled_(false), | 115 inline_allocation_disabled_(false), |
117 total_regexp_code_generated_(0), | 116 total_regexp_code_generated_(0), |
118 tracer_(nullptr), | 117 tracer_(nullptr), |
119 high_survival_rate_period_length_(0), | 118 high_survival_rate_period_length_(0), |
120 promoted_objects_size_(0), | 119 promoted_objects_size_(0), |
121 promotion_ratio_(0), | 120 promotion_ratio_(0), |
122 semi_space_copied_object_size_(0), | 121 semi_space_copied_object_size_(0), |
123 previous_semi_space_copied_object_size_(0), | 122 previous_semi_space_copied_object_size_(0), |
124 semi_space_copied_rate_(0), | 123 semi_space_copied_rate_(0), |
125 nodes_died_in_new_space_(0), | 124 nodes_died_in_new_space_(0), |
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
275 return MARK_COMPACTOR; | 274 return MARK_COMPACTOR; |
276 } | 275 } |
277 | 276 |
278 // Is enough data promoted to justify a global GC? | 277 // Is enough data promoted to justify a global GC? |
279 if (OldGenerationAllocationLimitReached()) { | 278 if (OldGenerationAllocationLimitReached()) { |
280 isolate_->counters()->gc_compactor_caused_by_promoted_data()->Increment(); | 279 isolate_->counters()->gc_compactor_caused_by_promoted_data()->Increment(); |
281 *reason = "promotion limit reached"; | 280 *reason = "promotion limit reached"; |
282 return MARK_COMPACTOR; | 281 return MARK_COMPACTOR; |
283 } | 282 } |
284 | 283 |
285 // Have allocation in OLD and LO failed? | |
286 if (old_gen_exhausted_) { | |
287 isolate_->counters() | |
288 ->gc_compactor_caused_by_oldspace_exhaustion() | |
289 ->Increment(); | |
290 *reason = "old generations exhausted"; | |
291 return MARK_COMPACTOR; | |
292 } | |
293 | |
294 // Is there enough space left in OLD to guarantee that a scavenge can | 284 // Is there enough space left in OLD to guarantee that a scavenge can |
295 // succeed? | 285 // succeed? |
296 // | 286 // |
297 // Note that MemoryAllocator->MaxAvailable() undercounts the memory available | 287 // Note that MemoryAllocator->MaxAvailable() undercounts the memory available |
298 // for object promotion. It counts only the bytes that the memory | 288 // for object promotion. It counts only the bytes that the memory |
299 // allocator has not yet allocated from the OS and assigned to any space, | 289 // allocator has not yet allocated from the OS and assigned to any space, |
300 // and does not count available bytes already in the old space or code | 290 // and does not count available bytes already in the old space or code |
301 // space. Undercounting is safe---we may get an unrequested full GC when | 291 // space. Undercounting is safe---we may get an unrequested full GC when |
302 // a scavenge would have succeeded. | 292 // a scavenge would have succeeded. |
303 if (memory_allocator()->MaxAvailable() <= new_space_->Size()) { | 293 if (memory_allocator()->MaxAvailable() <= new_space_->Size()) { |
(...skipping 1030 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1334 incremental_marking()->NotifyOfHighPromotionRate(); | 1324 incremental_marking()->NotifyOfHighPromotionRate(); |
1335 } | 1325 } |
1336 | 1326 |
1337 { | 1327 { |
1338 Heap::PretenuringScope pretenuring_scope(this); | 1328 Heap::PretenuringScope pretenuring_scope(this); |
1339 | 1329 |
1340 if (collector == MARK_COMPACTOR) { | 1330 if (collector == MARK_COMPACTOR) { |
1341 UpdateOldGenerationAllocationCounter(); | 1331 UpdateOldGenerationAllocationCounter(); |
1342 // Perform mark-sweep with optional compaction. | 1332 // Perform mark-sweep with optional compaction. |
1343 MarkCompact(); | 1333 MarkCompact(); |
1344 old_gen_exhausted_ = false; | |
1345 old_generation_size_configured_ = true; | 1334 old_generation_size_configured_ = true; |
1346 // This should be updated before PostGarbageCollectionProcessing, which | 1335 // This should be updated before PostGarbageCollectionProcessing, which |
1347 // can cause another GC. Take into account the objects promoted during GC. | 1336 // can cause another GC. Take into account the objects promoted during GC. |
1348 old_generation_allocation_counter_ += | 1337 old_generation_allocation_counter_ += |
1349 static_cast<size_t>(promoted_objects_size_); | 1338 static_cast<size_t>(promoted_objects_size_); |
1350 old_generation_size_at_last_gc_ = PromotedSpaceSizeOfObjects(); | 1339 old_generation_size_at_last_gc_ = PromotedSpaceSizeOfObjects(); |
1351 } else { | 1340 } else { |
1352 Scavenge(); | 1341 Scavenge(); |
1353 } | 1342 } |
1354 | 1343 |
(...skipping 5175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6530 } | 6519 } |
6531 | 6520 |
6532 | 6521 |
6533 // static | 6522 // static |
6534 int Heap::GetStaticVisitorIdForMap(Map* map) { | 6523 int Heap::GetStaticVisitorIdForMap(Map* map) { |
6535 return StaticVisitorBase::GetVisitorId(map); | 6524 return StaticVisitorBase::GetVisitorId(map); |
6536 } | 6525 } |
6537 | 6526 |
6538 } // namespace internal | 6527 } // namespace internal |
6539 } // namespace v8 | 6528 } // namespace v8 |
OLD | NEW |