[d8] Park thread before blocking in semaphore

We need to park the isolate's main thread before blocking in the
semaphore to allow a shared GC to happen in the meantime.

Bug: v8:11708, v8:12647
Change-Id: Ide215d2c811caee84663d8749b7d94a414c44bd8
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3485678
Auto-Submit: Dominik Inführ <dinfuehr@chromium.org>
Reviewed-by: Camillo Bruni <cbruni@chromium.org>
Commit-Queue: Camillo Bruni <cbruni@chromium.org>
Cr-Commit-Position: refs/heads/main@{#79261}
This commit is contained in:
Dominik Inführ 2022-02-23 22:47:47 +01:00 committed by V8 LUCI CQ
parent a1b206dd2b
commit 17b3a623d7

View File

@ -4010,7 +4010,11 @@ void SourceGroup::ExecuteInThread() {
Shell::Initialize(isolate, &console, false);
for (int i = 0; i < Shell::options.stress_runs; ++i) {
next_semaphore_.Wait();
{
i::ParkedScope parked_scope(
reinterpret_cast<i::Isolate*>(isolate)->main_thread_local_isolate());
next_semaphore_.Wait();
}
{
Isolate::Scope iscope(isolate);
PerIsolateData data(isolate);