mirror of
https://gitee.com/openharmony/arkcompiler_ets_runtime
synced 2024-11-24 02:30:03 +00:00
Revert "Revert "!7663 opt callruntime IsElementsKindSwitchOn""
This reverts commit 092dee000e
.
Signed-off-by: wupengyong <wupengyong@huawei.com>
Change-Id: Id6b80dc82ee7bd640c6827e1a383a46ef8bb0b78
This commit is contained in:
parent
5da511df00
commit
8e309bcddf
@ -1822,8 +1822,8 @@ void BuiltinsArrayStubBuilder::Reverse(GateRef glue, GateRef thisValue, [[maybe_
|
||||
GateRef elementsKindIntUB = Int32LessThanOrEqual(kind,
|
||||
Int32(static_cast<int32_t>(ElementsKind::HOLE_INT)));
|
||||
GateRef checkIntKind = BoolAnd(elementsKindIntLB, elementsKindIntUB);
|
||||
GateRef isElementsKindEnabled = CallRuntime(glue, RTSTUB_ID(IsElementsKindSwitchOn), {});
|
||||
BRANCH(BoolAnd(checkIntKind, TaggedIsTrue(isElementsKindEnabled)), &isInt, &isNotInt);
|
||||
GateRef isElementsKindEnabled = IsEnableElementsKind(glue);
|
||||
BRANCH(BoolAnd(checkIntKind, isElementsKindEnabled), &isInt, &isNotInt);
|
||||
Bind(&isInt);
|
||||
{
|
||||
FastReverse(glue, thisValue, thisArrLen, ElementsKind::INT, result, exit);
|
||||
@ -1837,7 +1837,7 @@ void BuiltinsArrayStubBuilder::Reverse(GateRef glue, GateRef thisValue, [[maybe_
|
||||
GateRef elementsKindNumberUB = Int32LessThanOrEqual(kind,
|
||||
Int32(static_cast<int32_t>(ElementsKind::HOLE_NUMBER)));
|
||||
GateRef checkNumberKind = BoolAnd(elementsKindNumberLB, elementsKindNumberUB);
|
||||
BRANCH(BoolAnd(checkNumberKind, TaggedIsTrue(isElementsKindEnabled)), &isNumber, &isNotNumber);
|
||||
BRANCH(BoolAnd(checkNumberKind, isElementsKindEnabled), &isNumber, &isNotNumber);
|
||||
Bind(&isNumber);
|
||||
{
|
||||
FastReverse(glue, thisValue, thisArrLen, ElementsKind::NUMBER, result, exit);
|
||||
|
@ -76,8 +76,8 @@ GateRef NewObjectStubBuilder::NewJSArrayWithSize(GateRef hclass, GateRef size)
|
||||
Label enabledElementsKind(env);
|
||||
Label notEmptyArray(env);
|
||||
Label initObj(env);
|
||||
GateRef isElementsKindEnabled = CallRuntime(glue_, RTSTUB_ID(IsElementsKindSwitchOn), {});
|
||||
BRANCH(TaggedIsTrue(isElementsKindEnabled), &enabledElementsKind, &initObj);
|
||||
GateRef isElementsKindEnabled = IsEnableElementsKind(glue_);
|
||||
BRANCH(isElementsKindEnabled, &enabledElementsKind, &initObj);
|
||||
Bind(&enabledElementsKind);
|
||||
{
|
||||
// For new Array(Len), the elementsKind should be Hole
|
||||
|
@ -3165,6 +3165,12 @@ inline GateRef StubBuilder::GetSingleCharTable(GateRef glue)
|
||||
VariableType::JS_POINTER(), glue, ConstantIndex::SINGLE_CHAR_TABLE_INDEX);
|
||||
}
|
||||
|
||||
inline GateRef StubBuilder::IsEnableElementsKind(GateRef glue)
|
||||
{
|
||||
GateRef offset = IntPtr(JSThread::GlueData::GetIsEnableElementsKindOffset(env_->Is32Bit()));
|
||||
return Load(VariableType::BOOL(), glue, offset);
|
||||
}
|
||||
|
||||
inline GateRef StubBuilder::GetGlobalEnvValue(VariableType type, GateRef env, size_t index)
|
||||
{
|
||||
auto valueIndex = IntPtr(GlobalEnv::HEADER_SIZE + JSTaggedValue::TaggedTypeSize() * index);
|
||||
|
@ -10191,8 +10191,8 @@ void StubBuilder::MigrateArrayWithKind(GateRef glue, GateRef object, GateRef old
|
||||
Label exit(env);
|
||||
|
||||
Label elementsKindOn(env);
|
||||
GateRef isElementsKindSwitchOn = CallRuntime(glue, RTSTUB_ID(IsElementsKindSwitchOn), {});
|
||||
BRANCH(TaggedIsTrue(isElementsKindSwitchOn), &elementsKindOn, &exit);
|
||||
GateRef isElementsKindEnabled = IsEnableElementsKind(glue);
|
||||
BRANCH(isElementsKindEnabled, &elementsKindOn, &exit);
|
||||
Bind(&elementsKindOn);
|
||||
|
||||
DEFVARIABLE(newElements, VariableType::JS_ANY(), Undefined());
|
||||
|
@ -840,6 +840,7 @@ public:
|
||||
inline GateRef GetGlobalConstantValue(
|
||||
VariableType type, GateRef glue, ConstantIndex index);
|
||||
inline GateRef GetSingleCharTable(GateRef glue);
|
||||
inline GateRef IsEnableElementsKind(GateRef glue);
|
||||
inline GateRef GetGlobalEnvValue(VariableType type, GateRef env, size_t index);
|
||||
GateRef CallGetterHelper(
|
||||
GateRef glue, GateRef receiver, GateRef holder, GateRef accessor, ProfileOperation callback);
|
||||
|
@ -317,9 +317,6 @@ bool EcmaVM::IsEnablePGOProfiler() const
|
||||
|
||||
bool EcmaVM::IsEnableElementsKind() const
|
||||
{
|
||||
if (options_.IsWorker()) {
|
||||
return false;
|
||||
}
|
||||
return options_.GetEnableAsmInterpreter() && options_.IsEnableElementsKind();
|
||||
}
|
||||
|
||||
|
@ -102,6 +102,7 @@ JSThread *JSThread::Create(EcmaVM *vm)
|
||||
|
||||
jsThread->glueData_.stackLimit_ = GetAsmStackLimit();
|
||||
jsThread->glueData_.stackStart_ = GetCurrentStackPosition();
|
||||
jsThread->glueData_.isEnableElementsKind_ = vm->IsEnableElementsKind();
|
||||
jsThread->SetThreadId();
|
||||
jsThread->SetWorker(vm->GetJSOptions().IsWorker());
|
||||
|
||||
|
@ -978,7 +978,8 @@ public:
|
||||
base::AlignedPointer,
|
||||
base::AlignedPointer,
|
||||
base::AlignedPointer,
|
||||
base::AlignedUint32> {
|
||||
base::AlignedUint32,
|
||||
base::AlignedBool> {
|
||||
enum class Index : size_t {
|
||||
BcStubEntriesIndex = 0,
|
||||
ExceptionIndex,
|
||||
@ -1020,6 +1021,7 @@ public:
|
||||
RandomStatePtrIndex,
|
||||
StateAndFlagsIndex,
|
||||
TaskInfoIndex,
|
||||
IsEnableElementsKindIndex,
|
||||
NumOfMembers
|
||||
};
|
||||
static_assert(static_cast<size_t>(Index::NumOfMembers) == NumOfTypes);
|
||||
@ -1245,6 +1247,11 @@ public:
|
||||
return GetOffset<static_cast<size_t>(Index::TaskInfoIndex)>(isArch32);
|
||||
}
|
||||
|
||||
static size_t GetIsEnableElementsKindOffset(bool isArch32)
|
||||
{
|
||||
return GetOffset<static_cast<size_t>(Index::IsEnableElementsKindIndex)>(isArch32);
|
||||
}
|
||||
|
||||
alignas(EAS) BCStubEntries bcStubEntries_ {};
|
||||
alignas(EAS) JSTaggedValue exception_ {JSTaggedValue::Hole()};
|
||||
alignas(EAS) JSTaggedValue globalObject_ {JSTaggedValue::Hole()};
|
||||
@ -1285,6 +1292,7 @@ public:
|
||||
alignas(EAS) uintptr_t randomStatePtr_ {0};
|
||||
alignas(EAS) ThreadStateAndFlags stateAndFlags_ {};
|
||||
alignas(EAS) uintptr_t taskInfo_ {0};
|
||||
alignas(EAS) bool isEnableElementsKind_ {false};
|
||||
};
|
||||
STATIC_ASSERT_EQ_ARCH(sizeof(GlueData), GlueData::SizeArch32, GlueData::SizeArch64);
|
||||
|
||||
|
@ -618,15 +618,6 @@ DEF_RUNTIME_STUBS(CopyAndUpdateObjLayout)
|
||||
return JSTaggedValue::Hole().GetRawData();
|
||||
}
|
||||
|
||||
DEF_RUNTIME_STUBS(IsElementsKindSwitchOn)
|
||||
{
|
||||
RUNTIME_STUBS_HEADER(IsElementsKindSwitchOn);
|
||||
if (thread->GetEcmaVM()->IsEnableElementsKind()) {
|
||||
return JSTaggedValue::True().GetRawData();
|
||||
}
|
||||
return JSTaggedValue::False().GetRawData();
|
||||
}
|
||||
|
||||
DEF_RUNTIME_STUBS(UpdateHClassForElementsKind)
|
||||
{
|
||||
RUNTIME_STUBS_HEADER(UpdateHClassForElementsKind);
|
||||
|
@ -254,7 +254,6 @@ using FastCallAotEntryType = JSTaggedValue (*)(uintptr_t glue, uint32_t argc, co
|
||||
V(UpdateLayOutAndAddTransition) \
|
||||
V(CopyAndUpdateObjLayout) \
|
||||
V(UpdateHClassForElementsKind) \
|
||||
V(IsElementsKindSwitchOn) \
|
||||
V(SetValueWithElementsKind) \
|
||||
V(UpdateArrayHClassAndMigrateArrayWithKind) \
|
||||
V(MigrateArrayWithKind) \
|
||||
|
Loading…
Reference in New Issue
Block a user