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

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

Issue 500483002: Revert "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();
4301 4299
4302 GCIdleTimeAction action = 4300 GCIdleTimeAction action =
4303 gc_idle_time_handler_.Compute(idle_time_in_ms, heap_state, tracer()); 4301 gc_idle_time_handler_.Compute(idle_time_in_ms, heap_state, tracer());
4304 4302
4305 contexts_disposed_ = 0; 4303 contexts_disposed_ = 0;
4306 bool result = false; 4304 bool result = false;
4307 switch (action.type) { 4305 switch (action.type) {
4308 case DO_INCREMENTAL_MARKING: 4306 case DO_INCREMENTAL_MARKING:
4309 if (incremental_marking()->IsStopped()) { 4307 if (incremental_marking()->IsStopped()) {
4310 incremental_marking()->Start(); 4308 incremental_marking()->Start();
4311 } 4309 }
4312 AdvanceIdleIncrementalMarking(action.parameter); 4310 AdvanceIdleIncrementalMarking(action.parameter);
4313 break; 4311 break;
4314 case DO_FULL_GC: { 4312 case DO_FULL_GC: {
4315 HistogramTimerScope scope(isolate_->counters()->gc_context()); 4313 HistogramTimerScope scope(isolate_->counters()->gc_context());
4316 const char* message = contexts_disposed_ 4314 const char* message = contexts_disposed_
4317 ? "idle notification: contexts disposed" 4315 ? "idle notification: contexts disposed"
4318 : "idle notification: finalize idle round"; 4316 : "idle notification: finalize idle round";
4319 CollectAllGarbage(kReduceMemoryFootprintMask, message); 4317 CollectAllGarbage(kReduceMemoryFootprintMask, message);
4320 gc_idle_time_handler_.NotifyIdleMarkCompact(); 4318 gc_idle_time_handler_.NotifyIdleMarkCompact();
4321 break; 4319 break;
4322 } 4320 }
4323 case DO_SCAVENGE: 4321 case DO_SCAVENGE:
4324 CollectGarbage(NEW_SPACE, "idle notification: scavenge"); 4322 CollectGarbage(NEW_SPACE, "idle notification: scavenge");
4325 break; 4323 break;
4326 case DO_FINALIZE_SWEEPING:
4327 mark_compact_collector()->EnsureSweepingCompleted();
4328 case DO_NOTHING: 4324 case DO_NOTHING:
4329 result = true; 4325 result = true;
4330 break; 4326 break;
4331 } 4327 }
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 }
4332 4336
4333 return result; 4337 return result;
4334 } 4338 }
4335 4339
4336 4340
4337 #ifdef DEBUG 4341 #ifdef DEBUG
4338 4342
4339 void Heap::Print() { 4343 void Heap::Print() {
4340 if (!HasBeenSetUp()) return; 4344 if (!HasBeenSetUp()) return;
4341 isolate()->PrintStack(stdout); 4345 isolate()->PrintStack(stdout);
(...skipping 1760 matching lines...) Expand 10 before | Expand all | Expand 10 after
6102 static_cast<int>(object_sizes_last_time_[index])); 6106 static_cast<int>(object_sizes_last_time_[index]));
6103 CODE_AGE_LIST_COMPLETE(ADJUST_LAST_TIME_OBJECT_COUNT) 6107 CODE_AGE_LIST_COMPLETE(ADJUST_LAST_TIME_OBJECT_COUNT)
6104 #undef ADJUST_LAST_TIME_OBJECT_COUNT 6108 #undef ADJUST_LAST_TIME_OBJECT_COUNT
6105 6109
6106 MemCopy(object_counts_last_time_, object_counts_, sizeof(object_counts_)); 6110 MemCopy(object_counts_last_time_, object_counts_, sizeof(object_counts_));
6107 MemCopy(object_sizes_last_time_, object_sizes_, sizeof(object_sizes_)); 6111 MemCopy(object_sizes_last_time_, object_sizes_, sizeof(object_sizes_));
6108 ClearObjectStats(); 6112 ClearObjectStats();
6109 } 6113 }
6110 } 6114 }
6111 } // namespace v8::internal 6115 } // 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