Files
ark_js_runtime/ecmascript/runtime_api.cpp
T
yingguofeng@huawei.com ef9b13734d Performance optimization for gc
1、Optimize GC parallel evacate strategy: evacuate to old space with FreeListAllocator.
2、Adjust strategy that whole region evacuate: Only support new fromspace to new tospace.
3、Adjust Semi space capacity growing/shrinking strategy and Adjust Semi space initialize size.

splay-benchmark:
blue zone: ark_js(2500), v8(2000)
ark-dev:  ark(1200), v8(1500)

issue:https://gitee.com/openharmony/ark_js_runtime/issues/I4SASV?from=project-issue

Signed-off-by: yingguofeng@huawei.com <yingguofeng@huawei.com>
Change-Id: Ie9c6e94c47f531bf9c1ebf5bc7443dd1acb7d2ac
2022-02-15 14:23:43 +08:00

40 lines
1.5 KiB
C++

/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "ecmascript/runtime_api.h"
#include "ecmascript/mem/parallel_work_helper.h"
namespace panda::ecmascript {
void RuntimeApi::MarkObject(uintptr_t slotAddr, Region *objectRegion, TaggedObject *value, Region *valueRegion)
{
auto heap = valueRegion->GetHeap();
bool isFullMark = heap->IsFullMark();
if (!JSTaggedValue(value).IsWeakForHeapObject()) {
if (!isFullMark && !valueRegion->InYoungGeneration()) {
return;
}
auto valueBitmap = valueRegion->GetMarkBitmap();
if (!valueBitmap->AtomicTestAndSet(value)) {
valueRegion->GetWorkList()->Push(0, value, valueRegion);
}
}
if (isFullMark && valueRegion->InCollectSet() && !objectRegion->InYoungOrCSetGeneration()) {
auto set = objectRegion->GetOrCreateCrossRegionRememberedSet();
set->AtomicInsert(slotAddr);
}
}
} // namespace panda::tooling::ecmascript