From e3f25033695046765da057f5d0bad5cb654e8f07 Mon Sep 17 00:00:00 2001 From: Aleksandr Emelenko Date: Tue, 21 Mar 2023 15:16:02 +0300 Subject: [PATCH] Create a method which will be called in mutator after GC finished (will be used in the finalization routine) Change-Id: I5b03f0bc6a7bdf1af3d127246758a1878d37e138 Signed-off-by: Aleksandr Emelenko --- runtime/ecma_vm.cpp | 7 +++---- runtime/ecma_vm.h | 2 +- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/runtime/ecma_vm.cpp b/runtime/ecma_vm.cpp index 2e496f896..262bd50eb 100644 --- a/runtime/ecma_vm.cpp +++ b/runtime/ecma_vm.cpp @@ -789,12 +789,11 @@ void EcmaVM::ProcessReferences(const WeakRootVisitor &v0) } } -void EcmaVM::HandleEnqueueReferences() +void EcmaVM::HandleGCRoutineInMutator() { // Handle references only in JS thread - if (Thread::GetCurrent() != thread_) { - return; - } + ASSERT(Thread::GetCurrent() == thread_); + ASSERT(GetMutatorLock()->HasLock()); [[maybe_unused]] EcmaHandleScope scope(thread_); for (JSFinalizationRegistry *registry : finalization_registries_) { JSHandle handle(thread_, registry); diff --git a/runtime/ecma_vm.h b/runtime/ecma_vm.h index 1a83220cb..ea77d595b 100644 --- a/runtime/ecma_vm.h +++ b/runtime/ecma_vm.h @@ -377,7 +377,7 @@ public: void CollectGarbage() const; void ProcessReferences(const WeakRootVisitor &v0); - void HandleEnqueueReferences() override; + void HandleGCRoutineInMutator() override; JSHandle GetModuleByName(JSHandle module_name); -- Gitee