Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2530)

Side by Side Diff: src/heap/heap.cc

Issue 1214813004: Version 4.5.95.1 (cherry-pick) (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@4.5.95
Patch Set: Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/heap/heap.h ('k') | src/heap/memory-reducer.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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"
11 #include "src/base/utils/random-number-generator.h" 11 #include "src/base/utils/random-number-generator.h"
12 #include "src/bootstrapper.h" 12 #include "src/bootstrapper.h"
13 #include "src/codegen.h" 13 #include "src/codegen.h"
14 #include "src/compilation-cache.h" 14 #include "src/compilation-cache.h"
15 #include "src/conversions.h" 15 #include "src/conversions.h"
16 #include "src/cpu-profiler.h" 16 #include "src/cpu-profiler.h"
17 #include "src/debug.h" 17 #include "src/debug.h"
18 #include "src/deoptimizer.h" 18 #include "src/deoptimizer.h"
19 #include "src/global-handles.h" 19 #include "src/global-handles.h"
20 #include "src/heap/gc-idle-time-handler.h" 20 #include "src/heap/gc-idle-time-handler.h"
21 #include "src/heap/incremental-marking.h" 21 #include "src/heap/incremental-marking.h"
22 #include "src/heap/mark-compact.h" 22 #include "src/heap/mark-compact.h"
23 #include "src/heap/memory-reducer.h"
24 #include "src/heap/objects-visiting-inl.h" 23 #include "src/heap/objects-visiting-inl.h"
25 #include "src/heap/objects-visiting.h" 24 #include "src/heap/objects-visiting.h"
26 #include "src/heap/store-buffer.h" 25 #include "src/heap/store-buffer.h"
27 #include "src/heap-profiler.h" 26 #include "src/heap-profiler.h"
28 #include "src/runtime-profiler.h" 27 #include "src/runtime-profiler.h"
29 #include "src/scopeinfo.h" 28 #include "src/scopeinfo.h"
30 #include "src/snapshot/natives.h" 29 #include "src/snapshot/natives.h"
31 #include "src/snapshot/serialize.h" 30 #include "src/snapshot/serialize.h"
32 #include "src/snapshot/snapshot.h" 31 #include "src/snapshot/snapshot.h"
33 #include "src/utils.h" 32 #include "src/utils.h"
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
101 raw_allocations_hash_(0), 100 raw_allocations_hash_(0),
102 dump_allocations_hash_countdown_(FLAG_dump_allocations_digest_at_alloc), 101 dump_allocations_hash_countdown_(FLAG_dump_allocations_digest_at_alloc),
103 ms_count_(0), 102 ms_count_(0),
104 gc_count_(0), 103 gc_count_(0),
105 remembered_unmapped_pages_index_(0), 104 remembered_unmapped_pages_index_(0),
106 unflattened_strings_length_(0), 105 unflattened_strings_length_(0),
107 #ifdef DEBUG 106 #ifdef DEBUG
108 allocation_timeout_(0), 107 allocation_timeout_(0),
109 #endif // DEBUG 108 #endif // DEBUG
110 old_generation_allocation_limit_(initial_old_generation_size_), 109 old_generation_allocation_limit_(initial_old_generation_size_),
110 idle_old_generation_allocation_limit_(
111 kMinimumOldGenerationAllocationLimit),
111 old_gen_exhausted_(false), 112 old_gen_exhausted_(false),
112 inline_allocation_disabled_(false), 113 inline_allocation_disabled_(false),
113 store_buffer_rebuilder_(store_buffer()), 114 store_buffer_rebuilder_(store_buffer()),
114 hidden_string_(NULL), 115 hidden_string_(NULL),
115 gc_safe_size_of_old_object_(NULL), 116 gc_safe_size_of_old_object_(NULL),
116 total_regexp_code_generated_(0), 117 total_regexp_code_generated_(0),
117 tracer_(this), 118 tracer_(this),
118 new_space_high_promotion_mode_active_(false), 119 new_space_high_promotion_mode_active_(false),
119 gathering_lifetime_feedback_(0), 120 gathering_lifetime_feedback_(0),
120 high_survival_rate_period_length_(0), 121 high_survival_rate_period_length_(0),
(...skipping 15 matching lines...) Expand all
136 max_alive_after_gc_(0), 137 max_alive_after_gc_(0),
137 min_in_mutator_(kMaxInt), 138 min_in_mutator_(kMaxInt),
138 marking_time_(0.0), 139 marking_time_(0.0),
139 sweeping_time_(0.0), 140 sweeping_time_(0.0),
140 last_idle_notification_time_(0.0), 141 last_idle_notification_time_(0.0),
141 last_gc_time_(0.0), 142 last_gc_time_(0.0),
142 mark_compact_collector_(this), 143 mark_compact_collector_(this),
143 store_buffer_(this), 144 store_buffer_(this),
144 marking_(this), 145 marking_(this),
145 incremental_marking_(this), 146 incremental_marking_(this),
146 memory_reducer_(this),
147 full_codegen_bytes_generated_(0), 147 full_codegen_bytes_generated_(0),
148 crankshaft_codegen_bytes_generated_(0), 148 crankshaft_codegen_bytes_generated_(0),
149 new_space_allocation_counter_(0), 149 new_space_allocation_counter_(0),
150 old_generation_allocation_counter_(0), 150 old_generation_allocation_counter_(0),
151 old_generation_size_at_last_gc_(0), 151 old_generation_size_at_last_gc_(0),
152 gcs_since_last_deopt_(0), 152 gcs_since_last_deopt_(0),
153 allocation_sites_scratchpad_length_(0), 153 allocation_sites_scratchpad_length_(0),
154 ring_buffer_full_(false), 154 ring_buffer_full_(false),
155 ring_buffer_end_(0), 155 ring_buffer_end_(0),
156 promotion_queue_(this), 156 promotion_queue_(this),
(...skipping 763 matching lines...) Expand 10 before | Expand all | Expand 10 after
920 !mark_compact_collector_.marking_deque_.IsEmpty() && !FLAG_gc_global) { 920 !mark_compact_collector_.marking_deque_.IsEmpty() && !FLAG_gc_global) {
921 if (FLAG_trace_incremental_marking) { 921 if (FLAG_trace_incremental_marking) {
922 PrintF("[IncrementalMarking] Delaying MarkSweep.\n"); 922 PrintF("[IncrementalMarking] Delaying MarkSweep.\n");
923 } 923 }
924 collector = SCAVENGER; 924 collector = SCAVENGER;
925 collector_reason = "incremental marking delaying mark-sweep"; 925 collector_reason = "incremental marking delaying mark-sweep";
926 } 926 }
927 } 927 }
928 928
929 bool next_gc_likely_to_collect_more = false; 929 bool next_gc_likely_to_collect_more = false;
930 intptr_t committed_memory_before = 0;
931
932 if (collector == MARK_COMPACTOR) {
933 committed_memory_before = CommittedOldGenerationMemory();
934 }
935 930
936 { 931 {
937 tracer()->Start(collector, gc_reason, collector_reason); 932 tracer()->Start(collector, gc_reason, collector_reason);
938 DCHECK(AllowHeapAllocation::IsAllowed()); 933 DCHECK(AllowHeapAllocation::IsAllowed());
939 DisallowHeapAllocation no_allocation_during_gc; 934 DisallowHeapAllocation no_allocation_during_gc;
940 GarbageCollectionPrologue(); 935 GarbageCollectionPrologue();
941 936
942 { 937 {
943 HistogramTimerScope histogram_timer_scope( 938 HistogramTimerScope histogram_timer_scope(
944 (collector == SCAVENGER) ? isolate_->counters()->gc_scavenger() 939 (collector == SCAVENGER) ? isolate_->counters()->gc_scavenger()
945 : isolate_->counters()->gc_compactor()); 940 : isolate_->counters()->gc_compactor());
946 next_gc_likely_to_collect_more = 941 next_gc_likely_to_collect_more =
947 PerformGarbageCollection(collector, gc_callback_flags); 942 PerformGarbageCollection(collector, gc_callback_flags);
948 } 943 }
949 944
950 GarbageCollectionEpilogue(); 945 GarbageCollectionEpilogue();
951 if (collector == MARK_COMPACTOR && FLAG_track_detached_contexts) { 946 if (collector == MARK_COMPACTOR && FLAG_track_detached_contexts) {
952 isolate()->CheckDetachedContextsAfterGC(); 947 isolate()->CheckDetachedContextsAfterGC();
953 } 948 }
954 949
955 if (collector == MARK_COMPACTOR) { 950 if (collector == MARK_COMPACTOR) {
956 intptr_t committed_memory_after = CommittedOldGenerationMemory(); 951 gc_idle_time_handler_.NotifyMarkCompact(next_gc_likely_to_collect_more);
957 intptr_t used_memory_after = PromotedSpaceSizeOfObjects(); 952 } else {
958 MemoryReducer::Event event; 953 gc_idle_time_handler_.NotifyScavenge();
959 event.type = MemoryReducer::kMarkCompact;
960 event.time_ms = MonotonicallyIncreasingTimeInMs();
961 // Trigger one more GC if
962 // - this GC decreased committed memory,
963 // - there is high fragmentation,
964 // - there are live detached contexts.
965 event.next_gc_likely_to_collect_more =
966 (committed_memory_before - committed_memory_after) > MB ||
967 HasHighFragmentation(used_memory_after, committed_memory_after) ||
968 (detached_contexts()->length() > 0);
969 memory_reducer_.NotifyMarkCompact(event);
970 } 954 }
971 955
972 tracer()->Stop(collector); 956 tracer()->Stop(collector);
973 } 957 }
974 958
975 if (collector == MARK_COMPACTOR && 959 if (collector == MARK_COMPACTOR &&
976 (gc_callback_flags & kGCCallbackFlagForced) != 0) { 960 (gc_callback_flags & kGCCallbackFlagForced) != 0) {
977 isolate()->CountUsage(v8::Isolate::kForcedGC); 961 isolate()->CountUsage(v8::Isolate::kForcedGC);
978 } 962 }
979 963
(...skipping 14 matching lines...) Expand all
994 tracer()->ResetSurvivalEvents(); 978 tracer()->ResetSurvivalEvents();
995 old_generation_size_configured_ = false; 979 old_generation_size_configured_ = false;
996 } 980 }
997 if (isolate()->concurrent_recompilation_enabled()) { 981 if (isolate()->concurrent_recompilation_enabled()) {
998 // Flush the queued recompilation tasks. 982 // Flush the queued recompilation tasks.
999 isolate()->optimizing_compile_dispatcher()->Flush(); 983 isolate()->optimizing_compile_dispatcher()->Flush();
1000 } 984 }
1001 AgeInlineCaches(); 985 AgeInlineCaches();
1002 set_retained_maps(ArrayList::cast(empty_fixed_array())); 986 set_retained_maps(ArrayList::cast(empty_fixed_array()));
1003 tracer()->AddContextDisposalTime(base::OS::TimeCurrentMillis()); 987 tracer()->AddContextDisposalTime(base::OS::TimeCurrentMillis());
1004 MemoryReducer::Event event;
1005 event.type = MemoryReducer::kContextDisposed;
1006 event.time_ms = MonotonicallyIncreasingTimeInMs();
1007 memory_reducer_.NotifyContextDisposed(event);
1008 return ++contexts_disposed_; 988 return ++contexts_disposed_;
1009 } 989 }
1010 990
1011 991
1012 void Heap::StartIdleIncrementalMarking() {
1013 gc_idle_time_handler_.ResetNoProgressCounter();
1014 incremental_marking()->Start(kReduceMemoryFootprintMask);
1015 }
1016
1017
1018 void Heap::MoveElements(FixedArray* array, int dst_index, int src_index, 992 void Heap::MoveElements(FixedArray* array, int dst_index, int src_index,
1019 int len) { 993 int len) {
1020 if (len == 0) return; 994 if (len == 0) return;
1021 995
1022 DCHECK(array->map() != fixed_cow_array_map()); 996 DCHECK(array->map() != fixed_cow_array_map());
1023 Object** dst_objects = array->data_start() + dst_index; 997 Object** dst_objects = array->data_start() + dst_index;
1024 MemMove(dst_objects, array->data_start() + src_index, len * kPointerSize); 998 MemMove(dst_objects, array->data_start() + src_index, len * kPointerSize);
1025 if (!InNewSpace(array)) { 999 if (!InNewSpace(array)) {
1026 for (int i = 0; i < len; i++) { 1000 for (int i = 0; i < len; i++) {
1027 // TODO(hpayer): check store buffer for entries 1001 // TODO(hpayer): check store buffer for entries
(...skipping 3750 matching lines...) Expand 10 before | Expand all | Expand 10 after
4778 return mutator_utilization > high_mutator_utilization; 4752 return mutator_utilization > high_mutator_utilization;
4779 } 4753 }
4780 4754
4781 4755
4782 bool Heap::HasLowAllocationRate() { 4756 bool Heap::HasLowAllocationRate() {
4783 return HasLowYoungGenerationAllocationRate() && 4757 return HasLowYoungGenerationAllocationRate() &&
4784 HasLowOldGenerationAllocationRate(); 4758 HasLowOldGenerationAllocationRate();
4785 } 4759 }
4786 4760
4787 4761
4788 bool Heap::HasHighFragmentation() {
4789 intptr_t used = PromotedSpaceSizeOfObjects();
4790 intptr_t committed = CommittedOldGenerationMemory();
4791 return HasHighFragmentation(used, committed);
4792 }
4793
4794
4795 bool Heap::HasHighFragmentation(intptr_t used, intptr_t committed) {
4796 const intptr_t kSlack = 16 * MB;
4797 // Fragmentation is high if committed > 2 * used + kSlack.
4798 // Rewrite the exression to avoid overflow.
4799 return committed - used > used + kSlack;
4800 }
4801
4802
4803 void Heap::ReduceNewSpaceSize() { 4762 void Heap::ReduceNewSpaceSize() {
4804 if (!FLAG_predictable && HasLowAllocationRate()) { 4763 if (!FLAG_predictable && HasLowAllocationRate()) {
4805 new_space_.Shrink(); 4764 new_space_.Shrink();
4806 UncommitFromSpace(); 4765 UncommitFromSpace();
4807 } 4766 }
4808 } 4767 }
4809 4768
4810 4769
4811 bool Heap::TryFinalizeIdleIncrementalMarking( 4770 bool Heap::TryFinalizeIdleIncrementalMarking(
4812 double idle_time_in_ms, size_t size_of_objects, 4771 double idle_time_in_ms, size_t size_of_objects,
4813 size_t final_incremental_mark_compact_speed_in_bytes_per_ms) { 4772 size_t final_incremental_mark_compact_speed_in_bytes_per_ms) {
4814 if (FLAG_overapproximate_weak_closure && 4773 if (FLAG_overapproximate_weak_closure &&
4815 (incremental_marking()->IsReadyToOverApproximateWeakClosure() || 4774 (incremental_marking()->IsReadyToOverApproximateWeakClosure() ||
4816 (!incremental_marking()->weak_closure_was_overapproximated() && 4775 (!incremental_marking()->weak_closure_was_overapproximated() &&
4817 mark_compact_collector_.marking_deque()->IsEmpty() && 4776 mark_compact_collector_.marking_deque()->IsEmpty() &&
4818 gc_idle_time_handler_.ShouldDoOverApproximateWeakClosure( 4777 gc_idle_time_handler_.ShouldDoOverApproximateWeakClosure(
4819 static_cast<size_t>(idle_time_in_ms))))) { 4778 static_cast<size_t>(idle_time_in_ms))))) {
4820 OverApproximateWeakClosure( 4779 OverApproximateWeakClosure(
4821 "Idle notification: overapproximate weak closure"); 4780 "Idle notification: overapproximate weak closure");
4822 return true; 4781 return true;
4823 } else if (incremental_marking()->IsComplete() || 4782 } else if (incremental_marking()->IsComplete() ||
4824 (mark_compact_collector_.marking_deque()->IsEmpty() && 4783 (mark_compact_collector_.marking_deque()->IsEmpty() &&
4825 gc_idle_time_handler_.ShouldDoFinalIncrementalMarkCompact( 4784 gc_idle_time_handler_.ShouldDoFinalIncrementalMarkCompact(
4826 static_cast<size_t>(idle_time_in_ms), size_of_objects, 4785 static_cast<size_t>(idle_time_in_ms), size_of_objects,
4827 final_incremental_mark_compact_speed_in_bytes_per_ms))) { 4786 final_incremental_mark_compact_speed_in_bytes_per_ms))) {
4828 CollectAllGarbage(kNoGCFlags, "idle notification: finalize incremental"); 4787 CollectAllGarbage(kNoGCFlags, "idle notification: finalize incremental");
4788 gc_idle_time_handler_.NotifyIdleMarkCompact();
4829 return true; 4789 return true;
4830 } 4790 }
4831 return false; 4791 return false;
4832 } 4792 }
4833 4793
4834 4794
4835 GCIdleTimeHandler::HeapState Heap::ComputeHeapState() { 4795 GCIdleTimeHandler::HeapState Heap::ComputeHeapState() {
4836 GCIdleTimeHandler::HeapState heap_state; 4796 GCIdleTimeHandler::HeapState heap_state;
4837 heap_state.contexts_disposed = contexts_disposed_; 4797 heap_state.contexts_disposed = contexts_disposed_;
4838 heap_state.contexts_disposal_rate = 4798 heap_state.contexts_disposal_rate =
(...skipping 10 matching lines...) Expand all
4849 tracer()->IncrementalMarkingSpeedInBytesPerMillisecond()); 4809 tracer()->IncrementalMarkingSpeedInBytesPerMillisecond());
4850 heap_state.final_incremental_mark_compact_speed_in_bytes_per_ms = 4810 heap_state.final_incremental_mark_compact_speed_in_bytes_per_ms =
4851 static_cast<size_t>( 4811 static_cast<size_t>(
4852 tracer()->FinalIncrementalMarkCompactSpeedInBytesPerMillisecond()); 4812 tracer()->FinalIncrementalMarkCompactSpeedInBytesPerMillisecond());
4853 heap_state.scavenge_speed_in_bytes_per_ms = 4813 heap_state.scavenge_speed_in_bytes_per_ms =
4854 static_cast<size_t>(tracer()->ScavengeSpeedInBytesPerMillisecond()); 4814 static_cast<size_t>(tracer()->ScavengeSpeedInBytesPerMillisecond());
4855 heap_state.used_new_space_size = new_space_.Size(); 4815 heap_state.used_new_space_size = new_space_.Size();
4856 heap_state.new_space_capacity = new_space_.Capacity(); 4816 heap_state.new_space_capacity = new_space_.Capacity();
4857 heap_state.new_space_allocation_throughput_in_bytes_per_ms = 4817 heap_state.new_space_allocation_throughput_in_bytes_per_ms =
4858 tracer()->NewSpaceAllocationThroughputInBytesPerMillisecond(); 4818 tracer()->NewSpaceAllocationThroughputInBytesPerMillisecond();
4819 heap_state.has_low_allocation_rate = HasLowAllocationRate();
4820 intptr_t limit = old_generation_allocation_limit_;
4821 if (heap_state.has_low_allocation_rate) {
4822 limit = idle_old_generation_allocation_limit_;
4823 }
4824 heap_state.can_start_incremental_marking =
4825 incremental_marking()->CanBeActivated() &&
4826 HeapIsFullEnoughToStartIncrementalMarking(limit) &&
4827 !mark_compact_collector()->sweeping_in_progress();
4859 return heap_state; 4828 return heap_state;
4860 } 4829 }
4861 4830
4862 4831
4863 bool Heap::PerformIdleTimeAction(GCIdleTimeAction action, 4832 bool Heap::PerformIdleTimeAction(GCIdleTimeAction action,
4864 GCIdleTimeHandler::HeapState heap_state, 4833 GCIdleTimeHandler::HeapState heap_state,
4865 double deadline_in_ms) { 4834 double deadline_in_ms) {
4866 bool result = false; 4835 bool result = false;
4867 switch (action.type) { 4836 switch (action.type) {
4868 case DONE: 4837 case DONE:
4869 result = true; 4838 result = true;
4870 break; 4839 break;
4871 case DO_INCREMENTAL_MARKING: { 4840 case DO_INCREMENTAL_MARKING: {
4872 DCHECK(!incremental_marking()->IsStopped()); 4841 if (incremental_marking()->IsStopped()) {
4842 incremental_marking()->Start(
4843 action.reduce_memory ? kReduceMemoryFootprintMask : kNoGCFlags);
4844 }
4873 double remaining_idle_time_in_ms = 0.0; 4845 double remaining_idle_time_in_ms = 0.0;
4874 do { 4846 do {
4875 incremental_marking()->Step( 4847 incremental_marking()->Step(
4876 action.parameter, IncrementalMarking::NO_GC_VIA_STACK_GUARD, 4848 action.parameter, IncrementalMarking::NO_GC_VIA_STACK_GUARD,
4877 IncrementalMarking::FORCE_MARKING, 4849 IncrementalMarking::FORCE_MARKING,
4878 IncrementalMarking::DO_NOT_FORCE_COMPLETION); 4850 IncrementalMarking::DO_NOT_FORCE_COMPLETION);
4879 remaining_idle_time_in_ms = 4851 remaining_idle_time_in_ms =
4880 deadline_in_ms - MonotonicallyIncreasingTimeInMs(); 4852 deadline_in_ms - MonotonicallyIncreasingTimeInMs();
4881 } while (remaining_idle_time_in_ms >= 4853 } while (remaining_idle_time_in_ms >=
4882 2.0 * GCIdleTimeHandler::kIncrementalMarkingStepTimeInMs && 4854 2.0 * GCIdleTimeHandler::kIncrementalMarkingStepTimeInMs &&
4883 !incremental_marking()->IsComplete() && 4855 !incremental_marking()->IsComplete() &&
4884 !mark_compact_collector_.marking_deque()->IsEmpty()); 4856 !mark_compact_collector_.marking_deque()->IsEmpty());
4885 if (remaining_idle_time_in_ms > 0.0) { 4857 if (remaining_idle_time_in_ms > 0.0) {
4886 action.additional_work = TryFinalizeIdleIncrementalMarking( 4858 action.additional_work = TryFinalizeIdleIncrementalMarking(
4887 remaining_idle_time_in_ms, heap_state.size_of_objects, 4859 remaining_idle_time_in_ms, heap_state.size_of_objects,
4888 heap_state.final_incremental_mark_compact_speed_in_bytes_per_ms); 4860 heap_state.final_incremental_mark_compact_speed_in_bytes_per_ms);
4889 } 4861 }
4890 break; 4862 break;
4891 } 4863 }
4892 case DO_FULL_GC: { 4864 case DO_FULL_GC: {
4893 DCHECK(contexts_disposed_ > 0); 4865 if (action.reduce_memory) {
4894 HistogramTimerScope scope(isolate_->counters()->gc_context()); 4866 isolate_->compilation_cache()->Clear();
4895 CollectAllGarbage(kNoGCFlags, "idle notification: contexts disposed"); 4867 }
4868 if (contexts_disposed_) {
4869 HistogramTimerScope scope(isolate_->counters()->gc_context());
4870 CollectAllGarbage(kNoGCFlags, "idle notification: contexts disposed");
4871 } else {
4872 CollectAllGarbage(kReduceMemoryFootprintMask,
4873 "idle notification: finalize idle round");
4874 }
4875 gc_idle_time_handler_.NotifyIdleMarkCompact();
4896 break; 4876 break;
4897 } 4877 }
4898 case DO_SCAVENGE: 4878 case DO_SCAVENGE:
4899 CollectGarbage(NEW_SPACE, "idle notification: scavenge"); 4879 CollectGarbage(NEW_SPACE, "idle notification: scavenge");
4900 break; 4880 break;
4901 case DO_FINALIZE_SWEEPING: 4881 case DO_FINALIZE_SWEEPING:
4902 mark_compact_collector()->EnsureSweepingCompleted(); 4882 mark_compact_collector()->EnsureSweepingCompleted();
4903 break; 4883 break;
4904 case DO_NOTHING: 4884 case DO_NOTHING:
4905 break; 4885 break;
(...skipping 720 matching lines...) Expand 10 before | Expand all | Expand 10 after
5626 if (max_old_generation_size_ <= kMaxOldSpaceSizeMediumMemoryDevice || 5606 if (max_old_generation_size_ <= kMaxOldSpaceSizeMediumMemoryDevice ||
5627 FLAG_optimize_for_size) { 5607 FLAG_optimize_for_size) {
5628 factor = Min(factor, kMaxHeapGrowingFactorMemoryConstrained); 5608 factor = Min(factor, kMaxHeapGrowingFactorMemoryConstrained);
5629 } 5609 }
5630 5610
5631 if (FLAG_stress_compaction || 5611 if (FLAG_stress_compaction ||
5632 mark_compact_collector()->reduce_memory_footprint_) { 5612 mark_compact_collector()->reduce_memory_footprint_) {
5633 factor = kMinHeapGrowingFactor; 5613 factor = kMinHeapGrowingFactor;
5634 } 5614 }
5635 5615
5616 // TODO(hpayer): Investigate if idle_old_generation_allocation_limit_ is still
5617 // needed after taking the allocation rate for the old generation limit into
5618 // account.
5619 double idle_factor = Min(factor, kMaxHeapGrowingFactorIdle);
5620
5636 old_generation_allocation_limit_ = 5621 old_generation_allocation_limit_ =
5637 CalculateOldGenerationAllocationLimit(factor, old_gen_size); 5622 CalculateOldGenerationAllocationLimit(factor, old_gen_size);
5623 idle_old_generation_allocation_limit_ =
5624 CalculateOldGenerationAllocationLimit(idle_factor, old_gen_size);
5638 5625
5639 if (FLAG_trace_gc_verbose) { 5626 if (FLAG_trace_gc_verbose) {
5640 PrintIsolate(isolate_, "Grow: old size: %" V8_PTR_PREFIX 5627 PrintIsolate(
5641 "d KB, new limit: %" V8_PTR_PREFIX "d KB (%.1f)\n", 5628 isolate_,
5642 old_gen_size / KB, old_generation_allocation_limit_ / KB, 5629 "Grow: old size: %" V8_PTR_PREFIX "d KB, new limit: %" V8_PTR_PREFIX
5643 factor); 5630 "d KB (%.1f), new idle limit: %" V8_PTR_PREFIX "d KB (%.1f)\n",
5631 old_gen_size / KB, old_generation_allocation_limit_ / KB, factor,
5632 idle_old_generation_allocation_limit_ / KB, idle_factor);
5644 } 5633 }
5645 } 5634 }
5646 5635
5647 5636
5648 void Heap::DampenOldGenerationAllocationLimit(intptr_t old_gen_size, 5637 void Heap::DampenOldGenerationAllocationLimit(intptr_t old_gen_size,
5649 double gc_speed, 5638 double gc_speed,
5650 double mutator_speed) { 5639 double mutator_speed) {
5651 double factor = HeapGrowingFactor(gc_speed, mutator_speed); 5640 double factor = HeapGrowingFactor(gc_speed, mutator_speed);
5652 intptr_t limit = CalculateOldGenerationAllocationLimit(factor, old_gen_size); 5641 intptr_t limit = CalculateOldGenerationAllocationLimit(factor, old_gen_size);
5653 if (limit < old_generation_allocation_limit_) { 5642 if (limit < old_generation_allocation_limit_) {
(...skipping 1224 matching lines...) Expand 10 before | Expand all | Expand 10 after
6878 *object_type = "CODE_TYPE"; \ 6867 *object_type = "CODE_TYPE"; \
6879 *object_sub_type = "CODE_AGE/" #name; \ 6868 *object_sub_type = "CODE_AGE/" #name; \
6880 return true; 6869 return true;
6881 CODE_AGE_LIST_COMPLETE(COMPARE_AND_RETURN_NAME) 6870 CODE_AGE_LIST_COMPLETE(COMPARE_AND_RETURN_NAME)
6882 #undef COMPARE_AND_RETURN_NAME 6871 #undef COMPARE_AND_RETURN_NAME
6883 } 6872 }
6884 return false; 6873 return false;
6885 } 6874 }
6886 } // namespace internal 6875 } // namespace internal
6887 } // namespace v8 6876 } // namespace v8
OLDNEW
« no previous file with comments | « src/heap/heap.h ('k') | src/heap/memory-reducer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698