!9555 Fix new js error before vm initialize bug

Merge pull request !9555 from dingwen/oom_br
This commit is contained in:
openharmony_ci 2024-09-27 03:42:23 +00:00 committed by Gitee
commit 2ff5e5f214
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
2 changed files with 2 additions and 2 deletions

View File

@ -1085,11 +1085,11 @@ void Heap::CollectGarbage(TriggerGCType gcType, GCReason reason)
UNREACHABLE();
}
#endif
RecursionScope recurScope(this, HeapType::LOCAL_HEAP);
if (thread_->IsCrossThreadExecutionEnable() || GetOnSerializeEvent()) {
ProcessGCListeners();
return;
}
RecursionScope recurScope(this, HeapType::LOCAL_HEAP);
#if defined(ECMASCRIPT_SUPPORT_CPUPROFILER)
[[maybe_unused]] GcStateScope scope(thread_);
#endif

View File

@ -48,7 +48,7 @@ Region *HeapRegionAllocator::AllocateAlignedRegion(Space *space, size_t capacity
Jit::GetInstance()->IsEnableJitFort());
void *mapMem = pool.GetMem();
if (mapMem == nullptr) {
if (thread != nullptr) {
if (thread != nullptr && thread->GetEcmaVM()->IsInitialized()) {
heap->ThrowOutOfMemoryErrorForDefault(thread, DEFAULT_REGION_SIZE,
"HeapRegionAllocator::AllocateAlignedRegion", false);
}