mirror of
https://gitee.com/openharmony/arkcompiler_ets_runtime
synced 2024-10-07 08:03:29 +00:00
!9062 Revert a part of 8662
Merge pull request !9062 from YuliCheng/RevertGrowOP
This commit is contained in:
commit
f5c1614152
@ -831,7 +831,7 @@ GateRef NewObjectStubBuilder::CopyArray(GateRef glue, GateRef elements, GateRef
|
||||
BRANCH(Int32GreaterThan(newLen, oldLen), &extendArray, ¬ExtendArray);
|
||||
Bind(&extendArray);
|
||||
{
|
||||
result = ExtendArrayCheck(glue, elements, newLen);
|
||||
result = ExtendArrayCheck(glue, elements, newLen, spaceType);
|
||||
Jump(&exit);
|
||||
}
|
||||
Bind(¬ExtendArray);
|
||||
@ -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);
|
||||
|
@ -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, ¬Shared);
|
||||
Bind(&isShared);
|
||||
{
|
||||
newElements = newBuilder.CopyArray(glue, elements, capacity, newCapacity, RegionSpaceFlag::IN_SHARED_OLD_SPACE);
|
||||
Jump(&storeElements);
|
||||
}
|
||||
Bind(¬Shared);
|
||||
{
|
||||
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();
|
||||
|
Loading…
Reference in New Issue
Block a user