Commit ee798e20 authored by hpayer's avatar hpayer Committed by Commit bot

Perform smaller marking steps incrementally in idle notification.

BUG=

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

Cr-Commit-Position: refs/heads/master@{#25607}
parent 49859dc3
...@@ -27,7 +27,8 @@ void GCIdleTimeAction::Print() { ...@@ -27,7 +27,8 @@ void GCIdleTimeAction::Print() {
PrintF("no action"); PrintF("no action");
break; break;
case DO_INCREMENTAL_MARKING: case DO_INCREMENTAL_MARKING:
PrintF("incremental marking with step %" V8_PTR_PREFIX "d", parameter); PrintF("incremental marking with step %" V8_PTR_PREFIX "d / ms",
parameter);
break; break;
case DO_SCAVENGE: case DO_SCAVENGE:
PrintF("scavenge"); PrintF("scavenge");
...@@ -250,7 +251,7 @@ GCIdleTimeAction GCIdleTimeHandler::Compute(double idle_time_in_ms, ...@@ -250,7 +251,7 @@ GCIdleTimeAction GCIdleTimeHandler::Compute(double idle_time_in_ms,
return GCIdleTimeAction::Nothing(); return GCIdleTimeAction::Nothing();
} }
size_t step_size = EstimateMarkingStepSize( size_t step_size = EstimateMarkingStepSize(
static_cast<size_t>(idle_time_in_ms), static_cast<size_t>(kIncrementalMarkingStepTimeInMs),
heap_state.incremental_marking_speed_in_bytes_per_ms); heap_state.incremental_marking_speed_in_bytes_per_ms);
return GCIdleTimeAction::IncrementalMarking(step_size); return GCIdleTimeAction::IncrementalMarking(step_size);
} }
......
...@@ -125,6 +125,9 @@ class GCIdleTimeHandler { ...@@ -125,6 +125,9 @@ class GCIdleTimeHandler {
// If contexts are disposed at a higher rate a full gc is triggered. // If contexts are disposed at a higher rate a full gc is triggered.
static const double kHighContextDisposalRate; static const double kHighContextDisposalRate;
// Incremental marking step time.
static const size_t kIncrementalMarkingStepTimeInMs = 1;
class HeapState { class HeapState {
public: public:
void Print(); void Print();
......
...@@ -4489,12 +4489,18 @@ bool Heap::IdleNotification(double deadline_in_seconds) { ...@@ -4489,12 +4489,18 @@ bool Heap::IdleNotification(double deadline_in_seconds) {
if (incremental_marking()->IsStopped()) { if (incremental_marking()->IsStopped()) {
incremental_marking()->Start(); incremental_marking()->Start();
} }
incremental_marking()->Step(action.parameter, double remaining_idle_time_in_ms = 0.0;
IncrementalMarking::NO_GC_VIA_STACK_GUARD, do {
IncrementalMarking::FORCE_MARKING, incremental_marking()->Step(
IncrementalMarking::DO_NOT_FORCE_COMPLETION); action.parameter, IncrementalMarking::NO_GC_VIA_STACK_GUARD,
double remaining_idle_time_in_ms = IncrementalMarking::FORCE_MARKING,
deadline_in_ms - MonotonicallyIncreasingTimeInMs(); IncrementalMarking::DO_NOT_FORCE_COMPLETION);
remaining_idle_time_in_ms =
deadline_in_ms - MonotonicallyIncreasingTimeInMs();
} while (remaining_idle_time_in_ms >=
2.0 * GCIdleTimeHandler::kIncrementalMarkingStepTimeInMs &&
!incremental_marking()->IsComplete() &&
!mark_compact_collector_.marking_deque()->IsEmpty());
if (remaining_idle_time_in_ms > 0.0) { if (remaining_idle_time_in_ms > 0.0) {
TryFinalizeIdleIncrementalMarking( TryFinalizeIdleIncrementalMarking(
remaining_idle_time_in_ms, heap_state.size_of_objects, remaining_idle_time_in_ms, heap_state.size_of_objects,
......
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