Index: src/heap/incremental-marking-job.cc |
diff --git a/src/heap/incremental-marking-job.cc b/src/heap/incremental-marking-job.cc |
index 393b9cce7eeace05b893679d448bfb54490261df..e441261c84bee72cdda12b8e50a4f56bd48c3345 100644 |
--- a/src/heap/incremental-marking-job.cc |
+++ b/src/heap/incremental-marking-job.cc |
@@ -19,12 +19,11 @@ void IncrementalMarkingJob::Start(Heap* heap) { |
ScheduleTask(heap); |
} |
-void IncrementalMarkingJob::NotifyTask() { task_pending_ = false; } |
+void IncrementalMarkingJob::NotifyTask() { task_pending_.SetValue(false); } |
void IncrementalMarkingJob::ScheduleTask(Heap* heap) { |
- if (!task_pending_) { |
+ if (task_pending_.TrySetValue(false, true)) { |
v8::Isolate* isolate = reinterpret_cast<v8::Isolate*>(heap->isolate()); |
- task_pending_ = true; |
auto task = new Task(heap->isolate(), this); |
V8::GetCurrentPlatform()->CallOnForegroundThread(isolate, task); |
} |