| 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 247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 258 *reason = "GC in old space requested"; | 258 *reason = "GC in old space requested"; |
| 259 return MARK_COMPACTOR; | 259 return MARK_COMPACTOR; |
| 260 } | 260 } |
| 261 | 261 |
| 262 if (FLAG_gc_global || (FLAG_stress_compaction && (gc_count_ & 1) != 0)) { | 262 if (FLAG_gc_global || (FLAG_stress_compaction && (gc_count_ & 1) != 0)) { |
| 263 *reason = "GC in old space forced by flags"; | 263 *reason = "GC in old space forced by flags"; |
| 264 return MARK_COMPACTOR; | 264 return MARK_COMPACTOR; |
| 265 } | 265 } |
| 266 | 266 |
| 267 if (incremental_marking()->NeedsFinalization() && | 267 if (incremental_marking()->NeedsFinalization() && |
| 268 OldGenerationSpaceAvailable() == 0) { | 268 AllocationLimitOvershotByLargeMargin()) { |
| 269 *reason = "Incremental marking needs finalization"; | 269 *reason = "Incremental marking needs finalization"; |
| 270 return MARK_COMPACTOR; | 270 return MARK_COMPACTOR; |
| 271 } | 271 } |
| 272 | 272 |
| 273 // Is there enough space left in OLD to guarantee that a scavenge can | 273 // Is there enough space left in OLD to guarantee that a scavenge can |
| 274 // succeed? | 274 // succeed? |
| 275 // | 275 // |
| 276 // Note that MemoryAllocator->MaxAvailable() undercounts the memory available | 276 // Note that MemoryAllocator->MaxAvailable() undercounts the memory available |
| 277 // for object promotion. It counts only the bytes that the memory | 277 // for object promotion. It counts only the bytes that the memory |
| 278 // allocator has not yet allocated from the OS and assigned to any space, | 278 // allocator has not yet allocated from the OS and assigned to any space, |
| (...skipping 5034 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5313 // major GC. It happens when the old generation allocation limit is reached and | 5313 // major GC. It happens when the old generation allocation limit is reached and |
| 5314 // - either we need to optimize for memory usage, | 5314 // - either we need to optimize for memory usage, |
| 5315 // - or the incremental marking is not in progress and we cannot start it. | 5315 // - or the incremental marking is not in progress and we cannot start it. |
| 5316 bool Heap::ShouldExpandOldGenerationOnSlowAllocation() { | 5316 bool Heap::ShouldExpandOldGenerationOnSlowAllocation() { |
| 5317 if (always_allocate() || OldGenerationSpaceAvailable() > 0) return true; | 5317 if (always_allocate() || OldGenerationSpaceAvailable() > 0) return true; |
| 5318 // We reached the old generation allocation limit. | 5318 // We reached the old generation allocation limit. |
| 5319 | 5319 |
| 5320 if (ShouldOptimizeForMemoryUsage()) return false; | 5320 if (ShouldOptimizeForMemoryUsage()) return false; |
| 5321 | 5321 |
| 5322 if (incremental_marking()->NeedsFinalization()) { | 5322 if (incremental_marking()->NeedsFinalization()) { |
| 5323 return false; | 5323 return !AllocationLimitOvershotByLargeMargin(); |
| 5324 } | 5324 } |
| 5325 | 5325 |
| 5326 if (incremental_marking()->IsStopped() && | 5326 if (incremental_marking()->IsStopped() && |
| 5327 IncrementalMarkingLimitReached() == IncrementalMarkingLimit::kNoLimit) { | 5327 IncrementalMarkingLimitReached() == IncrementalMarkingLimit::kNoLimit) { |
| 5328 // We cannot start incremental marking. | 5328 // We cannot start incremental marking. |
| 5329 return false; | 5329 return false; |
| 5330 } | 5330 } |
| 5331 return true; | 5331 return true; |
| 5332 } | 5332 } |
| 5333 | 5333 |
| (...skipping 1160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6494 } | 6494 } |
| 6495 | 6495 |
| 6496 | 6496 |
| 6497 // static | 6497 // static |
| 6498 int Heap::GetStaticVisitorIdForMap(Map* map) { | 6498 int Heap::GetStaticVisitorIdForMap(Map* map) { |
| 6499 return StaticVisitorBase::GetVisitorId(map); | 6499 return StaticVisitorBase::GetVisitorId(map); |
| 6500 } | 6500 } |
| 6501 | 6501 |
| 6502 } // namespace internal | 6502 } // namespace internal |
| 6503 } // namespace v8 | 6503 } // namespace v8 |
| OLD | NEW |