Reviewers: Hannes Payer,
Message:
PTAL
Description:
Remove dependency on GCTrace from GCIdleTimeHandler.
This makes testing GCIdleTimeHandler easier.
BUG=
Please review this at https://codereview.chromium.org/496253002/
SVN Base: https://v8.googlecode.com/svn/branches/bleeding_edge
Affected files (+15, -12 lines):
M src/heap/gc-idle-time-handler.h
M src/heap/gc-idle-time-handler.cc
M src/heap/heap.cc
Index: src/heap/gc-idle-time-handler.cc
diff --git a/src/heap/gc-idle-time-handler.cc
b/src/heap/gc-idle-time-handler.cc
index
90f916e2f45a025b056eee843de8d6de4556d7c2..ed4677212641608a0fb158d9040b2a2ba9906695
100644
--- a/src/heap/gc-idle-time-handler.cc
+++ b/src/heap/gc-idle-time-handler.cc
@@ -46,8 +46,7 @@ size_t GCIdleTimeHandler::EstimateMarkCompactTime(
GCIdleTimeAction GCIdleTimeHandler::Compute(int 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,10 @@ GCIdleTimeAction GCIdleTimeHandler::Compute(int
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 >= static_cast<int>(EstimateMarkCompactTime(
- heap_state.size_of_objects, speed))) {
+ if (idle_time_in_ms >=
+ static_cast<int>(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.
@@ -76,9 +75,8 @@ GCIdleTimeAction GCIdleTimeHandler::Compute(int
idle_time_in_ms,
return GCIdleTimeAction::Nothing();
}
}
- 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);
}
}
Index: src/heap/gc-idle-time-handler.h
diff --git a/src/heap/gc-idle-time-handler.h
b/src/heap/gc-idle-time-handler.h
index
5a842a85971f42823edc93cba4ca754c408f656a..3a552750b6ebc23fb8f3e0b421af3f20933059d5
100644
--- a/src/heap/gc-idle-time-handler.h
+++ b/src/heap/gc-idle-time-handler.h
@@ -79,14 +79,15 @@ class GCIdleTimeHandler {
size_t size_of_objects;
bool incremental_marking_stopped;
bool can_start_incremental_marking;
+ 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(int idle_time_in_ms, HeapState heap_state,
- GCTracer* gc_tracer);
+ GCIdleTimeAction Compute(int idle_time_in_ms, HeapState heap_state);
void NotifyIdleMarkCompact() {
if (mark_compacts_since_idle_round_started_ <
kMaxMarkCompactsInIdleRound) {
Index: src/heap/heap.cc
diff --git a/src/heap/heap.cc b/src/heap/heap.cc
index
f3f539d78153c120a75ac43478f9766f5d6c0ff4..93301bf1107f82c4d045de49b819919367df7025
100644
--- a/src/heap/heap.cc
+++ b/src/heap/heap.cc
@@ -4296,9 +4296,13 @@ bool Heap::IdleNotification(int idle_time_in_ms) {
heap_state.incremental_marking_stopped =
incremental_marking()->IsStopped();
// TODO(ulan): Start incremental marking only for large heaps.
heap_state.can_start_incremental_marking = true;
+ 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;
--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
---
You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.