Revert some code of 8662

Revert some code of 8662

Issue:     https://gitee.com/openharmony/arkcompiler_ets_runtime/issues/IAO7OR
Signed-off-by: yulicheng <chengyuli1@huawei.com>
This commit is contained in:
YuliCheng 2024-09-02 17:15:00 +08:00
parent 810340b0a8
commit 42a1f2b2e3
2 changed files with 6 additions and 36 deletions

View File

@ -831,7 +831,7 @@ GateRef NewObjectStubBuilder::CopyArray(GateRef glue, GateRef elements, GateRef
BRANCH(Int32GreaterThan(newLen, oldLen), &extendArray, &notExtendArray);
Bind(&extendArray);
{
result = ExtendArrayCheck(glue, elements, newLen);
result = ExtendArrayCheck(glue, elements, newLen, spaceType);
Jump(&exit);
}
Bind(&notExtendArray);
@ -844,29 +844,13 @@ GateRef NewObjectStubBuilder::CopyArray(GateRef glue, GateRef elements, GateRef
BRANCH(checkIsMutantTaggedArray, &isMutantTaggedArray, &isNotMutantTaggedArray);
Bind(&isMutantTaggedArray);
{
size_ = ComputeTaggedArraySize(ZExtInt32ToPtr(newLen));
Label afterAllocate(env);
auto hclass = GetGlobalConstantValue(
VariableType::JS_POINTER(), glue_, ConstantIndex::MUTANT_TAGGED_ARRAY_CLASS_INDEX);
// Be careful. NO GC is allowed when initization is not complete.
HeapAlloc(&array, &afterAllocate, spaceType, hclass);
Bind(&afterAllocate);
StoreHClass(glue_, *array, hclass);
InitializeTaggedArrayWithSpeicalValue(&afterInitializeElements,
*array, SpecialHole(), Int32(0), newLen);
array = newBuilder.NewMutantTaggedArray(glue, newLen);
Jump(&afterInitializeElements);
}
Bind(&isNotMutantTaggedArray);
{
size_ = ComputeTaggedArraySize(ZExtInt32ToPtr(newLen));
// Be careful. NO GC is allowed when initization is not complete.
Label afterAllocate(env);
auto hclass = GetGlobalConstantValue(
VariableType::JS_POINTER(), glue_, ConstantIndex::ARRAY_CLASS_INDEX);
HeapAlloc(&array, &afterAllocate, spaceType, hclass);
Bind(&afterAllocate);
StoreBuiltinHClass(glue_, *array, hclass);
InitializeTaggedArrayWithSpeicalValue(&afterInitializeElements,
*array, Hole(), Int32(0), newLen);
array = newBuilder.NewTaggedArray(glue, newLen);
Jump(&afterInitializeElements);
}
Bind(&afterInitializeElements);
Store(VariableType::INT32(), glue, *array, IntPtr(TaggedArray::LENGTH_OFFSET), newLen);

View File

@ -3883,26 +3883,12 @@ GateRef StubBuilder::GrowElementsCapacity(GateRef glue, GateRef receiver, GateRe
{
auto env = GetEnvironment();
Label subEntry(env);
Label isShared(env);
Label notShared(env);
Label storeElements(env);
env->SubCfgEntry(&subEntry);
DEFVARIABLE(newElements, VariableType::JS_ANY(), Hole());
NewObjectStubBuilder newBuilder(this);
GateRef newCapacity = ComputeElementCapacity(capacity);
GateRef elements = GetElementsArray(receiver);
Branch(IsJSShared(elements), &isShared, &notShared);
Bind(&isShared);
{
newElements = newBuilder.CopyArray(glue, elements, capacity, newCapacity, RegionSpaceFlag::IN_SHARED_OLD_SPACE);
Jump(&storeElements);
}
Bind(&notShared);
{
newElements = newBuilder.CopyArray(glue, elements, capacity, newCapacity, RegionSpaceFlag::IN_YOUNG_SPACE);
Jump(&storeElements);
}
Bind(&storeElements);
newElements = newBuilder.CopyArray(glue, elements, capacity, newCapacity);
SetElementsArray(VariableType::JS_POINTER(), glue, receiver, *newElements);
auto ret = *newElements;
env->SubCfgExit();