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);
|
BRANCH(Int32GreaterThan(newLen, oldLen), &extendArray, ¬ExtendArray);
|
||||||
Bind(&extendArray);
|
Bind(&extendArray);
|
||||||
{
|
{
|
||||||
result = ExtendArrayCheck(glue, elements, newLen);
|
result = ExtendArrayCheck(glue, elements, newLen, spaceType);
|
||||||
Jump(&exit);
|
Jump(&exit);
|
||||||
}
|
}
|
||||||
Bind(¬ExtendArray);
|
Bind(¬ExtendArray);
|
||||||
@ -844,29 +844,13 @@ GateRef NewObjectStubBuilder::CopyArray(GateRef glue, GateRef elements, GateRef
|
|||||||
BRANCH(checkIsMutantTaggedArray, &isMutantTaggedArray, &isNotMutantTaggedArray);
|
BRANCH(checkIsMutantTaggedArray, &isMutantTaggedArray, &isNotMutantTaggedArray);
|
||||||
Bind(&isMutantTaggedArray);
|
Bind(&isMutantTaggedArray);
|
||||||
{
|
{
|
||||||
size_ = ComputeTaggedArraySize(ZExtInt32ToPtr(newLen));
|
array = newBuilder.NewMutantTaggedArray(glue, newLen);
|
||||||
Label afterAllocate(env);
|
Jump(&afterInitializeElements);
|
||||||
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);
|
|
||||||
}
|
}
|
||||||
Bind(&isNotMutantTaggedArray);
|
Bind(&isNotMutantTaggedArray);
|
||||||
{
|
{
|
||||||
size_ = ComputeTaggedArraySize(ZExtInt32ToPtr(newLen));
|
array = newBuilder.NewTaggedArray(glue, newLen);
|
||||||
// Be careful. NO GC is allowed when initization is not complete.
|
Jump(&afterInitializeElements);
|
||||||
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);
|
|
||||||
}
|
}
|
||||||
Bind(&afterInitializeElements);
|
Bind(&afterInitializeElements);
|
||||||
Store(VariableType::INT32(), glue, *array, IntPtr(TaggedArray::LENGTH_OFFSET), newLen);
|
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();
|
auto env = GetEnvironment();
|
||||||
Label subEntry(env);
|
Label subEntry(env);
|
||||||
Label isShared(env);
|
|
||||||
Label notShared(env);
|
|
||||||
Label storeElements(env);
|
|
||||||
env->SubCfgEntry(&subEntry);
|
env->SubCfgEntry(&subEntry);
|
||||||
DEFVARIABLE(newElements, VariableType::JS_ANY(), Hole());
|
DEFVARIABLE(newElements, VariableType::JS_ANY(), Hole());
|
||||||
NewObjectStubBuilder newBuilder(this);
|
NewObjectStubBuilder newBuilder(this);
|
||||||
GateRef newCapacity = ComputeElementCapacity(capacity);
|
GateRef newCapacity = ComputeElementCapacity(capacity);
|
||||||
GateRef elements = GetElementsArray(receiver);
|
GateRef elements = GetElementsArray(receiver);
|
||||||
Branch(IsJSShared(elements), &isShared, ¬Shared);
|
newElements = newBuilder.CopyArray(glue, elements, capacity, newCapacity);
|
||||||
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);
|
|
||||||
SetElementsArray(VariableType::JS_POINTER(), glue, receiver, *newElements);
|
SetElementsArray(VariableType::JS_POINTER(), glue, receiver, *newElements);
|
||||||
auto ret = *newElements;
|
auto ret = *newElements;
|
||||||
env->SubCfgExit();
|
env->SubCfgExit();
|
||||||
|
Loading…
Reference in New Issue
Block a user