From bf696e4b7539d25e1e91809a73cb636f71202a99 Mon Sep 17 00:00:00 2001 From: Artem Udovichenko Date: Thu, 28 Jul 2022 19:52:17 +0300 Subject: [PATCH] Make mutator_lock VM-specific Change-Id: Ic8fba5882e07fd6b9f140ebf17175c0f62744e65 Signed-off-by: Artem Udovichenko --- runtime/ecma_vm.cpp | 10 +++++----- runtime/ecma_vm.h | 7 +++++-- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/runtime/ecma_vm.cpp b/runtime/ecma_vm.cpp index 969c9c3ba..ffe2ea6df 100644 --- a/runtime/ecma_vm.cpp +++ b/runtime/ecma_vm.cpp @@ -85,7 +85,7 @@ JSRuntimeOptions EcmaVM::options_; // NOLINT(fuchsia-statically-constructed-obj void EcmaRendezvous::SafepointBegin() { - ASSERT(!Locks::mutator_lock->HasLock()); + ASSERT(!GetMutatorLock()->HasLock()); LOG(DEBUG, GC) << "Rendezvous: SafepointBegin"; Thread *current = Thread::GetCurrent(); ManagedThread *main_thread = current->GetVM()->GetAssociatedThread(); @@ -94,15 +94,15 @@ void EcmaRendezvous::SafepointBegin() main_thread->SuspendImpl(true); } // Acquire write MutatorLock - Locks::mutator_lock->WriteLock(); + GetMutatorLock()->WriteLock(); } void EcmaRendezvous::SafepointEnd() { - ASSERT(Locks::mutator_lock->HasLock()); + ASSERT(GetMutatorLock()->HasLock()); LOG(DEBUG, GC) << "Rendezvous: SafepointEnd"; // Release write MutatorLock - Locks::mutator_lock->Unlock(); + GetMutatorLock()->Unlock(); Thread *current = Thread::GetCurrent(); ManagedThread *main_thread = current->GetVM()->GetAssociatedThread(); if (current != main_thread) { @@ -190,7 +190,7 @@ EcmaVM::EcmaVM(JSRuntimeOptions options) options_ = std::move(options); icEnable_ = options_.IsIcEnable(); optionalLogEnabled_ = options_.IsEnableOptionalLog(); - rendezvous_ = chunk_.New(); + rendezvous_ = chunk_.New(this); snapshotSerializeEnable_ = options_.IsSnapshotSerializeEnabled(); if (!snapshotSerializeEnable_) { snapshotDeserializeEnable_ = options_.IsSnapshotDeserializeEnabled(); diff --git a/runtime/ecma_vm.h b/runtime/ecma_vm.h index f44fcf5d4..ab2f47a8d 100644 --- a/runtime/ecma_vm.h +++ b/runtime/ecma_vm.h @@ -82,8 +82,11 @@ using HostPromiseRejectionTracker = void (*)(const EcmaVM *vm, const JSHandle