From baf6668e16f3bb368b9f4b10f0d552bb1574df8f Mon Sep 17 00:00:00 2001 From: Reece Wilson Date: Tue, 7 Feb 2023 17:17:50 +0000 Subject: [PATCH] [+] TaskRunner::PostSignalTask Instead of chaining waitables, or checking for nested state, or blocks; these tasks are assumed to be thread-local condition variable dispatchers. Last aurora commit: 87131415 --- include/v8-platform.h | 2 ++ src/heap/collection-barrier.cc | 2 +- src/heap/heap.cc | 2 +- src/heap/safepoint.cc | 2 +- 4 files changed, 5 insertions(+), 3 deletions(-) diff --git a/include/v8-platform.h b/include/v8-platform.h index 32898e7ef9..1ab9c454f6 100644 --- a/include/v8-platform.h +++ b/include/v8-platform.h @@ -149,6 +149,8 @@ class TaskRunner { TaskRunner(const TaskRunner&) = delete; TaskRunner& operator=(const TaskRunner&) = delete; + + virtual void PostSignalTask(std::unique_ptr task) = 0; }; /** diff --git a/src/heap/collection-barrier.cc b/src/heap/collection-barrier.cc index 9486c234b0..65d1eb5645 100644 --- a/src/heap/collection-barrier.cc +++ b/src/heap/collection-barrier.cc @@ -116,7 +116,7 @@ void CollectionBarrier::ActivateStackGuardAndPostTask() { V8::GetCurrentPlatform() ->GetForegroundTaskRunner(reinterpret_cast(isolate)) - ->PostTask(std::make_unique(heap_)); + ->PostSignalTask(std::make_unique(heap_)); } void CollectionBarrier::StopTimeToCollectionTimer() { diff --git a/src/heap/heap.cc b/src/heap/heap.cc index 8911bd96c3..c58fbee30f 100644 --- a/src/heap/heap.cc +++ b/src/heap/heap.cc @@ -4114,7 +4114,7 @@ void Heap::MemoryPressureNotification(MemoryPressureLevel level, isolate()->stack_guard()->RequestGC(); auto taskrunner = V8::GetCurrentPlatform()->GetForegroundTaskRunner( reinterpret_cast(isolate())); - taskrunner->PostTask(std::make_unique(this)); + taskrunner->PostSignalTask(std::make_unique(this)); } } } diff --git a/src/heap/safepoint.cc b/src/heap/safepoint.cc index 7c901a6e6e..c705f64e5c 100644 --- a/src/heap/safepoint.cc +++ b/src/heap/safepoint.cc @@ -115,7 +115,7 @@ void IsolateSafepoint::InitiateGlobalSafepointScopeRaw( // wake it up. V8::GetCurrentPlatform() ->GetForegroundTaskRunner(reinterpret_cast(isolate())) - ->PostTask(std::make_unique(heap_)); + ->PostSignalTask(std::make_unique(heap_)); // Request an interrupt in case of long-running code. isolate()->stack_guard()->RequestGlobalSafepoint();