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

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

Issue 577573002: Introduce DONE state in idle notification handler. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 3 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-unittest.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/bits.h" 9 #include "src/base/bits.h"
10 #include "src/base/once.h" 10 #include "src/base/once.h"
(...skipping 4300 matching lines...) Expand 10 before | Expand all | Expand 10 after
4311 heap_state.mark_compact_speed_in_bytes_per_ms = 4311 heap_state.mark_compact_speed_in_bytes_per_ms =
4312 static_cast<size_t>(tracer()->MarkCompactSpeedInBytesPerMillisecond()); 4312 static_cast<size_t>(tracer()->MarkCompactSpeedInBytesPerMillisecond());
4313 heap_state.incremental_marking_speed_in_bytes_per_ms = static_cast<size_t>( 4313 heap_state.incremental_marking_speed_in_bytes_per_ms = static_cast<size_t>(
4314 tracer()->IncrementalMarkingSpeedInBytesPerMillisecond()); 4314 tracer()->IncrementalMarkingSpeedInBytesPerMillisecond());
4315 4315
4316 GCIdleTimeAction action = 4316 GCIdleTimeAction action =
4317 gc_idle_time_handler_.Compute(idle_time_in_ms, heap_state); 4317 gc_idle_time_handler_.Compute(idle_time_in_ms, heap_state);
4318 4318
4319 bool result = false; 4319 bool result = false;
4320 switch (action.type) { 4320 switch (action.type) {
4321 case DONE:
4322 result = true;
4323 break;
4321 case DO_INCREMENTAL_MARKING: 4324 case DO_INCREMENTAL_MARKING:
4322 if (incremental_marking()->IsStopped()) { 4325 if (incremental_marking()->IsStopped()) {
4323 incremental_marking()->Start(); 4326 incremental_marking()->Start();
4324 } 4327 }
4325 AdvanceIdleIncrementalMarking(action.parameter); 4328 AdvanceIdleIncrementalMarking(action.parameter);
4326 break; 4329 break;
4327 case DO_FULL_GC: { 4330 case DO_FULL_GC: {
4328 HistogramTimerScope scope(isolate_->counters()->gc_context()); 4331 HistogramTimerScope scope(isolate_->counters()->gc_context());
4329 const char* message = contexts_disposed_ 4332 const char* message = contexts_disposed_
4330 ? "idle notification: contexts disposed" 4333 ? "idle notification: contexts disposed"
4331 : "idle notification: finalize idle round"; 4334 : "idle notification: finalize idle round";
4332 CollectAllGarbage(kReduceMemoryFootprintMask, message); 4335 CollectAllGarbage(kReduceMemoryFootprintMask, message);
4333 gc_idle_time_handler_.NotifyIdleMarkCompact(); 4336 gc_idle_time_handler_.NotifyIdleMarkCompact();
4334 break; 4337 break;
4335 } 4338 }
4336 case DO_SCAVENGE: 4339 case DO_SCAVENGE:
4337 CollectGarbage(NEW_SPACE, "idle notification: scavenge"); 4340 CollectGarbage(NEW_SPACE, "idle notification: scavenge");
4338 break; 4341 break;
4339 case DO_FINALIZE_SWEEPING: 4342 case DO_FINALIZE_SWEEPING:
4340 mark_compact_collector()->EnsureSweepingCompleted(); 4343 mark_compact_collector()->EnsureSweepingCompleted();
4341 break; 4344 break;
4342 case DO_NOTHING: 4345 case DO_NOTHING:
4343 result = true;
4344 break; 4346 break;
4345 } 4347 }
4346 if (FLAG_trace_idle_notification) { 4348 if (FLAG_trace_idle_notification) {
4347 int actual_time_ms = static_cast<int>(timer.Elapsed().InMilliseconds()); 4349 int actual_time_ms = static_cast<int>(timer.Elapsed().InMilliseconds());
4348 PrintF("Idle notification: requested idle time %d ms, actual time %d ms [", 4350 PrintF("Idle notification: requested idle time %d ms, actual time %d ms [",
4349 idle_time_in_ms, actual_time_ms); 4351 idle_time_in_ms, actual_time_ms);
4350 action.Print(); 4352 action.Print();
4351 PrintF("]\n"); 4353 PrintF("]\n");
4352 } 4354 }
4353 4355
(...skipping 1772 matching lines...) Expand 10 before | Expand all | Expand 10 after
6126 static_cast<int>(object_sizes_last_time_[index])); 6128 static_cast<int>(object_sizes_last_time_[index]));
6127 CODE_AGE_LIST_COMPLETE(ADJUST_LAST_TIME_OBJECT_COUNT) 6129 CODE_AGE_LIST_COMPLETE(ADJUST_LAST_TIME_OBJECT_COUNT)
6128 #undef ADJUST_LAST_TIME_OBJECT_COUNT 6130 #undef ADJUST_LAST_TIME_OBJECT_COUNT
6129 6131
6130 MemCopy(object_counts_last_time_, object_counts_, sizeof(object_counts_)); 6132 MemCopy(object_counts_last_time_, object_counts_, sizeof(object_counts_));
6131 MemCopy(object_sizes_last_time_, object_sizes_, sizeof(object_sizes_)); 6133 MemCopy(object_sizes_last_time_, object_sizes_, sizeof(object_sizes_));
6132 ClearObjectStats(); 6134 ClearObjectStats();
6133 } 6135 }
6134 } 6136 }
6135 } // namespace v8::internal 6137 } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/heap/gc-idle-time-handler-unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698