!8866 Remove jit lockholder in shared

Merge pull request !8866 from xiongluo/remove_jit_lock_shared
This commit is contained in:
openharmony_ci 2024-09-04 10:31:56 +00:00 committed by Gitee
commit 5322193b0b
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F

View File

@ -435,15 +435,11 @@ void SharedHeap::Prepare(bool inTriggerGCThread)
SharedHeap::SharedGCScope::SharedGCScope()
{
bool enableJit = Jit::GetInstance()->IsEnableFastJit() || Jit::GetInstance()->IsEnableBaselineJit();
Runtime::GetInstance()->GCIterateThreadList([enableJit](JSThread *thread) {
Runtime::GetInstance()->GCIterateThreadList([](JSThread *thread) {
std::shared_ptr<pgo::PGOProfiler> pgoProfiler = thread->GetEcmaVM()->GetPGOProfiler();
if (pgoProfiler != nullptr) {
pgoProfiler->SuspendByGC();
}
if (enableJit) {
Jit::JitGCLockHolder::LockJit(thread);
}
#if defined(ECMASCRIPT_SUPPORT_CPUPROFILER)
thread->SetGcState(true);
#endif
@ -452,17 +448,13 @@ SharedHeap::SharedGCScope::SharedGCScope()
SharedHeap::SharedGCScope::~SharedGCScope()
{
bool enableJit = Jit::GetInstance()->IsEnableFastJit() || Jit::GetInstance()->IsEnableBaselineJit();
Runtime::GetInstance()->GCIterateThreadList([enableJit](JSThread *thread) {
Runtime::GetInstance()->GCIterateThreadList([](JSThread *thread) {
ASSERT(!thread->IsInRunningState());
const_cast<Heap *>(thread->GetEcmaVM()->GetHeap())->ProcessGCListeners();
std::shared_ptr<pgo::PGOProfiler> pgoProfiler = thread->GetEcmaVM()->GetPGOProfiler();
if (pgoProfiler != nullptr) {
pgoProfiler->ResumeByGC();
}
if (enableJit) {
Jit::JitGCLockHolder::UnlockJit(thread);
}
#if defined(ECMASCRIPT_SUPPORT_CPUPROFILER)
thread->SetGcState(false);
#endif