Commit ba37a5f6 authored by Gabriel Charette's avatar Gabriel Charette Committed by Commit Bot

Add DCHECKs to confirm there are no pending tasks when calling ConcurrentMarking::ScheduleTasks()

This was extracted from https://chromium-review.googlesource.com/c/v8/v8/+/924073/7
in an attempt to isolate hard-to-diagnose bots-only failures there.

Bug: chromium:812178
Change-Id: I980b25ec7d775b74ade75e9166806740b93eea8e
Reviewed-on: https://chromium-review.googlesource.com/924026Reviewed-by: 's avatarMichael Lippautz <mlippautz@chromium.org>
Commit-Queue: Gabriel Charette <gab@chromium.org>
Cr-Commit-Position: refs/heads/master@{#51349}
parent 330fa940
...@@ -509,6 +509,7 @@ void ConcurrentMarking::ScheduleTasks() { ...@@ -509,6 +509,7 @@ void ConcurrentMarking::ScheduleTasks() {
DCHECK(heap_->use_tasks()); DCHECK(heap_->use_tasks());
if (!FLAG_concurrent_marking) return; if (!FLAG_concurrent_marking) return;
base::LockGuard<base::Mutex> guard(&pending_lock_); base::LockGuard<base::Mutex> guard(&pending_lock_);
DCHECK_EQ(0, pending_task_count_);
if (task_count_ == 0) { if (task_count_ == 0) {
// TODO(ulan): Increase the number of tasks for platforms that benefit // TODO(ulan): Increase the number of tasks for platforms that benefit
// from it. // from it.
...@@ -520,7 +521,7 @@ void ConcurrentMarking::ScheduleTasks() { ...@@ -520,7 +521,7 @@ void ConcurrentMarking::ScheduleTasks() {
task_count_ = Max(Min(task_count_, kMaxTasks), 1); task_count_ = Max(Min(task_count_, kMaxTasks), 1);
} }
// Task id 0 is for the main thread. // Task id 0 is for the main thread.
for (int i = 1; i <= task_count_ && pending_task_count_ < task_count_; i++) { for (int i = 1; i <= task_count_; i++) {
if (!is_pending_[i]) { if (!is_pending_[i]) {
if (FLAG_trace_concurrent_marking) { if (FLAG_trace_concurrent_marking) {
heap_->isolate()->PrintWithTimestamp( heap_->isolate()->PrintWithTimestamp(
...@@ -535,6 +536,7 @@ void ConcurrentMarking::ScheduleTasks() { ...@@ -535,6 +536,7 @@ void ConcurrentMarking::ScheduleTasks() {
task, v8::Platform::kShortRunningTask); task, v8::Platform::kShortRunningTask);
} }
} }
DCHECK_EQ(task_count_, pending_task_count_);
} }
void ConcurrentMarking::RescheduleTasksIfNeeded() { void ConcurrentMarking::RescheduleTasksIfNeeded() {
......
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