Commit 57870d50 authored by Michael Lippautz's avatar Michael Lippautz Committed by Commit Bot

[wrapper-tracing] Fix performance regression during atomic pause marking

Fixes a regression where the exact timestamp was checked after processing a
single object.

Bug: chromium:878784
Change-Id: Id011b875ae56029bb415125d15b3701ac3dc375b
Reviewed-on: https://chromium-review.googlesource.com/1213249Reviewed-by: default avatarKentaro Hara <haraken@chromium.org>
Commit-Queue: Michael Lippautz <mlippautz@chromium.org>
Cr-Commit-Position: refs/heads/master@{#589777}
parent 2ec67f49
......@@ -178,6 +178,7 @@ void ScriptWrappableMarkingVisitor::RegisterV8References(
}
bool ScriptWrappableMarkingVisitor::AdvanceTracing(double deadline_in_ms) {
constexpr int kObjectsBeforeInterrupt = 100;
// Do not drain the marking deque in a state where we can generally not
// perform a GC. This makes sure that TraceTraits and friends find
// themselves in a well-defined environment, e.g., properly set up vtables.
......@@ -187,11 +188,13 @@ bool ScriptWrappableMarkingVisitor::AdvanceTracing(double deadline_in_ms) {
base::AutoReset<bool>(&advancing_tracing_, true);
TimeTicks deadline =
TimeTicks() + TimeDelta::FromMillisecondsD(deadline_in_ms);
while (WTF::CurrentTimeTicks() < deadline) {
if (marking_deque_.IsEmpty()) {
return true;
while (deadline.is_max() || WTF::CurrentTimeTicks() < deadline) {
for (int objects = 0; objects++ < kObjectsBeforeInterrupt;) {
if (marking_deque_.IsEmpty()) {
return true;
}
marking_deque_.TakeFirst().Trace(this);
}
marking_deque_.TakeFirst().Trace(this);
}
return 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