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

Side by Side Diff: src/heap/gc-idle-time-handler.cc

Issue 563493002: Allow IdleNotification to trigger Scavenges. (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
OLDNEW
1 // Copyright 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 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/heap/gc-idle-time-handler.h" 5 #include "src/heap/gc-idle-time-handler.h"
6 #include "src/heap/gc-tracer.h" 6 #include "src/heap/gc-tracer.h"
7 #include "src/utils.h" 7 #include "src/utils.h"
8 8
9 namespace v8 { 9 namespace v8 {
10 namespace internal { 10 namespace internal {
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
61 size_t GCIdleTimeHandler::EstimateMarkCompactTime( 61 size_t GCIdleTimeHandler::EstimateMarkCompactTime(
62 size_t size_of_objects, size_t mark_compact_speed_in_bytes_per_ms) { 62 size_t size_of_objects, size_t mark_compact_speed_in_bytes_per_ms) {
63 if (mark_compact_speed_in_bytes_per_ms == 0) { 63 if (mark_compact_speed_in_bytes_per_ms == 0) {
64 mark_compact_speed_in_bytes_per_ms = kInitialConservativeMarkCompactSpeed; 64 mark_compact_speed_in_bytes_per_ms = kInitialConservativeMarkCompactSpeed;
65 } 65 }
66 size_t result = size_of_objects / mark_compact_speed_in_bytes_per_ms; 66 size_t result = size_of_objects / mark_compact_speed_in_bytes_per_ms;
67 return Min(result, kMaxMarkCompactTimeInMs); 67 return Min(result, kMaxMarkCompactTimeInMs);
68 } 68 }
69 69
70 70
71 size_t GCIdleTimeHandler::EstimateScavengeTime(
72 size_t new_space_size, size_t scavenge_speed_in_bytes_per_ms) {
73 if (scavenge_speed_in_bytes_per_ms == 0) {
74 scavenge_speed_in_bytes_per_ms = kInitialConservativeScavengeSpeed;
75 }
76 return new_space_size / scavenge_speed_in_bytes_per_ms;
77 }
78
79
71 GCIdleTimeAction GCIdleTimeHandler::Compute(size_t idle_time_in_ms, 80 GCIdleTimeAction GCIdleTimeHandler::Compute(size_t idle_time_in_ms,
72 HeapState heap_state) { 81 HeapState heap_state) {
73 if (IsIdleRoundFinished()) { 82 if (heap_state.available_new_space_memory < kNewSpaceAlmostFullTreshold &&
ulan 2014/09/10 14:25:00 We should also check new space size now against ne
83 idle_time_in_ms >=
84 EstimateScavengeTime(heap_state.new_space_capacity,
85 heap_state.scavenge_speed_in_bytes_per_ms)) {
86 return GCIdleTimeAction::Scavenge();
87 }
88 if (IsMarkCompactIdleRoundFinished()) {
74 if (EnoughGarbageSinceLastIdleRound() || heap_state.contexts_disposed > 0) { 89 if (EnoughGarbageSinceLastIdleRound() || heap_state.contexts_disposed > 0) {
75 StartIdleRound(); 90 StartIdleRound();
76 } else { 91 } else {
77 return GCIdleTimeAction::Nothing(); 92 return GCIdleTimeAction::Nothing();
78 } 93 }
79 } 94 }
80 if (heap_state.incremental_marking_stopped) { 95 if (heap_state.incremental_marking_stopped) {
81 if (idle_time_in_ms >= EstimateMarkCompactTime( 96 if (idle_time_in_ms >= EstimateMarkCompactTime(
82 heap_state.size_of_objects, 97 heap_state.size_of_objects,
83 heap_state.mark_compact_speed_in_bytes_per_ms)) { 98 heap_state.mark_compact_speed_in_bytes_per_ms)) {
(...skipping 18 matching lines...) Expand all
102 idle_time_in_ms >= kMinTimeForFinalizeSweeping) { 117 idle_time_in_ms >= kMinTimeForFinalizeSweeping) {
103 return GCIdleTimeAction::FinalizeSweeping(); 118 return GCIdleTimeAction::FinalizeSweeping();
104 } 119 }
105 120
106 size_t step_size = EstimateMarkingStepSize( 121 size_t step_size = EstimateMarkingStepSize(
107 idle_time_in_ms, heap_state.incremental_marking_speed_in_bytes_per_ms); 122 idle_time_in_ms, heap_state.incremental_marking_speed_in_bytes_per_ms);
108 return GCIdleTimeAction::IncrementalMarking(step_size); 123 return GCIdleTimeAction::IncrementalMarking(step_size);
109 } 124 }
110 } 125 }
111 } 126 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698