!9568 修复触发ConcurrentMark后立刻触发GC

Merge pull request !9568 from chentianyu/cherry-pick-1707377460
This commit is contained in:
openharmony_ci 2024-10-06 10:25:21 +00:00 committed by Gitee
commit 0bab4907f1
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
2 changed files with 4 additions and 1 deletions

View File

@ -60,8 +60,9 @@ uintptr_t LinearSpace::Allocate(size_t size, bool isPromoted)
} else {
size_t stepOverShootSize = localHeap_->GetEcmaParamConfiguration().GetSemiSpaceStepOvershootSize();
size_t maxOverShootSize = std::max(initialCapacity_ / 2, stepOverShootSize); // 2: half
if (overShootSize_ < maxOverShootSize) {
if (overShootSizeForConcurrentMark_ < maxOverShootSize) {
overShootSize_ += stepOverShootSize;
overShootSizeForConcurrentMark_ += stepOverShootSize;
}
}
@ -354,6 +355,7 @@ void SemiSpace::Initialize()
void SemiSpace::Restart(size_t overShootSize)
{
overShootSize_ = overShootSize;
overShootSizeForConcurrentMark_ = 0;
survivalObjectSize_ = 0;
allocateAfterLastGC_ = 0;
Initialize();

View File

@ -67,6 +67,7 @@ protected:
JSThread *thread_ {nullptr};
BumpPointerAllocator allocator_;
size_t overShootSize_ {0};
size_t overShootSizeForConcurrentMark_ {0};
size_t allocateAfterLastGC_ {0};
size_t survivalObjectSize_ {0};
uintptr_t waterLine_ {0};