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

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

Issue 496873004: Reland part of r23285 "Start incremental marking in idle time handler only if it is worthwhile."" (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Diff between this CL and r23285 Created 6 years, 4 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 | Annotate | Revision Log
« 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/once.h" 9 #include "src/base/once.h"
10 #include "src/base/utils/random-number-generator.h" 10 #include "src/base/utils/random-number-generator.h"
(...skipping 827 matching lines...) Expand 10 before | Expand all | Expand 10 after
838 PerformGarbageCollection(collector, gc_callback_flags); 838 PerformGarbageCollection(collector, gc_callback_flags);
839 } 839 }
840 840
841 GarbageCollectionEpilogue(); 841 GarbageCollectionEpilogue();
842 tracer()->Stop(); 842 tracer()->Stop();
843 } 843 }
844 844
845 // Start incremental marking for the next cycle. The heap snapshot 845 // Start incremental marking for the next cycle. The heap snapshot
846 // generator needs incremental marking to stay off after it aborted. 846 // generator needs incremental marking to stay off after it aborted.
847 if (!mark_compact_collector()->abort_incremental_marking() && 847 if (!mark_compact_collector()->abort_incremental_marking() &&
848 incremental_marking()->IsStopped() && 848 WorthActivatingIncrementalMarking()) {
849 incremental_marking()->WorthActivating() && NextGCIsLikelyToBeFull()) {
850 incremental_marking()->Start(); 849 incremental_marking()->Start();
851 } 850 }
852 851
853 return next_gc_likely_to_collect_more; 852 return next_gc_likely_to_collect_more;
854 } 853 }
855 854
856 855
857 int Heap::NotifyContextDisposed() { 856 int Heap::NotifyContextDisposed() {
858 if (isolate()->concurrent_recompilation_enabled()) { 857 if (isolate()->concurrent_recompilation_enabled()) {
859 // Flush the queued recompilation tasks. 858 // Flush the queued recompilation tasks.
(...skipping 3410 matching lines...) Expand 10 before | Expand all | Expand 10 after
4270 gc_idle_time_handler_.NotifyIdleMarkCompact(); 4269 gc_idle_time_handler_.NotifyIdleMarkCompact();
4271 gc_count_at_last_idle_gc_ = gc_count_; 4270 gc_count_at_last_idle_gc_ = gc_count_;
4272 if (uncommit) { 4271 if (uncommit) {
4273 new_space_.Shrink(); 4272 new_space_.Shrink();
4274 UncommitFromSpace(); 4273 UncommitFromSpace();
4275 } 4274 }
4276 } 4275 }
4277 } 4276 }
4278 4277
4279 4278
4279 bool Heap::WorthActivatingIncrementalMarking() {
4280 return incremental_marking()->IsStopped() &&
4281 incremental_marking()->WorthActivating() && NextGCIsLikelyToBeFull();
4282 }
4283
4284
4280 bool Heap::IdleNotification(int idle_time_in_ms) { 4285 bool Heap::IdleNotification(int idle_time_in_ms) {
4281 // If incremental marking is off, we do not perform idle notification. 4286 // If incremental marking is off, we do not perform idle notification.
4282 if (!FLAG_incremental_marking) return true; 4287 if (!FLAG_incremental_marking) return true;
4283 isolate()->counters()->gc_idle_time_allotted_in_ms()->AddSample( 4288 isolate()->counters()->gc_idle_time_allotted_in_ms()->AddSample(
4284 idle_time_in_ms); 4289 idle_time_in_ms);
4285 HistogramTimerScope idle_notification_scope( 4290 HistogramTimerScope idle_notification_scope(
4286 isolate_->counters()->gc_idle_notification()); 4291 isolate_->counters()->gc_idle_notification());
4287 4292
4288 GCIdleTimeAction action = gc_idle_time_handler_.Compute( 4293 GCIdleTimeHandler::HeapState heap_state;
4289 idle_time_in_ms, contexts_disposed_, static_cast<size_t>(SizeOfObjects()), 4294 heap_state.contexts_disposed = contexts_disposed_;
4290 incremental_marking()->IsStopped(), tracer()); 4295 heap_state.size_of_objects = static_cast<size_t>(SizeOfObjects());
4296 heap_state.incremental_marking_stopped = incremental_marking()->IsStopped();
4297 // TODO(ulan): Start incremental marking only for large heaps.
4298 heap_state.can_start_incremental_marking = true;
4299
4300 GCIdleTimeAction action =
4301 gc_idle_time_handler_.Compute(idle_time_in_ms, heap_state, tracer());
4302
4291 contexts_disposed_ = 0; 4303 contexts_disposed_ = 0;
4292 bool result = false; 4304 bool result = false;
4293 switch (action.type) { 4305 switch (action.type) {
4294 case DO_INCREMENTAL_MARKING: 4306 case DO_INCREMENTAL_MARKING:
4295 if (incremental_marking()->IsStopped()) { 4307 if (incremental_marking()->IsStopped()) {
4296 incremental_marking()->Start(); 4308 incremental_marking()->Start();
4297 } 4309 }
4298 AdvanceIdleIncrementalMarking(action.parameter); 4310 AdvanceIdleIncrementalMarking(action.parameter);
4299 break; 4311 break;
4300 case DO_FULL_GC: { 4312 case DO_FULL_GC: {
(...skipping 1793 matching lines...) Expand 10 before | Expand all | Expand 10 after
6094 static_cast<int>(object_sizes_last_time_[index])); 6106 static_cast<int>(object_sizes_last_time_[index]));
6095 CODE_AGE_LIST_COMPLETE(ADJUST_LAST_TIME_OBJECT_COUNT) 6107 CODE_AGE_LIST_COMPLETE(ADJUST_LAST_TIME_OBJECT_COUNT)
6096 #undef ADJUST_LAST_TIME_OBJECT_COUNT 6108 #undef ADJUST_LAST_TIME_OBJECT_COUNT
6097 6109
6098 MemCopy(object_counts_last_time_, object_counts_, sizeof(object_counts_)); 6110 MemCopy(object_counts_last_time_, object_counts_, sizeof(object_counts_));
6099 MemCopy(object_sizes_last_time_, object_sizes_, sizeof(object_sizes_)); 6111 MemCopy(object_sizes_last_time_, object_sizes_, sizeof(object_sizes_));
6100 ClearObjectStats(); 6112 ClearObjectStats();
6101 } 6113 }
6102 } 6114 }
6103 } // namespace v8::internal 6115 } // 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