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

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

Issue 479693004: Add finalize sweeping event to GCIdleTimeHandler. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: 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/gc-idle-time-handler.cc ('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 4278 matching lines...) Expand 10 before | Expand all | Expand 10 after
4289 idle_time_in_ms); 4289 idle_time_in_ms);
4290 HistogramTimerScope idle_notification_scope( 4290 HistogramTimerScope idle_notification_scope(
4291 isolate_->counters()->gc_idle_notification()); 4291 isolate_->counters()->gc_idle_notification());
4292 4292
4293 GCIdleTimeHandler::HeapState heap_state; 4293 GCIdleTimeHandler::HeapState heap_state;
4294 heap_state.contexts_disposed = contexts_disposed_; 4294 heap_state.contexts_disposed = contexts_disposed_;
4295 heap_state.size_of_objects = static_cast<size_t>(SizeOfObjects()); 4295 heap_state.size_of_objects = static_cast<size_t>(SizeOfObjects());
4296 heap_state.incremental_marking_stopped = incremental_marking()->IsStopped(); 4296 heap_state.incremental_marking_stopped = incremental_marking()->IsStopped();
4297 // TODO(ulan): Start incremental marking only for large heaps. 4297 // TODO(ulan): Start incremental marking only for large heaps.
4298 heap_state.can_start_incremental_marking = true; 4298 heap_state.can_start_incremental_marking = true;
4299 heap_state.sweeping_in_progress =
4300 mark_compact_collector()->sweeping_in_progress();
4299 4301
4300 GCIdleTimeAction action = 4302 GCIdleTimeAction action =
4301 gc_idle_time_handler_.Compute(idle_time_in_ms, heap_state, tracer()); 4303 gc_idle_time_handler_.Compute(idle_time_in_ms, heap_state, tracer());
4302 4304
4303 contexts_disposed_ = 0; 4305 contexts_disposed_ = 0;
4304 bool result = false; 4306 bool result = false;
4305 switch (action.type) { 4307 switch (action.type) {
4306 case DO_INCREMENTAL_MARKING: 4308 case DO_INCREMENTAL_MARKING:
4307 if (incremental_marking()->IsStopped()) { 4309 if (incremental_marking()->IsStopped()) {
4308 incremental_marking()->Start(); 4310 incremental_marking()->Start();
4309 } 4311 }
4310 AdvanceIdleIncrementalMarking(action.parameter); 4312 AdvanceIdleIncrementalMarking(action.parameter);
4311 break; 4313 break;
4312 case DO_FULL_GC: { 4314 case DO_FULL_GC: {
4313 HistogramTimerScope scope(isolate_->counters()->gc_context()); 4315 HistogramTimerScope scope(isolate_->counters()->gc_context());
4314 const char* message = contexts_disposed_ 4316 const char* message = contexts_disposed_
4315 ? "idle notification: contexts disposed" 4317 ? "idle notification: contexts disposed"
4316 : "idle notification: finalize idle round"; 4318 : "idle notification: finalize idle round";
4317 CollectAllGarbage(kReduceMemoryFootprintMask, message); 4319 CollectAllGarbage(kReduceMemoryFootprintMask, message);
4318 gc_idle_time_handler_.NotifyIdleMarkCompact(); 4320 gc_idle_time_handler_.NotifyIdleMarkCompact();
4319 break; 4321 break;
4320 } 4322 }
4321 case DO_SCAVENGE: 4323 case DO_SCAVENGE:
4322 CollectGarbage(NEW_SPACE, "idle notification: scavenge"); 4324 CollectGarbage(NEW_SPACE, "idle notification: scavenge");
4323 break; 4325 break;
4326 case DO_FINALIZE_SWEEPING:
4327 mark_compact_collector()->EnsureSweepingCompleted();
4324 case DO_NOTHING: 4328 case DO_NOTHING:
4325 result = true; 4329 result = true;
4326 break; 4330 break;
4327 } 4331 }
4328 // If the IdleNotifcation is called with a large hint we will wait for
4329 // the sweepter threads here.
4330 // TODO(ulan): move this in GCIdleTimeHandler.
4331 const int kMinHintForFullGC = 100;
4332 if (idle_time_in_ms >= kMinHintForFullGC &&
4333 mark_compact_collector()->sweeping_in_progress()) {
4334 mark_compact_collector()->EnsureSweepingCompleted();
4335 }
4336 4332
4337 return result; 4333 return result;
4338 } 4334 }
4339 4335
4340 4336
4341 #ifdef DEBUG 4337 #ifdef DEBUG
4342 4338
4343 void Heap::Print() { 4339 void Heap::Print() {
4344 if (!HasBeenSetUp()) return; 4340 if (!HasBeenSetUp()) return;
4345 isolate()->PrintStack(stdout); 4341 isolate()->PrintStack(stdout);
(...skipping 1760 matching lines...) Expand 10 before | Expand all | Expand 10 after
6106 static_cast<int>(object_sizes_last_time_[index])); 6102 static_cast<int>(object_sizes_last_time_[index]));
6107 CODE_AGE_LIST_COMPLETE(ADJUST_LAST_TIME_OBJECT_COUNT) 6103 CODE_AGE_LIST_COMPLETE(ADJUST_LAST_TIME_OBJECT_COUNT)
6108 #undef ADJUST_LAST_TIME_OBJECT_COUNT 6104 #undef ADJUST_LAST_TIME_OBJECT_COUNT
6109 6105
6110 MemCopy(object_counts_last_time_, object_counts_, sizeof(object_counts_)); 6106 MemCopy(object_counts_last_time_, object_counts_, sizeof(object_counts_));
6111 MemCopy(object_sizes_last_time_, object_sizes_, sizeof(object_sizes_)); 6107 MemCopy(object_sizes_last_time_, object_sizes_, sizeof(object_sizes_));
6112 ClearObjectStats(); 6108 ClearObjectStats();
6113 } 6109 }
6114 } 6110 }
6115 } // namespace v8::internal 6111 } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/heap/gc-idle-time-handler.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698