Commit 63a338a1 authored by Ali Ijaz Sheikh's avatar Ali Ijaz Sheikh Committed by Commit Bot

[heap] schedule tasks only when enabled

Incremental marking job and concurrent marking tasks may be triggered
during heap tear down. The task scheduler may already be torn down at
this point. Avoid scheduling new tasks if tasks are disabled.

Bug: v8:7238
Change-Id: I3869a20dc8b4f38b26754872448952a9aadb6bd9
Reviewed-on: https://chromium-review.googlesource.com/868825Reviewed-by: 's avatarUlan Degenbaev <ulan@chromium.org>
Commit-Queue: Ali Ijaz Sheikh <ofrobots@google.com>
Cr-Commit-Position: refs/heads/master@{#50641}
parent 9bc4e560
......@@ -514,6 +514,7 @@ void ConcurrentMarking::Run(int task_id, TaskState* task_state) {
}
void ConcurrentMarking::ScheduleTasks() {
DCHECK(heap_->use_tasks());
if (!FLAG_concurrent_marking) return;
base::LockGuard<base::Mutex> guard(&pending_lock_);
if (task_count_ == 0) {
......@@ -542,7 +543,7 @@ void ConcurrentMarking::ScheduleTasks() {
}
void ConcurrentMarking::RescheduleTasksIfNeeded() {
if (!FLAG_concurrent_marking) return;
if (!FLAG_concurrent_marking || !heap_->use_tasks()) return;
{
base::LockGuard<base::Mutex> guard(&pending_lock_);
if (pending_task_count_ > 0) return;
......
......@@ -21,7 +21,7 @@ void IncrementalMarkingJob::Start(Heap* heap) {
}
void IncrementalMarkingJob::ScheduleTask(Heap* heap) {
if (!task_pending_) {
if (!task_pending_ && heap->use_tasks()) {
v8::Isolate* isolate = reinterpret_cast<v8::Isolate*>(heap->isolate());
task_pending_ = true;
auto task = new Task(heap->isolate(), this);
......
......@@ -420,7 +420,7 @@ void IncrementalMarking::StartMarking() {
IncrementalMarkingRootMarkingVisitor visitor(this);
heap_->IterateStrongRoots(&visitor, VISIT_ONLY_STRONG);
if (FLAG_concurrent_marking) {
if (FLAG_concurrent_marking && heap_->use_tasks()) {
heap_->concurrent_marking()->ScheduleTasks();
}
......
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