| 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/assembler-inl.h" | 9 #include "src/assembler-inl.h" |
| 10 #include "src/ast/context-slot-cache.h" | 10 #include "src/ast/context-slot-cache.h" |
| (...skipping 1338 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1349 // GC. | 1349 // GC. |
| 1350 old_generation_allocation_counter_at_last_gc_ += | 1350 old_generation_allocation_counter_at_last_gc_ += |
| 1351 static_cast<size_t>(promoted_objects_size_); | 1351 static_cast<size_t>(promoted_objects_size_); |
| 1352 old_generation_size_at_last_gc_ = PromotedSpaceSizeOfObjects(); | 1352 old_generation_size_at_last_gc_ = PromotedSpaceSizeOfObjects(); |
| 1353 break; | 1353 break; |
| 1354 case MINOR_MARK_COMPACTOR: | 1354 case MINOR_MARK_COMPACTOR: |
| 1355 MinorMarkCompact(); | 1355 MinorMarkCompact(); |
| 1356 break; | 1356 break; |
| 1357 case SCAVENGER: | 1357 case SCAVENGER: |
| 1358 if ((fast_promotion_mode_ && | 1358 if ((fast_promotion_mode_ && |
| 1359 CanExpandOldGeneration(new_space()->Size())) || | 1359 CanExpandOldGeneration(new_space()->Size()))) { |
| 1360 concurrent_marking_->IsTaskPending()) { | |
| 1361 tracer()->NotifyYoungGenerationHandling( | 1360 tracer()->NotifyYoungGenerationHandling( |
| 1362 YoungGenerationHandling::kFastPromotionDuringScavenge); | 1361 YoungGenerationHandling::kFastPromotionDuringScavenge); |
| 1363 EvacuateYoungGeneration(); | 1362 EvacuateYoungGeneration(); |
| 1364 } else { | 1363 } else { |
| 1365 tracer()->NotifyYoungGenerationHandling( | 1364 tracer()->NotifyYoungGenerationHandling( |
| 1366 YoungGenerationHandling::kRegularScavenge); | 1365 YoungGenerationHandling::kRegularScavenge); |
| 1367 | 1366 |
| 1368 Scavenge(); | 1367 Scavenge(); |
| 1369 } | 1368 } |
| 1370 break; | 1369 break; |
| (...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1626 } | 1625 } |
| 1627 return NULL; | 1626 return NULL; |
| 1628 } | 1627 } |
| 1629 | 1628 |
| 1630 private: | 1629 private: |
| 1631 Heap* heap_; | 1630 Heap* heap_; |
| 1632 }; | 1631 }; |
| 1633 | 1632 |
| 1634 void Heap::EvacuateYoungGeneration() { | 1633 void Heap::EvacuateYoungGeneration() { |
| 1635 TRACE_GC(tracer(), GCTracer::Scope::SCAVENGER_EVACUATE); | 1634 TRACE_GC(tracer(), GCTracer::Scope::SCAVENGER_EVACUATE); |
| 1635 base::LockGuard<base::Mutex> guard(relocation_mutex()); |
| 1636 if (!FLAG_concurrent_marking) { | 1636 if (!FLAG_concurrent_marking) { |
| 1637 DCHECK(fast_promotion_mode_); | 1637 DCHECK(fast_promotion_mode_); |
| 1638 DCHECK(CanExpandOldGeneration(new_space()->Size())); | 1638 DCHECK(CanExpandOldGeneration(new_space()->Size())); |
| 1639 } | 1639 } |
| 1640 | 1640 |
| 1641 mark_compact_collector()->sweeper().EnsureNewSpaceCompleted(); | 1641 mark_compact_collector()->sweeper().EnsureNewSpaceCompleted(); |
| 1642 | 1642 |
| 1643 SetGCState(SCAVENGE); | 1643 SetGCState(SCAVENGE); |
| 1644 LOG(isolate_, ResourceEvent("scavenge", "begin")); | 1644 LOG(isolate_, ResourceEvent("scavenge", "begin")); |
| 1645 | 1645 |
| (...skipping 21 matching lines...) Expand all Loading... |
| 1667 IncrementYoungSurvivorsCounter(new_space()->Size()); | 1667 IncrementYoungSurvivorsCounter(new_space()->Size()); |
| 1668 IncrementPromotedObjectsSize(new_space()->Size()); | 1668 IncrementPromotedObjectsSize(new_space()->Size()); |
| 1669 IncrementSemiSpaceCopiedObjectSize(0); | 1669 IncrementSemiSpaceCopiedObjectSize(0); |
| 1670 | 1670 |
| 1671 LOG(isolate_, ResourceEvent("scavenge", "end")); | 1671 LOG(isolate_, ResourceEvent("scavenge", "end")); |
| 1672 SetGCState(NOT_IN_GC); | 1672 SetGCState(NOT_IN_GC); |
| 1673 } | 1673 } |
| 1674 | 1674 |
| 1675 void Heap::Scavenge() { | 1675 void Heap::Scavenge() { |
| 1676 TRACE_GC(tracer(), GCTracer::Scope::SCAVENGER_SCAVENGE); | 1676 TRACE_GC(tracer(), GCTracer::Scope::SCAVENGER_SCAVENGE); |
| 1677 RelocationLock relocation_lock(this); | 1677 base::LockGuard<base::Mutex> guard(relocation_mutex()); |
| 1678 // There are soft limits in the allocation code, designed to trigger a mark | 1678 // There are soft limits in the allocation code, designed to trigger a mark |
| 1679 // sweep collection by failing allocations. There is no sense in trying to | 1679 // sweep collection by failing allocations. There is no sense in trying to |
| 1680 // trigger one during scavenge: scavenges allocation should always succeed. | 1680 // trigger one during scavenge: scavenges allocation should always succeed. |
| 1681 AlwaysAllocateScope scope(isolate()); | 1681 AlwaysAllocateScope scope(isolate()); |
| 1682 | 1682 |
| 1683 // Bump-pointer allocations done during scavenge are not real allocations. | 1683 // Bump-pointer allocations done during scavenge are not real allocations. |
| 1684 // Pause the inline allocation steps. | 1684 // Pause the inline allocation steps. |
| 1685 PauseAllocationObserversScope pause_observers(this); | 1685 PauseAllocationObserversScope pause_observers(this); |
| 1686 | 1686 |
| 1687 IncrementalMarking::PauseBlackAllocationScope pause_black_allocation( | 1687 IncrementalMarking::PauseBlackAllocationScope pause_black_allocation( |
| (...skipping 4702 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6390 case LO_SPACE: | 6390 case LO_SPACE: |
| 6391 return "LO_SPACE"; | 6391 return "LO_SPACE"; |
| 6392 default: | 6392 default: |
| 6393 UNREACHABLE(); | 6393 UNREACHABLE(); |
| 6394 } | 6394 } |
| 6395 return NULL; | 6395 return NULL; |
| 6396 } | 6396 } |
| 6397 | 6397 |
| 6398 } // namespace internal | 6398 } // namespace internal |
| 6399 } // namespace v8 | 6399 } // namespace v8 |
| OLD | NEW |