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 5286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5297 "Dampen: old size: %" PRIuS " KB, old limit: %" PRIuS | 5297 "Dampen: old size: %" PRIuS " KB, old limit: %" PRIuS |
5298 " KB, " | 5298 " KB, " |
5299 "new limit: %" PRIuS " KB (%.1f)\n", | 5299 "new limit: %" PRIuS " KB (%.1f)\n", |
5300 old_gen_size / KB, old_generation_allocation_limit_ / KB, limit / KB, | 5300 old_gen_size / KB, old_generation_allocation_limit_ / KB, limit / KB, |
5301 factor); | 5301 factor); |
5302 } | 5302 } |
5303 old_generation_allocation_limit_ = limit; | 5303 old_generation_allocation_limit_ = limit; |
5304 } | 5304 } |
5305 } | 5305 } |
5306 | 5306 |
| 5307 bool Heap::ShouldOptimizeForLoadTime() { |
| 5308 return isolate()->rail_mode() == PERFORMANCE_LOAD && |
| 5309 PromotedTotalSize() < initial_old_generation_size_ && |
| 5310 MonotonicallyIncreasingTimeInMs() < |
| 5311 isolate()->LoadStartTimeMs() + kMaxLoadTimeMs; |
| 5312 } |
| 5313 |
5307 // This predicate is called when an old generation space cannot allocated from | 5314 // This predicate is called when an old generation space cannot allocated from |
5308 // the free list and is about to add a new page. Returning false will cause a | 5315 // the free list and is about to add a new page. Returning false will cause a |
5309 // major GC. It happens when the old generation allocation limit is reached and | 5316 // major GC. It happens when the old generation allocation limit is reached and |
5310 // - either we need to optimize for memory usage, | 5317 // - either we need to optimize for memory usage, |
5311 // - or the incremental marking is not in progress and we cannot start it. | 5318 // - or the incremental marking is not in progress and we cannot start it. |
5312 bool Heap::ShouldExpandOldGenerationOnSlowAllocation() { | 5319 bool Heap::ShouldExpandOldGenerationOnSlowAllocation() { |
5313 if (always_allocate() || OldGenerationSpaceAvailable() > 0) return true; | 5320 if (always_allocate() || OldGenerationSpaceAvailable() > 0) return true; |
5314 // We reached the old generation allocation limit. | 5321 // We reached the old generation allocation limit. |
5315 | 5322 |
5316 if (ShouldOptimizeForMemoryUsage()) return false; | 5323 if (ShouldOptimizeForMemoryUsage()) return false; |
5317 | 5324 |
| 5325 if (ShouldOptimizeForLoadTime()) return true; |
| 5326 |
5318 if (incremental_marking()->NeedsFinalization()) { | 5327 if (incremental_marking()->NeedsFinalization()) { |
5319 return !AllocationLimitOvershotByLargeMargin(); | 5328 return !AllocationLimitOvershotByLargeMargin(); |
5320 } | 5329 } |
5321 | 5330 |
5322 if (incremental_marking()->IsStopped() && | 5331 if (incremental_marking()->IsStopped() && |
5323 IncrementalMarkingLimitReached() == IncrementalMarkingLimit::kNoLimit) { | 5332 IncrementalMarkingLimitReached() == IncrementalMarkingLimit::kNoLimit) { |
5324 // We cannot start incremental marking. | 5333 // We cannot start incremental marking. |
5325 return false; | 5334 return false; |
5326 } | 5335 } |
5327 return true; | 5336 return true; |
(...skipping 1162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6490 } | 6499 } |
6491 | 6500 |
6492 | 6501 |
6493 // static | 6502 // static |
6494 int Heap::GetStaticVisitorIdForMap(Map* map) { | 6503 int Heap::GetStaticVisitorIdForMap(Map* map) { |
6495 return StaticVisitorBase::GetVisitorId(map); | 6504 return StaticVisitorBase::GetVisitorId(map); |
6496 } | 6505 } |
6497 | 6506 |
6498 } // namespace internal | 6507 } // namespace internal |
6499 } // namespace v8 | 6508 } // namespace v8 |
OLD | NEW |