Commit 4602aee5 authored by Anton Bikineev's avatar Anton Bikineev Committed by V8 LUCI CQ

cppgc: young-gen: Run minor GC only from task.

Oilpan minor GC currently doesn't support running with the stack. The CL
changes minor GCs to run only when running from task.

Bug: chromium:1029379
Change-Id: I96552772e9c3b653a137f48bbaae44278db8f014
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3571891Reviewed-by: 's avatarMichael Lippautz <mlippautz@chromium.org>
Commit-Queue: Anton Bikineev <bikineev@chromium.org>
Cr-Commit-Position: refs/heads/main@{#79800}
parent e220866e
......@@ -2348,7 +2348,11 @@ size_t Heap::PerformGarbageCollection(
local_embedder_heap_tracer()->TraceEpilogue();
}
if (collector == GarbageCollector::SCAVENGER && cpp_heap()) {
// Schedule Oilpan's Minor GC. Since the minor GC doesn't support conservative
// stack scanning, do it only when Scavenger runs from task, which is
// non-nestable.
if (cpp_heap() && collector == GarbageCollector::SCAVENGER &&
gc_reason == GarbageCollectionReason::kTask) {
CppHeap::From(cpp_heap())->RunMinorGC();
}
......
......@@ -43,8 +43,11 @@ void ScavengeJob::ScheduleTaskIfNeeded(Heap* heap) {
v8::Isolate* isolate = reinterpret_cast<v8::Isolate*>(heap->isolate());
auto taskrunner =
V8::GetCurrentPlatform()->GetForegroundTaskRunner(isolate);
taskrunner->PostTask(std::make_unique<Task>(heap->isolate(), this));
task_pending_ = true;
if (taskrunner->NonNestableTasksEnabled()) {
taskrunner->PostNonNestableTask(
std::make_unique<Task>(heap->isolate(), this));
task_pending_ = true;
}
}
}
......
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