diff options
Diffstat (limited to 'deps/v8/src/heap/incremental-marking-job.cc')
-rw-r--r-- | deps/v8/src/heap/incremental-marking-job.cc | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/deps/v8/src/heap/incremental-marking-job.cc b/deps/v8/src/heap/incremental-marking-job.cc index 63e47ca313f..e1979a2aeaa 100644 --- a/deps/v8/src/heap/incremental-marking-job.cc +++ b/deps/v8/src/heap/incremental-marking-job.cc @@ -4,6 +4,7 @@ #include "src/heap/incremental-marking-job.h" +#include "src/base/platform/mutex.h" #include "src/base/platform/time.h" #include "src/execution/isolate.h" #include "src/execution/vm-state-inl.h" @@ -47,15 +48,18 @@ void IncrementalMarkingJob::Start(Heap* heap) { } void IncrementalMarkingJob::ScheduleTask(Heap* heap, TaskType task_type) { - if (!IsTaskPending(task_type) && !heap->IsTearingDown()) { + base::MutexGuard guard(&mutex_); + + if (!IsTaskPending(task_type) && !heap->IsTearingDown() && + FLAG_incremental_marking_task) { v8::Isolate* isolate = reinterpret_cast<v8::Isolate*>(heap->isolate()); SetTaskPending(task_type, true); auto taskrunner = V8::GetCurrentPlatform()->GetForegroundTaskRunner(isolate); const EmbedderHeapTracer::EmbedderStackState stack_state = taskrunner->NonNestableTasksEnabled() - ? EmbedderHeapTracer::EmbedderStackState::kEmpty - : EmbedderHeapTracer::EmbedderStackState::kUnknown; + ? EmbedderHeapTracer::EmbedderStackState::kNoHeapPointers + : EmbedderHeapTracer::EmbedderStackState::kMayContainHeapPointers; auto task = std::make_unique<Task>(heap->isolate(), this, stack_state, task_type); if (task_type == TaskType::kNormal) { @@ -111,8 +115,11 @@ void IncrementalMarkingJob::Task::RunInternal() { } // Clear this flag after StartIncrementalMarking call to avoid - // scheduling a new task when startining incremental marking. - job_->SetTaskPending(task_type_, false); + // scheduling a new task when starting incremental marking. + { + base::MutexGuard guard(&job_->mutex_); + job_->SetTaskPending(task_type_, false); + } if (!incremental_marking->IsStopped()) { StepResult step_result = Step(heap); |