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

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

Issue 1143133004: Reland Set lower allocation limit in idle notification only if no GC happend recently. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 7 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') | no next file » | 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"
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
126 nodes_copied_in_new_space_(0), 126 nodes_copied_in_new_space_(0),
127 nodes_promoted_(0), 127 nodes_promoted_(0),
128 maximum_size_scavenges_(0), 128 maximum_size_scavenges_(0),
129 max_gc_pause_(0.0), 129 max_gc_pause_(0.0),
130 total_gc_time_ms_(0.0), 130 total_gc_time_ms_(0.0),
131 max_alive_after_gc_(0), 131 max_alive_after_gc_(0),
132 min_in_mutator_(kMaxInt), 132 min_in_mutator_(kMaxInt),
133 marking_time_(0.0), 133 marking_time_(0.0),
134 sweeping_time_(0.0), 134 sweeping_time_(0.0),
135 last_idle_notification_time_(0.0), 135 last_idle_notification_time_(0.0),
136 last_gc_time_(0.0),
136 mark_compact_collector_(this), 137 mark_compact_collector_(this),
137 store_buffer_(this), 138 store_buffer_(this),
138 marking_(this), 139 marking_(this),
139 incremental_marking_(this), 140 incremental_marking_(this),
140 gc_count_at_last_idle_gc_(0), 141 gc_count_at_last_idle_gc_(0),
141 full_codegen_bytes_generated_(0), 142 full_codegen_bytes_generated_(0),
142 crankshaft_codegen_bytes_generated_(0), 143 crankshaft_codegen_bytes_generated_(0),
143 gcs_since_last_deopt_(0), 144 gcs_since_last_deopt_(0),
144 allocation_sites_scratchpad_length_(0), 145 allocation_sites_scratchpad_length_(0),
145 promotion_queue_(this), 146 promotion_queue_(this),
(...skipping 572 matching lines...) Expand 10 before | Expand all | Expand 10 after
718 #undef UPDATE_FRAGMENTATION_FOR_SPACE 719 #undef UPDATE_FRAGMENTATION_FOR_SPACE
719 #undef UPDATE_COUNTERS_AND_FRAGMENTATION_FOR_SPACE 720 #undef UPDATE_COUNTERS_AND_FRAGMENTATION_FOR_SPACE
720 721
721 #ifdef DEBUG 722 #ifdef DEBUG
722 ReportStatisticsAfterGC(); 723 ReportStatisticsAfterGC();
723 #endif // DEBUG 724 #endif // DEBUG
724 725
725 // Remember the last top pointer so that we can later find out 726 // Remember the last top pointer so that we can later find out
726 // whether we allocated in new space since the last GC. 727 // whether we allocated in new space since the last GC.
727 new_space_top_after_last_gc_ = new_space()->top(); 728 new_space_top_after_last_gc_ = new_space()->top();
729 last_gc_time_ = MonotonicallyIncreasingTimeInMs();
728 } 730 }
729 731
730 732
731 void Heap::PreprocessStackTraces() { 733 void Heap::PreprocessStackTraces() {
732 if (!weak_stack_trace_list()->IsWeakFixedArray()) return; 734 if (!weak_stack_trace_list()->IsWeakFixedArray()) return;
733 WeakFixedArray* array = WeakFixedArray::cast(weak_stack_trace_list()); 735 WeakFixedArray* array = WeakFixedArray::cast(weak_stack_trace_list());
734 int length = array->Length(); 736 int length = array->Length();
735 for (int i = 0; i < length; i++) { 737 for (int i = 0; i < length; i++) {
736 if (array->IsEmptySlot(i)) continue; 738 if (array->IsEmptySlot(i)) continue;
737 FixedArray* elements = FixedArray::cast(array->Get(i)); 739 FixedArray* elements = FixedArray::cast(array->Get(i));
(...skipping 3867 matching lines...) Expand 10 before | Expand all | Expand 10 after
4605 deadline_in_seconds * 4607 deadline_in_seconds *
4606 static_cast<double>(base::Time::kMillisecondsPerSecond); 4608 static_cast<double>(base::Time::kMillisecondsPerSecond);
4607 HistogramTimerScope idle_notification_scope( 4609 HistogramTimerScope idle_notification_scope(
4608 isolate_->counters()->gc_idle_notification()); 4610 isolate_->counters()->gc_idle_notification());
4609 double start_ms = MonotonicallyIncreasingTimeInMs(); 4611 double start_ms = MonotonicallyIncreasingTimeInMs();
4610 double idle_time_in_ms = deadline_in_ms - start_ms; 4612 double idle_time_in_ms = deadline_in_ms - start_ms;
4611 bool is_long_idle_notification = 4613 bool is_long_idle_notification =
4612 static_cast<size_t>(idle_time_in_ms) > 4614 static_cast<size_t>(idle_time_in_ms) >
4613 GCIdleTimeHandler::kMaxFrameRenderingIdleTime; 4615 GCIdleTimeHandler::kMaxFrameRenderingIdleTime;
4614 4616
4617 static const double kLastGCTimeTreshold = 1000;
4618
4615 GCIdleTimeHandler::HeapState heap_state; 4619 GCIdleTimeHandler::HeapState heap_state;
4616 heap_state.contexts_disposed = contexts_disposed_; 4620 heap_state.contexts_disposed = contexts_disposed_;
4617 heap_state.contexts_disposal_rate = 4621 heap_state.contexts_disposal_rate =
4618 tracer()->ContextDisposalRateInMilliseconds(); 4622 tracer()->ContextDisposalRateInMilliseconds();
4619 heap_state.size_of_objects = static_cast<size_t>(SizeOfObjects()); 4623 heap_state.size_of_objects = static_cast<size_t>(SizeOfObjects());
4620 heap_state.incremental_marking_stopped = incremental_marking()->IsStopped(); 4624 heap_state.incremental_marking_stopped = incremental_marking()->IsStopped();
4621 // TODO(ulan): Start incremental marking only for large heaps. 4625 // TODO(ulan): Start incremental marking only for large heaps.
4622 intptr_t limit = old_generation_allocation_limit_; 4626 intptr_t limit = old_generation_allocation_limit_;
4623 if (is_long_idle_notification) { 4627 if (is_long_idle_notification &&
4628 (start_ms - last_gc_time_ > kLastGCTimeTreshold)) {
4624 limit = idle_old_generation_allocation_limit_; 4629 limit = idle_old_generation_allocation_limit_;
4625 } 4630 }
4626 4631
4627 heap_state.can_start_incremental_marking = 4632 heap_state.can_start_incremental_marking =
4628 incremental_marking()->CanBeActivated() && 4633 incremental_marking()->CanBeActivated() &&
4629 HeapIsFullEnoughToStartIncrementalMarking(limit) && 4634 HeapIsFullEnoughToStartIncrementalMarking(limit) &&
4630 !mark_compact_collector()->sweeping_in_progress(); 4635 !mark_compact_collector()->sweeping_in_progress();
4631 heap_state.sweeping_in_progress = 4636 heap_state.sweeping_in_progress =
4632 mark_compact_collector()->sweeping_in_progress(); 4637 mark_compact_collector()->sweeping_in_progress();
4633 heap_state.sweeping_completed = 4638 heap_state.sweeping_completed =
(...skipping 1907 matching lines...) Expand 10 before | Expand all | Expand 10 after
6541 *object_type = "CODE_TYPE"; \ 6546 *object_type = "CODE_TYPE"; \
6542 *object_sub_type = "CODE_AGE/" #name; \ 6547 *object_sub_type = "CODE_AGE/" #name; \
6543 return true; 6548 return true;
6544 CODE_AGE_LIST_COMPLETE(COMPARE_AND_RETURN_NAME) 6549 CODE_AGE_LIST_COMPLETE(COMPARE_AND_RETURN_NAME)
6545 #undef COMPARE_AND_RETURN_NAME 6550 #undef COMPARE_AND_RETURN_NAME
6546 } 6551 }
6547 return false; 6552 return false;
6548 } 6553 }
6549 } 6554 }
6550 } // namespace v8::internal 6555 } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/heap/heap.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698