Commit cc14c706 authored by Omer Katz's avatar Omer Katz Committed by Commit Bot

heap: Fix oilpan marking deadline during v8 steps

Bug: chromium:986235
Change-Id: If7c990dd143fd5331d264dcf2c5349525d1321b2
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2187731
Commit-Queue: Omer Katz <omerkatz@chromium.org>
Reviewed-by: 's avatarUlan Degenbaev <ulan@chromium.org>
Reviewed-by: 's avatarMichael Lippautz <mlippautz@chromium.org>
Cr-Commit-Position: refs/heads/master@{#67652}
parent ef2f1675
......@@ -706,34 +706,33 @@ StepResult IncrementalMarking::EmbedderStep(double expected_duration_ms,
return StepResult::kNoImmediateWork;
}
constexpr size_t kObjectsToProcessBeforeInterrupt = 500;
constexpr size_t kObjectsToProcessBeforeDeadlineCheck = 500;
TRACE_GC(heap()->tracer(), GCTracer::Scope::MC_INCREMENTAL_EMBEDDER_TRACING);
LocalEmbedderHeapTracer* local_tracer = heap_->local_embedder_heap_tracer();
const double start = heap_->MonotonicallyIncreasingTimeInMs();
const double deadline = start + expected_duration_ms;
double current;
bool empty_worklist;
bool remote_tracing_done = false;
do {
{
LocalEmbedderHeapTracer::ProcessingScope scope(local_tracer);
HeapObject object;
size_t cnt = 0;
empty_worklist = true;
while (marking_worklists()->PopEmbedder(&object)) {
scope.TracePossibleWrapper(JSObject::cast(object));
if (++cnt == kObjectsToProcessBeforeInterrupt) {
cnt = 0;
{
LocalEmbedderHeapTracer::ProcessingScope scope(local_tracer);
HeapObject object;
size_t cnt = 0;
empty_worklist = true;
while (marking_worklists()->PopEmbedder(&object)) {
scope.TracePossibleWrapper(JSObject::cast(object));
if (++cnt == kObjectsToProcessBeforeDeadlineCheck) {
if (deadline <= heap_->MonotonicallyIncreasingTimeInMs()) {
empty_worklist = false;
break;
}
cnt = 0;
}
}
remote_tracing_done = local_tracer->Trace(deadline);
current = heap_->MonotonicallyIncreasingTimeInMs();
} while (!empty_worklist && !remote_tracing_done && (current < deadline));
local_tracer->SetEmbedderWorklistEmpty(empty_worklist);
}
bool remote_tracing_done =
local_tracer->Trace(deadline - heap_->MonotonicallyIncreasingTimeInMs());
double current = heap_->MonotonicallyIncreasingTimeInMs();
local_tracer->SetEmbedderWorklistEmpty(true);
*duration_ms = current - start;
return (empty_worklist && remote_tracing_done)
? StepResult::kNoImmediateWork
......
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