Commit 7ec1c361 authored by hpayer's avatar hpayer Committed by Commit bot

Slow down incremental marking on main thread when idle notification is active.

BUG=

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

Cr-Commit-Position: refs/heads/master@{#25630}
parent 07584119
......@@ -120,6 +120,7 @@ Heap::Heap()
min_in_mutator_(kMaxInt),
marking_time_(0.0),
sweeping_time_(0.0),
last_idle_notification_time_(0.0),
mark_compact_collector_(this),
store_buffer_(this),
marking_(this),
......@@ -4530,6 +4531,7 @@ bool Heap::IdleNotification(double deadline_in_seconds) {
}
double current_time = MonotonicallyIncreasingTimeInMs();
last_idle_notification_time_ = current_time;
double deadline_difference = deadline_in_ms - current_time;
if (deadline_difference >= 0) {
......@@ -4564,6 +4566,13 @@ bool Heap::IdleNotification(double deadline_in_seconds) {
}
bool Heap::RecentIdleNotifcationHappened() {
return (last_idle_notification_time_ +
GCIdleTimeHandler::kMaxFrameRenderingIdleTime) >
MonotonicallyIncreasingTimeInMs();
}
#ifdef DEBUG
void Heap::Print() {
......
......@@ -1295,6 +1295,8 @@ class Heap {
int gc_count() const { return gc_count_; }
bool RecentIdleNotifcationHappened();
// Completely clear the Instanceof cache (to stop it keeping objects alive
// around a GC).
inline void CompletelyClearInstanceofCache();
......@@ -2057,6 +2059,9 @@ class Heap {
// Cumulative GC time spent in sweeping
double sweeping_time_;
// Last time an idle notification happened
double last_idle_notification_time_;
MarkCompactCollector mark_compact_collector_;
StoreBuffer store_buffer_;
......
......@@ -880,6 +880,12 @@ intptr_t IncrementalMarking::Step(intptr_t allocated_bytes,
return 0;
}
// If an idle notification happened recently, we delay marking steps.
if (marking == DO_NOT_FORCE_MARKING &&
heap_->RecentIdleNotifcationHappened()) {
return 0;
}
if (state_ == MARKING && no_marking_scope_depth_ > 0) return 0;
intptr_t bytes_processed = 0;
......
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