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/v8.h" | 5 #include "src/v8.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/base/bits.h" | 9 #include "src/base/bits.h" |
10 #include "src/base/once.h" | 10 #include "src/base/once.h" |
(...skipping 4515 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4526 if (!IsHeapIterable()) { | 4526 if (!IsHeapIterable()) { |
4527 CollectAllGarbage(kMakeHeapIterableMask, "Heap::MakeHeapIterable"); | 4527 CollectAllGarbage(kMakeHeapIterableMask, "Heap::MakeHeapIterable"); |
4528 } | 4528 } |
4529 if (mark_compact_collector()->sweeping_in_progress()) { | 4529 if (mark_compact_collector()->sweeping_in_progress()) { |
4530 mark_compact_collector()->EnsureSweepingCompleted(); | 4530 mark_compact_collector()->EnsureSweepingCompleted(); |
4531 } | 4531 } |
4532 DCHECK(IsHeapIterable()); | 4532 DCHECK(IsHeapIterable()); |
4533 } | 4533 } |
4534 | 4534 |
4535 | 4535 |
4536 void Heap::IdleMarkCompact(bool reduce_memory, const char* message) { | 4536 void Heap::IdleMarkCompact(const char* message) { |
4537 bool uncommit = false; | 4537 bool uncommit = false; |
4538 if (gc_count_at_last_idle_gc_ == gc_count_) { | 4538 if (gc_count_at_last_idle_gc_ == gc_count_) { |
4539 // No GC since the last full GC, the mutator is probably not active. | 4539 // No GC since the last full GC, the mutator is probably not active. |
4540 isolate_->compilation_cache()->Clear(); | 4540 isolate_->compilation_cache()->Clear(); |
4541 uncommit = true; | 4541 uncommit = true; |
4542 } | 4542 } |
4543 int flags = reduce_memory ? kReduceMemoryFootprintMask : kNoGCFlags; | 4543 CollectAllGarbage(kReduceMemoryFootprintMask, message); |
4544 CollectAllGarbage(flags, message); | |
4545 gc_idle_time_handler_.NotifyIdleMarkCompact(); | 4544 gc_idle_time_handler_.NotifyIdleMarkCompact(); |
4546 gc_count_at_last_idle_gc_ = gc_count_; | 4545 gc_count_at_last_idle_gc_ = gc_count_; |
4547 if (uncommit) { | 4546 if (uncommit) { |
4548 new_space_.Shrink(); | 4547 new_space_.Shrink(); |
4549 UncommitFromSpace(); | 4548 UncommitFromSpace(); |
4550 } | 4549 } |
4551 } | 4550 } |
4552 | 4551 |
4553 | 4552 |
4554 bool Heap::TryFinalizeIdleIncrementalMarking( | 4553 bool Heap::TryFinalizeIdleIncrementalMarking( |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4666 } | 4665 } |
4667 break; | 4666 break; |
4668 } | 4667 } |
4669 case DO_FULL_GC: { | 4668 case DO_FULL_GC: { |
4670 if (contexts_disposed_) { | 4669 if (contexts_disposed_) { |
4671 HistogramTimerScope scope(isolate_->counters()->gc_context()); | 4670 HistogramTimerScope scope(isolate_->counters()->gc_context()); |
4672 CollectAllGarbage(kNoGCFlags, "idle notification: contexts disposed"); | 4671 CollectAllGarbage(kNoGCFlags, "idle notification: contexts disposed"); |
4673 gc_idle_time_handler_.NotifyIdleMarkCompact(); | 4672 gc_idle_time_handler_.NotifyIdleMarkCompact(); |
4674 gc_count_at_last_idle_gc_ = gc_count_; | 4673 gc_count_at_last_idle_gc_ = gc_count_; |
4675 } else { | 4674 } else { |
4676 IdleMarkCompact(false, "idle notification: finalize idle round"); | 4675 IdleMarkCompact("idle notification: finalize idle round"); |
4677 } | 4676 } |
4678 break; | 4677 break; |
4679 } | 4678 } |
4680 case DO_FULL_GC_COMPACT: { | |
4681 IdleMarkCompact(true, "idle notification: reduce memory footprint"); | |
4682 break; | |
4683 } | |
4684 case DO_SCAVENGE: | 4679 case DO_SCAVENGE: |
4685 CollectGarbage(NEW_SPACE, "idle notification: scavenge"); | 4680 CollectGarbage(NEW_SPACE, "idle notification: scavenge"); |
4686 break; | 4681 break; |
4687 case DO_FINALIZE_SWEEPING: | 4682 case DO_FINALIZE_SWEEPING: |
4688 mark_compact_collector()->EnsureSweepingCompleted(); | 4683 mark_compact_collector()->EnsureSweepingCompleted(); |
4689 break; | 4684 break; |
4690 case DO_NOTHING: | 4685 case DO_NOTHING: |
4691 break; | 4686 break; |
4692 } | 4687 } |
4693 | 4688 |
(...skipping 1676 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6370 static_cast<int>(object_sizes_last_time_[index])); | 6365 static_cast<int>(object_sizes_last_time_[index])); |
6371 CODE_AGE_LIST_COMPLETE(ADJUST_LAST_TIME_OBJECT_COUNT) | 6366 CODE_AGE_LIST_COMPLETE(ADJUST_LAST_TIME_OBJECT_COUNT) |
6372 #undef ADJUST_LAST_TIME_OBJECT_COUNT | 6367 #undef ADJUST_LAST_TIME_OBJECT_COUNT |
6373 | 6368 |
6374 MemCopy(object_counts_last_time_, object_counts_, sizeof(object_counts_)); | 6369 MemCopy(object_counts_last_time_, object_counts_, sizeof(object_counts_)); |
6375 MemCopy(object_sizes_last_time_, object_sizes_, sizeof(object_sizes_)); | 6370 MemCopy(object_sizes_last_time_, object_sizes_, sizeof(object_sizes_)); |
6376 ClearObjectStats(); | 6371 ClearObjectStats(); |
6377 } | 6372 } |
6378 } | 6373 } |
6379 } // namespace v8::internal | 6374 } // namespace v8::internal |
OLD | NEW |