Commit 39c83bfa authored by ulan@chromium.org's avatar ulan@chromium.org

Remove dependency on GCTrace from GCIdleTimeHandler.

This makes testing GCIdleTimeHandler easier.

BUG=
R=hpayer@chromium.org

Review URL: https://codereview.chromium.org/496253002

git-svn-id: https://v8.googlecode.com/svn/branches/bleeding_edge@23314 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent cc07503b
......@@ -46,8 +46,7 @@ size_t GCIdleTimeHandler::EstimateMarkCompactTime(
GCIdleTimeAction GCIdleTimeHandler::Compute(size_t idle_time_in_ms,
HeapState heap_state,
GCTracer* gc_tracer) {
HeapState heap_state) {
if (IsIdleRoundFinished()) {
if (EnoughGarbageSinceLastIdleRound() || heap_state.contexts_disposed > 0) {
StartIdleRound();
......@@ -56,10 +55,9 @@ GCIdleTimeAction GCIdleTimeHandler::Compute(size_t idle_time_in_ms,
}
}
if (heap_state.incremental_marking_stopped) {
size_t speed =
static_cast<size_t>(gc_tracer->MarkCompactSpeedInBytesPerMillisecond());
if (idle_time_in_ms >=
EstimateMarkCompactTime(heap_state.size_of_objects, speed)) {
if (idle_time_in_ms >= EstimateMarkCompactTime(
heap_state.size_of_objects,
heap_state.mark_compact_speed_in_bytes_per_ms)) {
// If there are no more than two GCs left in this idle round and we are
// allowed to do a full GC, then make those GCs full in order to compact
// the code space.
......@@ -82,9 +80,8 @@ GCIdleTimeAction GCIdleTimeHandler::Compute(size_t idle_time_in_ms,
return GCIdleTimeAction::FinalizeSweeping();
}
intptr_t speed = gc_tracer->IncrementalMarkingSpeedInBytesPerMillisecond();
size_t step_size =
static_cast<size_t>(EstimateMarkingStepSize(idle_time_in_ms, speed));
size_t step_size = EstimateMarkingStepSize(
idle_time_in_ms, heap_state.incremental_marking_speed_in_bytes_per_ms);
return GCIdleTimeAction::IncrementalMarking(step_size);
}
}
......
......@@ -95,14 +95,15 @@ class GCIdleTimeHandler {
bool incremental_marking_stopped;
bool can_start_incremental_marking;
bool sweeping_in_progress;
size_t mark_compact_speed_in_bytes_per_ms;
size_t incremental_marking_speed_in_bytes_per_ms;
};
GCIdleTimeHandler()
: mark_compacts_since_idle_round_started_(0),
scavenges_since_last_idle_round_(0) {}
GCIdleTimeAction Compute(size_t idle_time_in_ms, HeapState heap_state,
GCTracer* gc_tracer);
GCIdleTimeAction Compute(size_t idle_time_in_ms, HeapState heap_state);
void NotifyIdleMarkCompact() {
if (mark_compacts_since_idle_round_started_ < kMaxMarkCompactsInIdleRound) {
......
......@@ -4298,9 +4298,13 @@ bool Heap::IdleNotification(int idle_time_in_ms) {
heap_state.can_start_incremental_marking = true;
heap_state.sweeping_in_progress =
mark_compact_collector()->sweeping_in_progress();
heap_state.mark_compact_speed_in_bytes_per_ms =
static_cast<size_t>(tracer()->MarkCompactSpeedInBytesPerMillisecond());
heap_state.incremental_marking_speed_in_bytes_per_ms = static_cast<size_t>(
tracer()->IncrementalMarkingSpeedInBytesPerMillisecond());
GCIdleTimeAction action =
gc_idle_time_handler_.Compute(idle_time_in_ms, heap_state, tracer());
gc_idle_time_handler_.Compute(idle_time_in_ms, heap_state);
contexts_disposed_ = 0;
bool result = false;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment