mirror of
https://github.com/openharmony/ark_js_runtime.git
synced 2026-08-27 20:40:01 -04:00
!449 Add LdObjByIndex, StObjByIndex, StOwnByIndex stub
* Add LdObjByIndex, StObjByIndex, StOwnByIndex stub.
This commit is contained in:
@@ -89,6 +89,9 @@ namespace panda::ecmascript::kungfu {
|
||||
V(StOwnByValue, 4) \
|
||||
V(LdSuperByValue, 4) \
|
||||
V(StSuperByValue, 5) \
|
||||
V(LdObjByIndex, 5) \
|
||||
V(StObjByIndex, 4) \
|
||||
V(StOwnByIndex, 4) \
|
||||
V(ResolveClass, 6) \
|
||||
V(CloneClassFromTemplate, 5) \
|
||||
V(SetClassConstructorLength, 3) \
|
||||
|
||||
@@ -881,6 +881,7 @@ DECLARE_ASM_HANDLER(HandleInstanceOfDynPrefV8)
|
||||
DECLARE_ASM_HANDLER(HandleStrictNotEqDynPrefV8)
|
||||
{
|
||||
DEFVARIABLE(varAcc, MachineType::TAGGED, acc);
|
||||
|
||||
GateRef v0 = ReadInst8_1(pc);
|
||||
GateRef left = GetVregValue(sp, ZExtInt8ToPtr(v0));
|
||||
StubDescriptor *fastStrictNotEqual = GET_STUBDESCRIPTOR(FastStrictNotEqual);
|
||||
@@ -1004,6 +1005,7 @@ DECLARE_ASM_HANDLER(HandleGetNextPropNamePrefV8)
|
||||
DECLARE_ASM_HANDLER(HandleThrowIfNotObjectPrefV8)
|
||||
{
|
||||
auto env = GetEnvironment();
|
||||
|
||||
GateRef v0 = ReadInst8_1(pc);
|
||||
GateRef value = GetVregValue(sp, ZExtInt8ToPtr(v0));
|
||||
Label isEcmaObject(env);
|
||||
@@ -1196,6 +1198,7 @@ DECLARE_ASM_HANDLER(HandleAsyncFunctionAwaitUncaughtPrefV8V8)
|
||||
DECLARE_ASM_HANDLER(HandleThrowUndefinedIfHolePrefV8V8)
|
||||
{
|
||||
auto env = GetEnvironment();
|
||||
|
||||
GateRef v0 = ReadInst8_1(pc);
|
||||
GateRef v1 = ReadInst8_2(pc);
|
||||
GateRef hole = GetVregValue(sp, ZExtInt8ToPtr(v0));
|
||||
@@ -1562,7 +1565,6 @@ DECLARE_ASM_HANDLER(HandleLdSuperByValuePrefV8V8)
|
||||
GateRef v1 = ReadInst8_2(pc);
|
||||
GateRef receiver = GetVregValue(sp, ZExtInt8ToPtr(v0));
|
||||
GateRef propKey = GetVregValue(sp, ZExtInt8ToPtr(v1));
|
||||
|
||||
StubDescriptor *ldSuperByValue = GET_STUBDESCRIPTOR(LdSuperByValue);
|
||||
GateRef result = CallRuntime(ldSuperByValue, glue, GetWord64Constant(FAST_STUB_ID(LdSuperByValue)),
|
||||
{glue, receiver, propKey, sp}); // sp for thisFunc
|
||||
@@ -1586,7 +1588,6 @@ DECLARE_ASM_HANDLER(HandleStSuperByValuePrefV8V8)
|
||||
GateRef v1 = ReadInst8_2(pc);
|
||||
GateRef receiver = GetVregValue(sp, ZExtInt8ToPtr(v0));
|
||||
GateRef propKey = GetVregValue(sp, ZExtInt8ToPtr(v1));
|
||||
|
||||
StubDescriptor *stSuperByValue = GET_STUBDESCRIPTOR(StSuperByValue);
|
||||
GateRef result = CallRuntime(stSuperByValue, glue, GetWord64Constant(FAST_STUB_ID(StSuperByValue)),
|
||||
{glue, receiver, propKey, acc, sp}); // acc is value, sp for thisFunc
|
||||
@@ -1601,6 +1602,133 @@ DECLARE_ASM_HANDLER(HandleStSuperByValuePrefV8V8)
|
||||
DISPATCH(PREF_V8_V8);
|
||||
}
|
||||
|
||||
DECLARE_ASM_HANDLER(HandleLdObjByIndexPrefV8Imm32)
|
||||
{
|
||||
auto env = GetEnvironment();
|
||||
DEFVARIABLE(varAcc, MachineType::TAGGED, acc);
|
||||
|
||||
GateRef v0 = ReadInst8_1(pc);
|
||||
GateRef receiver = GetVregValue(sp, ZExtInt8ToPtr(v0));
|
||||
GateRef index = ReadInst32_2(pc);
|
||||
Label fastPath(env);
|
||||
Label slowPath(env);
|
||||
Label isException(env);
|
||||
Label accDispatch(env);
|
||||
Branch(TaggedIsHeapObject(receiver), &fastPath, &slowPath);
|
||||
Bind(&fastPath);
|
||||
{
|
||||
StubDescriptor *getPropertyByIndex = GET_STUBDESCRIPTOR(GetPropertyByIndex);
|
||||
GateRef result = CallRuntime(getPropertyByIndex, glue, GetWord64Constant(FAST_STUB_ID(GetPropertyByIndex)),
|
||||
{glue, receiver, index});
|
||||
Label notHole(env);
|
||||
Branch(TaggedIsHole(result), &slowPath, ¬Hole);
|
||||
Bind(¬Hole);
|
||||
Label notException(env);
|
||||
Branch(TaggedIsException(result), &isException, ¬Exception);
|
||||
Bind(¬Exception);
|
||||
varAcc = result;
|
||||
Jump(&accDispatch);
|
||||
}
|
||||
Bind(&slowPath);
|
||||
{
|
||||
StubDescriptor *ldObjByIndex = GET_STUBDESCRIPTOR(LdObjByIndex);
|
||||
GateRef result = CallRuntime(ldObjByIndex, glue, GetWord64Constant(FAST_STUB_ID(LdObjByIndex)),
|
||||
{glue, receiver, index, FalseConstant(), GetUndefinedConstant()});
|
||||
Label notException(env);
|
||||
Branch(TaggedIsException(result), &isException, ¬Exception);
|
||||
Bind(¬Exception);
|
||||
varAcc = result;
|
||||
Jump(&accDispatch);
|
||||
}
|
||||
Bind(&isException);
|
||||
{
|
||||
DISPATCH_LAST();
|
||||
}
|
||||
Bind(&accDispatch);
|
||||
DISPATCH_WITH_ACC(PREF_V8_IMM32);
|
||||
}
|
||||
|
||||
DECLARE_ASM_HANDLER(HandleStObjByIndexPrefV8Imm32)
|
||||
{
|
||||
auto env = GetEnvironment();
|
||||
|
||||
GateRef v0 = ReadInst8_1(pc);
|
||||
GateRef receiver = GetVregValue(sp, ZExtInt8ToPtr(v0));
|
||||
GateRef index = ReadInst32_2(pc);
|
||||
Label fastPath(env);
|
||||
Label slowPath(env);
|
||||
Label isException(env);
|
||||
Label notException(env);
|
||||
Branch(TaggedIsHeapObject(receiver), &fastPath, &slowPath);
|
||||
Bind(&fastPath);
|
||||
{
|
||||
StubDescriptor *setPropertyByIndex = GET_STUBDESCRIPTOR(SetPropertyByIndex);
|
||||
GateRef result = CallRuntime(setPropertyByIndex, glue, GetWord64Constant(FAST_STUB_ID(SetPropertyByIndex)),
|
||||
{glue, receiver, index, acc}); // acc is value
|
||||
Label notHole(env);
|
||||
Branch(TaggedIsHole(result), &slowPath, ¬Hole);
|
||||
Bind(¬Hole);
|
||||
Branch(TaggedIsException(result), &isException, ¬Exception);
|
||||
}
|
||||
Bind(&slowPath);
|
||||
{
|
||||
StubDescriptor *stObjByIndex = GET_STUBDESCRIPTOR(StObjByIndex);
|
||||
GateRef result = CallRuntime(stObjByIndex, glue, GetWord64Constant(FAST_STUB_ID(StObjByIndex)),
|
||||
{glue, receiver, index, acc}); // acc is value
|
||||
Branch(TaggedIsException(result), &isException, ¬Exception);
|
||||
}
|
||||
Bind(&isException);
|
||||
{
|
||||
DISPATCH_LAST();
|
||||
}
|
||||
Bind(¬Exception);
|
||||
DISPATCH(PREF_V8_IMM32);
|
||||
}
|
||||
|
||||
DECLARE_ASM_HANDLER(HandleStOwnByIndexPrefV8Imm32)
|
||||
{
|
||||
auto env = GetEnvironment();
|
||||
|
||||
GateRef v0 = ReadInst8_1(pc);
|
||||
GateRef receiver = GetVregValue(sp, ZExtInt8ToPtr(v0));
|
||||
GateRef index = ReadInst32_2(pc);
|
||||
Label isHeapObject(env);
|
||||
Label slowPath(env);
|
||||
Label isException(env);
|
||||
Label notException(env);
|
||||
Branch(TaggedIsHeapObject(receiver), &isHeapObject, &slowPath);
|
||||
Bind(&isHeapObject);
|
||||
Label notClassConstructor(env);
|
||||
Branch(IsClassConstructor(receiver), &slowPath, ¬ClassConstructor);
|
||||
Bind(¬ClassConstructor);
|
||||
Label notClassPrototype(env);
|
||||
Branch(IsClassPrototype(receiver), &slowPath, ¬ClassPrototype);
|
||||
Bind(¬ClassPrototype);
|
||||
{
|
||||
// fast path
|
||||
StubDescriptor *setPropertyByIndex = GET_STUBDESCRIPTOR(SetPropertyByIndex);
|
||||
GateRef result = CallRuntime(setPropertyByIndex, glue, GetWord64Constant(FAST_STUB_ID(SetPropertyByIndex)),
|
||||
{glue, receiver, index, acc}); // acc is value
|
||||
Label notHole(env);
|
||||
Branch(TaggedIsHole(result), &slowPath, ¬Hole);
|
||||
Bind(¬Hole);
|
||||
Branch(TaggedIsException(result), &isException, ¬Exception);
|
||||
}
|
||||
Bind(&slowPath);
|
||||
{
|
||||
StubDescriptor *stOwnByIndex = GET_STUBDESCRIPTOR(StOwnByIndex);
|
||||
GateRef result = CallRuntime(stOwnByIndex, glue, GetWord64Constant(FAST_STUB_ID(StOwnByIndex)),
|
||||
{glue, receiver, index, acc}); // acc is value
|
||||
Branch(TaggedIsException(result), &isException, ¬Exception);
|
||||
}
|
||||
Bind(&isException);
|
||||
{
|
||||
DISPATCH_LAST();
|
||||
}
|
||||
Bind(¬Exception);
|
||||
DISPATCH(PREF_V8_IMM32);
|
||||
}
|
||||
|
||||
DECLARE_ASM_HANDLER(HandleStConstToGlobalRecordPrefId32)
|
||||
{
|
||||
auto env = GetEnvironment();
|
||||
|
||||
@@ -97,9 +97,9 @@ namespace panda::ecmascript::kungfu {
|
||||
T(HandleStOwnByValuePrefV8V8, 7) \
|
||||
T(HandleLdSuperByValuePrefV8V8, 7) \
|
||||
T(HandleStSuperByValuePrefV8V8, 7) \
|
||||
V(HandleLdObjByIndexPrefV8Imm32, 7) \
|
||||
V(HandleStObjByIndexPrefV8Imm32, 7) \
|
||||
V(HandleStOwnByIndexPrefV8Imm32, 7) \
|
||||
T(HandleLdObjByIndexPrefV8Imm32, 7) \
|
||||
T(HandleStObjByIndexPrefV8Imm32, 7) \
|
||||
T(HandleStOwnByIndexPrefV8Imm32, 7) \
|
||||
V(HandleCallSpreadDynPrefV8V8V8, 7) \
|
||||
V(HandleAsyncFunctionResolvePrefV8V8V8, 7) \
|
||||
V(HandleAsyncFunctionRejectPrefV8V8V8, 7) \
|
||||
|
||||
@@ -1237,6 +1237,58 @@ CALL_STUB_INIT_DESCRIPTOR(StSuperByValue)
|
||||
descriptor->SetStubKind(StubDescriptor::CallStubKind::RUNTIME_STUB);
|
||||
}
|
||||
|
||||
CALL_STUB_INIT_DESCRIPTOR(LdObjByIndex)
|
||||
{
|
||||
// 5 : 5 input parameters
|
||||
StubDescriptor ldObjByIndex("LdObjByIndex", 0, 5,
|
||||
ArgumentsOrder::DEFAULT_ORDER, MachineType::TAGGED);
|
||||
*descriptor = ldObjByIndex;
|
||||
// 5 : 5 input parameters
|
||||
std::array<MachineType, 5> params = {
|
||||
MachineType::NATIVE_POINTER,
|
||||
MachineType::TAGGED,
|
||||
MachineType::UINT32,
|
||||
MachineType::BOOL,
|
||||
MachineType::TAGGED,
|
||||
};
|
||||
descriptor->SetParameters(params.data());
|
||||
descriptor->SetStubKind(StubDescriptor::CallStubKind::RUNTIME_STUB);
|
||||
}
|
||||
|
||||
CALL_STUB_INIT_DESCRIPTOR(StObjByIndex)
|
||||
{
|
||||
// 4 : 4 input parameters
|
||||
StubDescriptor stObjByIndex("StObjByIndex", 0, 4,
|
||||
ArgumentsOrder::DEFAULT_ORDER, MachineType::TAGGED);
|
||||
*descriptor = stObjByIndex;
|
||||
// 4 : 4 input parameters
|
||||
std::array<MachineType, 4> params = {
|
||||
MachineType::NATIVE_POINTER,
|
||||
MachineType::TAGGED,
|
||||
MachineType::UINT32,
|
||||
MachineType::TAGGED,
|
||||
};
|
||||
descriptor->SetParameters(params.data());
|
||||
descriptor->SetStubKind(StubDescriptor::CallStubKind::RUNTIME_STUB);
|
||||
}
|
||||
|
||||
CALL_STUB_INIT_DESCRIPTOR(StOwnByIndex)
|
||||
{
|
||||
// 4 : 4 input parameters
|
||||
StubDescriptor stOwnByIndex("StOwnByIndex", 0, 4,
|
||||
ArgumentsOrder::DEFAULT_ORDER, MachineType::TAGGED);
|
||||
*descriptor = stOwnByIndex;
|
||||
// 4 : 4 input parameters
|
||||
std::array<MachineType, 4> params = {
|
||||
MachineType::NATIVE_POINTER,
|
||||
MachineType::TAGGED,
|
||||
MachineType::UINT32,
|
||||
MachineType::TAGGED,
|
||||
};
|
||||
descriptor->SetParameters(params.data());
|
||||
descriptor->SetStubKind(StubDescriptor::CallStubKind::RUNTIME_STUB);
|
||||
}
|
||||
|
||||
CALL_STUB_INIT_DESCRIPTOR(StGlobalRecord)
|
||||
{
|
||||
// 4 : 4 input parameters
|
||||
|
||||
@@ -639,6 +639,26 @@ JSTaggedType RuntimeTrampolines::StSuperByValue(uintptr_t argGlue,
|
||||
JSTaggedValue(obj), JSTaggedValue(key), JSTaggedValue(value), thisFunc).GetRawData();
|
||||
}
|
||||
|
||||
JSTaggedType RuntimeTrampolines::LdObjByIndex(uintptr_t argGlue, JSTaggedType obj, uint32_t idx,
|
||||
bool callGetter, JSTaggedType receiver)
|
||||
{
|
||||
auto thread = JSThread::GlueToJSThread(argGlue);
|
||||
return SlowRuntimeStub::LdObjByIndex(thread, JSTaggedValue(obj), idx,
|
||||
callGetter, JSTaggedValue(receiver)).GetRawData();
|
||||
}
|
||||
|
||||
JSTaggedType RuntimeTrampolines::StObjByIndex(uintptr_t argGlue, JSTaggedType obj, uint32_t idx, JSTaggedType value)
|
||||
{
|
||||
auto thread = JSThread::GlueToJSThread(argGlue);
|
||||
return SlowRuntimeStub::StObjByIndex(thread, JSTaggedValue(obj), idx, JSTaggedValue(value)).GetRawData();
|
||||
}
|
||||
|
||||
JSTaggedType RuntimeTrampolines::StOwnByIndex(uintptr_t argGlue, JSTaggedType obj, uint32_t idx, JSTaggedType value)
|
||||
{
|
||||
auto thread = JSThread::GlueToJSThread(argGlue);
|
||||
return SlowRuntimeStub::StOwnByIndex(thread, JSTaggedValue(obj), idx, JSTaggedValue(value)).GetRawData();
|
||||
}
|
||||
|
||||
JSTaggedType RuntimeTrampolines::StGlobalRecord(uintptr_t argGlue, JSTaggedType prop, JSTaggedType value, bool isConst)
|
||||
{
|
||||
auto thread = JSThread::GlueToJSThread(argGlue);
|
||||
|
||||
@@ -114,6 +114,10 @@ public:
|
||||
static JSTaggedType LdSuperByValue(uintptr_t argGlue, JSTaggedType obj, JSTaggedType key, uintptr_t sp);
|
||||
static JSTaggedType StSuperByValue(uintptr_t argGlue,
|
||||
JSTaggedType obj, JSTaggedType key, JSTaggedType value, uintptr_t sp);
|
||||
static JSTaggedType LdObjByIndex(uintptr_t argGlue, JSTaggedType obj, uint32_t idx,
|
||||
bool callGetter, JSTaggedType receiver);
|
||||
static JSTaggedType StObjByIndex(uintptr_t argGlue, JSTaggedType obj, uint32_t idx, JSTaggedType value);
|
||||
static JSTaggedType StOwnByIndex(uintptr_t argGlue, JSTaggedType obj, uint32_t idx, JSTaggedType value);
|
||||
static JSTaggedType StGlobalRecord(uintptr_t argGlue, JSTaggedType prop, JSTaggedType value, bool isConst);
|
||||
static JSTaggedType NegDyn(uintptr_t argGlue, JSTaggedType value);
|
||||
static JSTaggedType NotDyn(uintptr_t argGlue, JSTaggedType value);
|
||||
|
||||
Reference in New Issue
Block a user