Commit 05de6ac1 authored by Ulan Degenbaev's avatar Ulan Degenbaev Committed by Commit Bot

[heap] Improve work stealing for concurrent marking

This fixes a corner case where the main thread has items in the local
segments but the global pool is empty. In such case concurrent marking
tasks are not posted and marking is performed on the main thread.

Bug: chromium:934453
Change-Id: Ic34cd4ecb59b848021d8d8b086904b415669f5e6
Reviewed-on: https://chromium-review.googlesource.com/c/1482739Reviewed-by: 's avatarMichael Lippautz <mlippautz@chromium.org>
Commit-Queue: Ulan Degenbaev <ulan@chromium.org>
Cr-Commit-Position: refs/heads/master@{#59802}
parent dab2fe6f
...@@ -1201,6 +1201,7 @@ StepResult IncrementalMarking::V8Step(double max_step_size_in_ms, ...@@ -1201,6 +1201,7 @@ StepResult IncrementalMarking::V8Step(double max_step_size_in_ms,
} }
} }
if (FLAG_concurrent_marking) { if (FLAG_concurrent_marking) {
marking_worklist()->ShareWorkIfGlobalPoolIsEmpty();
heap_->concurrent_marking()->RescheduleTasksIfNeeded(); heap_->concurrent_marking()->RescheduleTasksIfNeeded();
} }
......
...@@ -528,6 +528,12 @@ class MarkCompactCollector final : public MarkCompactCollectorBase { ...@@ -528,6 +528,12 @@ class MarkCompactCollector final : public MarkCompactCollectorBase {
embedder_.Update(callback); embedder_.Update(callback);
} }
void ShareWorkIfGlobalPoolIsEmpty() {
if (!shared_.IsLocalEmpty(kMainThread) && shared_.IsGlobalPoolEmpty()) {
shared_.FlushToGlobal(kMainThread);
}
}
ConcurrentMarkingWorklist* shared() { return &shared_; } ConcurrentMarkingWorklist* shared() { return &shared_; }
ConcurrentMarkingWorklist* on_hold() { return &on_hold_; } ConcurrentMarkingWorklist* on_hold() { return &on_hold_; }
EmbedderTracingWorklist* embedder() { return &embedder_; } EmbedderTracingWorklist* embedder() { return &embedder_; }
......
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