mirror of
https://gitee.com/openharmony/arkcompiler_ets_runtime
synced 2024-10-07 08:03:29 +00:00
Replace CallRuntime with CallStub in AOT slowpath
Issue:https://gitee.com/openharmony/arkcompiler_ets_runtime/issues/I678FV?from=project-issue Signed-off-by: zhangyukun8 <zhangyukun8@huawei.com> Change-Id: Iad83939b0321e57322e0d429ac8cec86daa54dcf
This commit is contained in:
parent
41b2e98ea6
commit
7add022704
@ -35,49 +35,103 @@
|
||||
#endif
|
||||
|
||||
namespace panda::ecmascript::kungfu {
|
||||
#define BINARY_CALL_SIGNATURE(name) \
|
||||
/* 3 : 3 input parameters */ \
|
||||
CallSignature signature(#name, 0, 3, \
|
||||
ArgumentsOrder::DEFAULT_ORDER, VariableType::JS_ANY()); \
|
||||
*callSign = signature; \
|
||||
/* 3 : 3 input parameters */ \
|
||||
std::array<VariableType, 3> params = { \
|
||||
VariableType::NATIVE_POINTER(), \
|
||||
VariableType::JS_ANY(), \
|
||||
VariableType::JS_ANY(), \
|
||||
}; \
|
||||
callSign->SetParameters(params.data()); \
|
||||
callSign->SetCallConv(CallSignature::CallConv::CCallConv);
|
||||
|
||||
DEF_CALL_SIGNATURE(Add)
|
||||
{
|
||||
// 3 : 3 input parameters
|
||||
CallSignature Add("Add", 0, 3, ArgumentsOrder::DEFAULT_ORDER, VariableType::JS_ANY()); // number or hole
|
||||
*callSign = Add;
|
||||
// 3 : 3 input parameters
|
||||
std::array<VariableType, 3> params = {
|
||||
VariableType::NATIVE_POINTER(),
|
||||
VariableType::JS_ANY(),
|
||||
VariableType::JS_ANY(),
|
||||
};
|
||||
callSign->SetParameters(params.data());
|
||||
callSign->SetCallConv(CallSignature::CallConv::CCallConv);
|
||||
BINARY_CALL_SIGNATURE(Add)
|
||||
}
|
||||
|
||||
DEF_CALL_SIGNATURE(Sub)
|
||||
{
|
||||
// 3 : 3 input parameters
|
||||
CallSignature Sub("Sub", 0, 3, ArgumentsOrder::DEFAULT_ORDER, VariableType::JS_ANY()); // number or hole
|
||||
*callSign = Sub;
|
||||
// 3 : 3 input parameters
|
||||
std::array<VariableType, 3> params = {
|
||||
VariableType::NATIVE_POINTER(),
|
||||
VariableType::JS_ANY(),
|
||||
VariableType::JS_ANY(),
|
||||
};
|
||||
callSign->SetParameters(params.data());
|
||||
callSign->SetCallConv(CallSignature::CallConv::CCallConv);
|
||||
BINARY_CALL_SIGNATURE(Sub)
|
||||
}
|
||||
|
||||
DEF_CALL_SIGNATURE(Mul)
|
||||
{
|
||||
// 3 : 3 input parameters
|
||||
CallSignature Mul("Mul", 0, 3, ArgumentsOrder::DEFAULT_ORDER, VariableType::JS_ANY()); // number or hole
|
||||
*callSign = Mul;
|
||||
// 3 : 3 input parameters
|
||||
std::array<VariableType, 3> params = {
|
||||
VariableType::NATIVE_POINTER(),
|
||||
VariableType::JS_ANY(),
|
||||
VariableType::JS_ANY(),
|
||||
};
|
||||
callSign->SetParameters(params.data());
|
||||
callSign->SetCallConv(CallSignature::CallConv::CCallConv);
|
||||
BINARY_CALL_SIGNATURE(Mul)
|
||||
}
|
||||
|
||||
DEF_CALL_SIGNATURE(Div)
|
||||
{
|
||||
BINARY_CALL_SIGNATURE(Div)
|
||||
}
|
||||
|
||||
DEF_CALL_SIGNATURE(Mod)
|
||||
{
|
||||
BINARY_CALL_SIGNATURE(Mod)
|
||||
}
|
||||
|
||||
DEF_CALL_SIGNATURE(Equal)
|
||||
{
|
||||
BINARY_CALL_SIGNATURE(Equal)
|
||||
}
|
||||
|
||||
DEF_CALL_SIGNATURE(NotEqual)
|
||||
{
|
||||
BINARY_CALL_SIGNATURE(NotEqual)
|
||||
}
|
||||
|
||||
DEF_CALL_SIGNATURE(Less)
|
||||
{
|
||||
BINARY_CALL_SIGNATURE(Less)
|
||||
}
|
||||
|
||||
DEF_CALL_SIGNATURE(LessEq)
|
||||
{
|
||||
BINARY_CALL_SIGNATURE(LessEq)
|
||||
}
|
||||
|
||||
DEF_CALL_SIGNATURE(Greater)
|
||||
{
|
||||
BINARY_CALL_SIGNATURE(Greater)
|
||||
}
|
||||
|
||||
DEF_CALL_SIGNATURE(GreaterEq)
|
||||
{
|
||||
BINARY_CALL_SIGNATURE(GreaterEq)
|
||||
}
|
||||
|
||||
DEF_CALL_SIGNATURE(Shl)
|
||||
{
|
||||
BINARY_CALL_SIGNATURE(Shl)
|
||||
}
|
||||
|
||||
DEF_CALL_SIGNATURE(Shr)
|
||||
{
|
||||
BINARY_CALL_SIGNATURE(Shr)
|
||||
}
|
||||
|
||||
DEF_CALL_SIGNATURE(Ashr)
|
||||
{
|
||||
BINARY_CALL_SIGNATURE(Ashr)
|
||||
}
|
||||
|
||||
DEF_CALL_SIGNATURE(And)
|
||||
{
|
||||
BINARY_CALL_SIGNATURE(And)
|
||||
}
|
||||
|
||||
DEF_CALL_SIGNATURE(Or)
|
||||
{
|
||||
BINARY_CALL_SIGNATURE(Or)
|
||||
}
|
||||
|
||||
DEF_CALL_SIGNATURE(Xor)
|
||||
{
|
||||
BINARY_CALL_SIGNATURE(Xor)
|
||||
}
|
||||
|
||||
#ifndef NDEBUG
|
||||
@ -99,37 +153,6 @@ DEF_CALL_SIGNATURE(MulGCTest)
|
||||
DEF_CALL_SIGNATURE(MulGCTest) {}
|
||||
#endif
|
||||
|
||||
DEF_CALL_SIGNATURE(Div)
|
||||
{
|
||||
// 3 : 3 input parameters
|
||||
CallSignature Div("Div", 0, 3, ArgumentsOrder::DEFAULT_ORDER, VariableType::JS_ANY()); // float or hole
|
||||
*callSign = Div;
|
||||
// 3 : 3 input parameters
|
||||
std::array<VariableType, 3> params = {
|
||||
VariableType::NATIVE_POINTER(),
|
||||
VariableType::JS_ANY(),
|
||||
VariableType::JS_ANY(),
|
||||
};
|
||||
callSign->SetParameters(params.data());
|
||||
callSign->SetCallConv(CallSignature::CallConv::CCallConv);
|
||||
}
|
||||
|
||||
DEF_CALL_SIGNATURE(Mod)
|
||||
{
|
||||
// 3 : 3 input parameters
|
||||
CallSignature Mod("Mod", 0, 3,
|
||||
ArgumentsOrder::DEFAULT_ORDER, VariableType::JS_ANY()); // int,float or hole
|
||||
*callSign = Mod;
|
||||
// 3 : 3 input parameters
|
||||
std::array<VariableType, 3> params = {
|
||||
VariableType::NATIVE_POINTER(),
|
||||
VariableType::JS_ANY(),
|
||||
VariableType::JS_ANY(),
|
||||
};
|
||||
callSign->SetParameters(params.data());
|
||||
callSign->SetCallConv(CallSignature::CallConv::CCallConv);
|
||||
}
|
||||
|
||||
DEF_CALL_SIGNATURE(TypeOf)
|
||||
{
|
||||
// 2 input parameters
|
||||
@ -144,36 +167,6 @@ DEF_CALL_SIGNATURE(TypeOf)
|
||||
callSign->SetCallConv(CallSignature::CallConv::CCallConv);
|
||||
}
|
||||
|
||||
DEF_CALL_SIGNATURE(Equal)
|
||||
{
|
||||
// 3 input parameters, return may be true/false/hole
|
||||
CallSignature Equal("Equal", 0, 3, ArgumentsOrder::DEFAULT_ORDER, VariableType::JS_ANY());
|
||||
*callSign = Equal;
|
||||
// 3 input parameters
|
||||
std::array<VariableType, 3> params = {
|
||||
VariableType::NATIVE_POINTER(),
|
||||
VariableType::JS_ANY(),
|
||||
VariableType::JS_ANY(),
|
||||
};
|
||||
callSign->SetParameters(params.data());
|
||||
callSign->SetCallConv(CallSignature::CallConv::CCallConv);
|
||||
}
|
||||
|
||||
DEF_CALL_SIGNATURE(NotEqual)
|
||||
{
|
||||
// 3 input parameters, return may be true/false/hole
|
||||
CallSignature NotEqual("NotEqual", 0, 3, ArgumentsOrder::DEFAULT_ORDER, VariableType::JS_ANY());
|
||||
*callSign = NotEqual;
|
||||
// 3 input parameters
|
||||
std::array<VariableType, 3> params = {
|
||||
VariableType::NATIVE_POINTER(), // glue
|
||||
VariableType::JS_ANY(), // left
|
||||
VariableType::JS_ANY(), // right
|
||||
};
|
||||
callSign->SetParameters(params.data());
|
||||
callSign->SetCallConv(CallSignature::CallConv::CCallConv);
|
||||
}
|
||||
|
||||
DEF_CALL_SIGNATURE(SetPropertyByName)
|
||||
{
|
||||
// 6 : 6 input parameters
|
||||
|
@ -314,6 +314,16 @@ private:
|
||||
V(TypeOf) \
|
||||
V(Equal) \
|
||||
V(NotEqual) \
|
||||
V(Less) \
|
||||
V(LessEq) \
|
||||
V(Greater) \
|
||||
V(GreaterEq) \
|
||||
V(Shl) \
|
||||
V(Shr) \
|
||||
V(Ashr) \
|
||||
V(And) \
|
||||
V(Or) \
|
||||
V(Xor) \
|
||||
V(SetPropertyByName) \
|
||||
V(DeprecatedSetPropertyByName) \
|
||||
V(SetPropertyByNameWithOwn) \
|
||||
|
@ -32,37 +32,37 @@ using namespace panda::ecmascript;
|
||||
void AddStubBuilder::GenerateCircuit()
|
||||
{
|
||||
GateRef glue = PtrArgument(0);
|
||||
(void)glue;
|
||||
GateRef x = TaggedArgument(1);
|
||||
GateRef y = TaggedArgument(2);
|
||||
Return(FastAdd(x, y));
|
||||
OperationsStubBuilder operationBuilder(this);
|
||||
Return(operationBuilder.Add(glue, x, y));
|
||||
}
|
||||
|
||||
void SubStubBuilder::GenerateCircuit()
|
||||
{
|
||||
GateRef glue = PtrArgument(0);
|
||||
(void)glue;
|
||||
GateRef x = TaggedArgument(1);
|
||||
GateRef y = TaggedArgument(2);
|
||||
Return(FastSub(x, y));
|
||||
OperationsStubBuilder operationBuilder(this);
|
||||
Return(operationBuilder.Sub(glue, x, y));
|
||||
}
|
||||
|
||||
void MulStubBuilder::GenerateCircuit()
|
||||
{
|
||||
GateRef glue = PtrArgument(0);
|
||||
(void)glue;
|
||||
GateRef x = TaggedArgument(1);
|
||||
GateRef y = TaggedArgument(2);
|
||||
Return(FastMul(x, y));
|
||||
OperationsStubBuilder operationBuilder(this);
|
||||
Return(operationBuilder.Mul(glue, x, y));
|
||||
}
|
||||
|
||||
void DivStubBuilder::GenerateCircuit()
|
||||
{
|
||||
GateRef glue = PtrArgument(0);
|
||||
(void)glue;
|
||||
GateRef x = TaggedArgument(1);
|
||||
GateRef y = TaggedArgument(2);
|
||||
Return(FastDiv(x, y));
|
||||
OperationsStubBuilder operationBuilder(this);
|
||||
Return(operationBuilder.Div(glue, x, y));
|
||||
}
|
||||
|
||||
void ModStubBuilder::GenerateCircuit()
|
||||
@ -70,7 +70,8 @@ void ModStubBuilder::GenerateCircuit()
|
||||
GateRef glue = PtrArgument(0);
|
||||
GateRef x = TaggedArgument(1);
|
||||
GateRef y = TaggedArgument(2); // 2: 3rd argument
|
||||
Return(FastMod(glue, x, y));
|
||||
OperationsStubBuilder operationBuilder(this);
|
||||
Return(operationBuilder.Mod(glue, x, y));
|
||||
}
|
||||
|
||||
void TypeOfStubBuilder::GenerateCircuit()
|
||||
@ -98,6 +99,96 @@ void NotEqualStubBuilder::GenerateCircuit()
|
||||
Return(operationBuilder.NotEqual(glue, x, y));
|
||||
}
|
||||
|
||||
void LessStubBuilder::GenerateCircuit()
|
||||
{
|
||||
GateRef glue = PtrArgument(0);
|
||||
GateRef x = TaggedArgument(1);
|
||||
GateRef y = TaggedArgument(2); // 2: 3rd argument
|
||||
OperationsStubBuilder operationBuilder(this);
|
||||
Return(operationBuilder.Less(glue, x, y));
|
||||
}
|
||||
|
||||
void LessEqStubBuilder::GenerateCircuit()
|
||||
{
|
||||
GateRef glue = PtrArgument(0);
|
||||
GateRef x = TaggedArgument(1);
|
||||
GateRef y = TaggedArgument(2); // 2: 3rd argument
|
||||
OperationsStubBuilder operationBuilder(this);
|
||||
Return(operationBuilder.LessEq(glue, x, y));
|
||||
}
|
||||
|
||||
void GreaterStubBuilder::GenerateCircuit()
|
||||
{
|
||||
GateRef glue = PtrArgument(0);
|
||||
GateRef x = TaggedArgument(1);
|
||||
GateRef y = TaggedArgument(2); // 2: 3rd argument
|
||||
OperationsStubBuilder operationBuilder(this);
|
||||
Return(operationBuilder.Greater(glue, x, y));
|
||||
}
|
||||
|
||||
void GreaterEqStubBuilder::GenerateCircuit()
|
||||
{
|
||||
GateRef glue = PtrArgument(0);
|
||||
GateRef x = TaggedArgument(1);
|
||||
GateRef y = TaggedArgument(2); // 2: 3rd argument
|
||||
OperationsStubBuilder operationBuilder(this);
|
||||
Return(operationBuilder.GreaterEq(glue, x, y));
|
||||
}
|
||||
|
||||
void ShlStubBuilder::GenerateCircuit()
|
||||
{
|
||||
GateRef glue = PtrArgument(0);
|
||||
GateRef x = TaggedArgument(1);
|
||||
GateRef y = TaggedArgument(2); // 2: 3rd argument
|
||||
OperationsStubBuilder operationBuilder(this);
|
||||
Return(operationBuilder.Shl(glue, x, y));
|
||||
}
|
||||
|
||||
void ShrStubBuilder::GenerateCircuit()
|
||||
{
|
||||
GateRef glue = PtrArgument(0);
|
||||
GateRef x = TaggedArgument(1);
|
||||
GateRef y = TaggedArgument(2); // 2: 3rd argument
|
||||
OperationsStubBuilder operationBuilder(this);
|
||||
Return(operationBuilder.Shr(glue, x, y));
|
||||
}
|
||||
|
||||
void AshrStubBuilder::GenerateCircuit()
|
||||
{
|
||||
GateRef glue = PtrArgument(0);
|
||||
GateRef x = TaggedArgument(1);
|
||||
GateRef y = TaggedArgument(2); // 2: 3rd argument
|
||||
OperationsStubBuilder operationBuilder(this);
|
||||
Return(operationBuilder.Ashr(glue, x, y));
|
||||
}
|
||||
|
||||
void AndStubBuilder::GenerateCircuit()
|
||||
{
|
||||
GateRef glue = PtrArgument(0);
|
||||
GateRef x = TaggedArgument(1);
|
||||
GateRef y = TaggedArgument(2); // 2: 3rd argument
|
||||
OperationsStubBuilder operationBuilder(this);
|
||||
Return(operationBuilder.And(glue, x, y));
|
||||
}
|
||||
|
||||
void OrStubBuilder::GenerateCircuit()
|
||||
{
|
||||
GateRef glue = PtrArgument(0);
|
||||
GateRef x = TaggedArgument(1);
|
||||
GateRef y = TaggedArgument(2); // 2: 3rd argument
|
||||
OperationsStubBuilder operationBuilder(this);
|
||||
Return(operationBuilder.Or(glue, x, y));
|
||||
}
|
||||
|
||||
void XorStubBuilder::GenerateCircuit()
|
||||
{
|
||||
GateRef glue = PtrArgument(0);
|
||||
GateRef x = TaggedArgument(1);
|
||||
GateRef y = TaggedArgument(2); // 2: 3rd argument
|
||||
OperationsStubBuilder operationBuilder(this);
|
||||
Return(operationBuilder.Xor(glue, x, y));
|
||||
}
|
||||
|
||||
void GetPropertyByIndexStubBuilder::GenerateCircuit()
|
||||
{
|
||||
GateRef glue = PtrArgument(0);
|
||||
|
@ -28,6 +28,16 @@ namespace panda::ecmascript::kungfu {
|
||||
V(Mod) \
|
||||
V(Equal) \
|
||||
V(NotEqual) \
|
||||
V(Less) \
|
||||
V(LessEq) \
|
||||
V(Greater) \
|
||||
V(GreaterEq) \
|
||||
V(Shl) \
|
||||
V(Shr) \
|
||||
V(Ashr) \
|
||||
V(And) \
|
||||
V(Or) \
|
||||
V(Xor) \
|
||||
V(TypeOf) \
|
||||
V(GetPropertyByName) \
|
||||
V(DeprecatedGetPropertyByName) \
|
||||
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -27,9 +27,24 @@ public:
|
||||
NO_MOVE_SEMANTIC(OperationsStubBuilder);
|
||||
NO_COPY_SEMANTIC(OperationsStubBuilder);
|
||||
void GenerateCircuit() override {}
|
||||
|
||||
// binary op
|
||||
GateRef Equal(GateRef glue, GateRef left, GateRef right);
|
||||
GateRef NotEqual(GateRef glue, GateRef left, GateRef right);
|
||||
GateRef Less(GateRef glue, GateRef left, GateRef right);
|
||||
GateRef LessEq(GateRef glue, GateRef left, GateRef right);
|
||||
GateRef Greater(GateRef glue, GateRef left, GateRef right);
|
||||
GateRef GreaterEq(GateRef glue, GateRef left, GateRef right);
|
||||
GateRef Add(GateRef glue, GateRef left, GateRef right);
|
||||
GateRef Sub(GateRef glue, GateRef left, GateRef right);
|
||||
GateRef Mul(GateRef glue, GateRef left, GateRef right);
|
||||
GateRef Div(GateRef glue, GateRef left, GateRef right);
|
||||
GateRef Mod(GateRef glue, GateRef left, GateRef right);
|
||||
GateRef Shl(GateRef glue, GateRef left, GateRef right);
|
||||
GateRef Shr(GateRef glue, GateRef left, GateRef right);
|
||||
GateRef Ashr(GateRef glue, GateRef left, GateRef right);
|
||||
GateRef And(GateRef glue, GateRef left, GateRef right);
|
||||
GateRef Or(GateRef glue, GateRef left, GateRef right);
|
||||
GateRef Xor(GateRef glue, GateRef left, GateRef right);
|
||||
};
|
||||
} // namespace panda::ecmascript::kungfu
|
||||
#endif // ECMASCRIPT_COMPILER_OPERATIONS_STUB_BUILDER_H
|
||||
|
@ -774,12 +774,15 @@ GateRef SlowPathLowering::LowerCallRuntime(int index, const std::vector<GateRef>
|
||||
|
||||
void SlowPathLowering::LowerAdd2(GateRef gate)
|
||||
{
|
||||
const int id = RTSTUB_ID(Add2);
|
||||
// 2: number of value inputs
|
||||
ASSERT(acc_.GetNumValueIn(gate) == 2);
|
||||
auto args = {acc_.GetValueIn(gate, 0), acc_.GetValueIn(gate, 1)};
|
||||
GateRef newGate = LowerCallRuntime(id, args);
|
||||
ReplaceHirToCall(gate, newGate);
|
||||
Label successExit(&builder_);
|
||||
Label exceptionExit(&builder_);
|
||||
GateRef result = builder_.CallStub(glue_, CommonStubCSigns::Add,
|
||||
{ glue_, acc_.GetValueIn(gate, 0), acc_.GetValueIn(gate, 1) });
|
||||
builder_.Branch(builder_.TaggedIsException(result), &exceptionExit, &successExit);
|
||||
CREATE_DOUBLE_EXIT(successExit, exceptionExit);
|
||||
ReplaceHirToSubCfg(gate, result, successControl, failControl);
|
||||
}
|
||||
|
||||
void SlowPathLowering::LowerCreateIterResultObj(GateRef gate)
|
||||
@ -1243,38 +1246,54 @@ void SlowPathLowering::LowerLdGlobal(GateRef gate)
|
||||
|
||||
void SlowPathLowering::LowerSub2(GateRef gate)
|
||||
{
|
||||
const int id = RTSTUB_ID(Sub2);
|
||||
// 2: number of value inputs
|
||||
ASSERT(acc_.GetNumValueIn(gate) == 2);
|
||||
GateRef newGate = LowerCallRuntime(id, {acc_.GetValueIn(gate, 0), acc_.GetValueIn(gate, 1)});
|
||||
ReplaceHirToCall(gate, newGate);
|
||||
Label successExit(&builder_);
|
||||
Label exceptionExit(&builder_);
|
||||
GateRef result = builder_.CallStub(glue_, CommonStubCSigns::Sub,
|
||||
{ glue_, acc_.GetValueIn(gate, 0), acc_.GetValueIn(gate, 1) });
|
||||
builder_.Branch(builder_.TaggedIsException(result), &exceptionExit, &successExit);
|
||||
CREATE_DOUBLE_EXIT(successExit, exceptionExit);
|
||||
ReplaceHirToSubCfg(gate, result, successControl, failControl);
|
||||
}
|
||||
|
||||
void SlowPathLowering::LowerMul2(GateRef gate)
|
||||
{
|
||||
const int id = RTSTUB_ID(Mul2);
|
||||
// 2: number of value inputs
|
||||
ASSERT(acc_.GetNumValueIn(gate) == 2);
|
||||
GateRef newGate = LowerCallRuntime(id, {acc_.GetValueIn(gate, 0), acc_.GetValueIn(gate, 1)});
|
||||
ReplaceHirToCall(gate, newGate);
|
||||
Label successExit(&builder_);
|
||||
Label exceptionExit(&builder_);
|
||||
GateRef result = builder_.CallStub(glue_, CommonStubCSigns::Mul,
|
||||
{ glue_, acc_.GetValueIn(gate, 0), acc_.GetValueIn(gate, 1) });
|
||||
builder_.Branch(builder_.TaggedIsException(result), &exceptionExit, &successExit);
|
||||
CREATE_DOUBLE_EXIT(successExit, exceptionExit);
|
||||
ReplaceHirToSubCfg(gate, result, successControl, failControl);
|
||||
}
|
||||
|
||||
void SlowPathLowering::LowerDiv2(GateRef gate)
|
||||
{
|
||||
const int id = RTSTUB_ID(Div2);
|
||||
// 2: number of value inputs
|
||||
ASSERT(acc_.GetNumValueIn(gate) == 2);
|
||||
GateRef newGate = LowerCallRuntime(id, {acc_.GetValueIn(gate, 0), acc_.GetValueIn(gate, 1)});
|
||||
ReplaceHirToCall(gate, newGate);
|
||||
Label successExit(&builder_);
|
||||
Label exceptionExit(&builder_);
|
||||
GateRef result = builder_.CallStub(glue_, CommonStubCSigns::Div,
|
||||
{ glue_, acc_.GetValueIn(gate, 0), acc_.GetValueIn(gate, 1) });
|
||||
builder_.Branch(builder_.TaggedIsException(result), &exceptionExit, &successExit);
|
||||
CREATE_DOUBLE_EXIT(successExit, exceptionExit);
|
||||
ReplaceHirToSubCfg(gate, result, successControl, failControl);
|
||||
}
|
||||
|
||||
void SlowPathLowering::LowerMod2(GateRef gate)
|
||||
{
|
||||
const int id = RTSTUB_ID(Mod2);
|
||||
// 2: number of value inputs
|
||||
ASSERT(acc_.GetNumValueIn(gate) == 2);
|
||||
GateRef newGate = LowerCallRuntime(id, {acc_.GetValueIn(gate, 0), acc_.GetValueIn(gate, 1)});
|
||||
ReplaceHirToCall(gate, newGate);
|
||||
Label successExit(&builder_);
|
||||
Label exceptionExit(&builder_);
|
||||
GateRef result = builder_.CallStub(glue_, CommonStubCSigns::Mod,
|
||||
{ glue_, acc_.GetValueIn(gate, 0), acc_.GetValueIn(gate, 1) });
|
||||
builder_.Branch(builder_.TaggedIsException(result), &exceptionExit, &successExit);
|
||||
CREATE_DOUBLE_EXIT(successExit, exceptionExit);
|
||||
ReplaceHirToSubCfg(gate, result, successControl, failControl);
|
||||
}
|
||||
|
||||
void SlowPathLowering::LowerEq(GateRef gate)
|
||||
@ -1305,38 +1324,54 @@ void SlowPathLowering::LowerNotEq(GateRef gate)
|
||||
|
||||
void SlowPathLowering::LowerLess(GateRef gate)
|
||||
{
|
||||
const int id = RTSTUB_ID(Less);
|
||||
// 2: number of value inputs
|
||||
ASSERT(acc_.GetNumValueIn(gate) == 2);
|
||||
GateRef newGate = LowerCallRuntime(id, {acc_.GetValueIn(gate, 0), acc_.GetValueIn(gate, 1)});
|
||||
ReplaceHirToCall(gate, newGate);
|
||||
Label successExit(&builder_);
|
||||
Label exceptionExit(&builder_);
|
||||
GateRef result = builder_.CallStub(glue_, CommonStubCSigns::Less,
|
||||
{ glue_, acc_.GetValueIn(gate, 0), acc_.GetValueIn(gate, 1) });
|
||||
builder_.Branch(builder_.TaggedIsException(result), &exceptionExit, &successExit);
|
||||
CREATE_DOUBLE_EXIT(successExit, exceptionExit)
|
||||
ReplaceHirToSubCfg(gate, result, successControl, failControl);
|
||||
}
|
||||
|
||||
void SlowPathLowering::LowerLessEq(GateRef gate)
|
||||
{
|
||||
const int id = RTSTUB_ID(LessEq);
|
||||
// 2: number of value inputs
|
||||
ASSERT(acc_.GetNumValueIn(gate) == 2);
|
||||
GateRef newGate = LowerCallRuntime(id, {acc_.GetValueIn(gate, 0), acc_.GetValueIn(gate, 1)});
|
||||
ReplaceHirToCall(gate, newGate);
|
||||
Label successExit(&builder_);
|
||||
Label exceptionExit(&builder_);
|
||||
GateRef result = builder_.CallStub(glue_, CommonStubCSigns::LessEq,
|
||||
{ glue_, acc_.GetValueIn(gate, 0), acc_.GetValueIn(gate, 1) });
|
||||
builder_.Branch(builder_.TaggedIsException(result), &exceptionExit, &successExit);
|
||||
CREATE_DOUBLE_EXIT(successExit, exceptionExit)
|
||||
ReplaceHirToSubCfg(gate, result, successControl, failControl);
|
||||
}
|
||||
|
||||
void SlowPathLowering::LowerGreater(GateRef gate)
|
||||
{
|
||||
const int id = RTSTUB_ID(Greater);
|
||||
// 2: number of value inputs
|
||||
ASSERT(acc_.GetNumValueIn(gate) == 2);
|
||||
GateRef newGate = LowerCallRuntime(id, {acc_.GetValueIn(gate, 0), acc_.GetValueIn(gate, 1)});
|
||||
ReplaceHirToCall(gate, newGate);
|
||||
Label successExit(&builder_);
|
||||
Label exceptionExit(&builder_);
|
||||
GateRef result = builder_.CallStub(glue_, CommonStubCSigns::Greater,
|
||||
{ glue_, acc_.GetValueIn(gate, 0), acc_.GetValueIn(gate, 1) });
|
||||
builder_.Branch(builder_.TaggedIsException(result), &exceptionExit, &successExit);
|
||||
CREATE_DOUBLE_EXIT(successExit, exceptionExit)
|
||||
ReplaceHirToSubCfg(gate, result, successControl, failControl);
|
||||
}
|
||||
|
||||
void SlowPathLowering::LowerGreaterEq(GateRef gate)
|
||||
{
|
||||
const int id = RTSTUB_ID(GreaterEq);
|
||||
// 2: number of value inputs
|
||||
ASSERT(acc_.GetNumValueIn(gate) == 2);
|
||||
GateRef newGate = LowerCallRuntime(id, {acc_.GetValueIn(gate, 0), acc_.GetValueIn(gate, 1)});
|
||||
ReplaceHirToCall(gate, newGate);
|
||||
Label successExit(&builder_);
|
||||
Label exceptionExit(&builder_);
|
||||
GateRef result = builder_.CallStub(glue_, CommonStubCSigns::GreaterEq,
|
||||
{ glue_, acc_.GetValueIn(gate, 0), acc_.GetValueIn(gate, 1) });
|
||||
builder_.Branch(builder_.TaggedIsException(result), &exceptionExit, &successExit);
|
||||
CREATE_DOUBLE_EXIT(successExit, exceptionExit)
|
||||
ReplaceHirToSubCfg(gate, result, successControl, failControl);
|
||||
}
|
||||
|
||||
void SlowPathLowering::LowerGetPropIterator(GateRef gate)
|
||||
@ -1404,56 +1439,80 @@ void SlowPathLowering::LowerNot(GateRef gate)
|
||||
|
||||
void SlowPathLowering::LowerShl2(GateRef gate)
|
||||
{
|
||||
const int id = RTSTUB_ID(Shl2);
|
||||
// 2: number of value inputs
|
||||
ASSERT(acc_.GetNumValueIn(gate) == 2);
|
||||
GateRef newGate = LowerCallRuntime(id, {acc_.GetValueIn(gate, 0), acc_.GetValueIn(gate, 1)});
|
||||
ReplaceHirToCall(gate, newGate);
|
||||
Label successExit(&builder_);
|
||||
Label exceptionExit(&builder_);
|
||||
GateRef result = builder_.CallStub(glue_, CommonStubCSigns::Shl,
|
||||
{ glue_, acc_.GetValueIn(gate, 0), acc_.GetValueIn(gate, 1) });
|
||||
builder_.Branch(builder_.TaggedIsException(result), &exceptionExit, &successExit);
|
||||
CREATE_DOUBLE_EXIT(successExit, exceptionExit);
|
||||
ReplaceHirToSubCfg(gate, result, successControl, failControl);
|
||||
}
|
||||
|
||||
void SlowPathLowering::LowerShr2(GateRef gate)
|
||||
{
|
||||
const int id = RTSTUB_ID(Shr2);
|
||||
// 2: number of value inputs
|
||||
ASSERT(acc_.GetNumValueIn(gate) == 2);
|
||||
GateRef newGate = LowerCallRuntime(id, {acc_.GetValueIn(gate, 0), acc_.GetValueIn(gate, 1)});
|
||||
ReplaceHirToCall(gate, newGate);
|
||||
Label successExit(&builder_);
|
||||
Label exceptionExit(&builder_);
|
||||
GateRef result = builder_.CallStub(glue_, CommonStubCSigns::Shr,
|
||||
{ glue_, acc_.GetValueIn(gate, 0), acc_.GetValueIn(gate, 1) });
|
||||
builder_.Branch(builder_.TaggedIsException(result), &exceptionExit, &successExit);
|
||||
CREATE_DOUBLE_EXIT(successExit, exceptionExit);
|
||||
ReplaceHirToSubCfg(gate, result, successControl, failControl);
|
||||
}
|
||||
|
||||
void SlowPathLowering::LowerAshr2(GateRef gate)
|
||||
{
|
||||
const int id = RTSTUB_ID(Ashr2);
|
||||
// 2: number of value inputs
|
||||
ASSERT(acc_.GetNumValueIn(gate) == 2);
|
||||
GateRef newGate = LowerCallRuntime(id, {acc_.GetValueIn(gate, 0), acc_.GetValueIn(gate, 1)});
|
||||
ReplaceHirToCall(gate, newGate);
|
||||
Label successExit(&builder_);
|
||||
Label exceptionExit(&builder_);
|
||||
GateRef result = builder_.CallStub(glue_, CommonStubCSigns::Ashr,
|
||||
{ glue_, acc_.GetValueIn(gate, 0), acc_.GetValueIn(gate, 1) });
|
||||
builder_.Branch(builder_.TaggedIsException(result), &exceptionExit, &successExit);
|
||||
CREATE_DOUBLE_EXIT(successExit, exceptionExit);
|
||||
ReplaceHirToSubCfg(gate, result, successControl, failControl);
|
||||
}
|
||||
|
||||
void SlowPathLowering::LowerAnd2(GateRef gate)
|
||||
{
|
||||
const int id = RTSTUB_ID(And2);
|
||||
// 2: number of value inputs
|
||||
ASSERT(acc_.GetNumValueIn(gate) == 2);
|
||||
GateRef newGate = LowerCallRuntime(id, {acc_.GetValueIn(gate, 0), acc_.GetValueIn(gate, 1)});
|
||||
ReplaceHirToCall(gate, newGate);
|
||||
Label successExit(&builder_);
|
||||
Label exceptionExit(&builder_);
|
||||
GateRef result = builder_.CallStub(glue_, CommonStubCSigns::And,
|
||||
{ glue_, acc_.GetValueIn(gate, 0), acc_.GetValueIn(gate, 1) });
|
||||
builder_.Branch(builder_.TaggedIsException(result), &exceptionExit, &successExit);
|
||||
CREATE_DOUBLE_EXIT(successExit, exceptionExit);
|
||||
ReplaceHirToSubCfg(gate, result, successControl, failControl);
|
||||
}
|
||||
|
||||
void SlowPathLowering::LowerOr2(GateRef gate)
|
||||
{
|
||||
const int id = RTSTUB_ID(Or2);
|
||||
// 2: number of value inputs
|
||||
ASSERT(acc_.GetNumValueIn(gate) == 2);
|
||||
GateRef newGate = LowerCallRuntime(id, {acc_.GetValueIn(gate, 0), acc_.GetValueIn(gate, 1)});
|
||||
ReplaceHirToCall(gate, newGate);
|
||||
Label successExit(&builder_);
|
||||
Label exceptionExit(&builder_);
|
||||
GateRef result = builder_.CallStub(glue_, CommonStubCSigns::Or,
|
||||
{ glue_, acc_.GetValueIn(gate, 0), acc_.GetValueIn(gate, 1) });
|
||||
builder_.Branch(builder_.TaggedIsException(result), &exceptionExit, &successExit);
|
||||
CREATE_DOUBLE_EXIT(successExit, exceptionExit);
|
||||
ReplaceHirToSubCfg(gate, result, successControl, failControl);
|
||||
}
|
||||
|
||||
void SlowPathLowering::LowerXor2(GateRef gate)
|
||||
{
|
||||
const int id = RTSTUB_ID(Xor2);
|
||||
// 2: number of value inputs
|
||||
ASSERT(acc_.GetNumValueIn(gate) == 2);
|
||||
GateRef newGate = LowerCallRuntime(id, {acc_.GetValueIn(gate, 0), acc_.GetValueIn(gate, 1)});
|
||||
ReplaceHirToCall(gate, newGate);
|
||||
Label successExit(&builder_);
|
||||
Label exceptionExit(&builder_);
|
||||
GateRef result = builder_.CallStub(glue_, CommonStubCSigns::Xor,
|
||||
{ glue_, acc_.GetValueIn(gate, 0), acc_.GetValueIn(gate, 1) });
|
||||
builder_.Branch(builder_.TaggedIsException(result), &exceptionExit, &successExit);
|
||||
CREATE_DOUBLE_EXIT(successExit, exceptionExit);
|
||||
ReplaceHirToSubCfg(gate, result, successControl, failControl);
|
||||
}
|
||||
|
||||
void SlowPathLowering::LowerDelObjProp(GateRef gate)
|
||||
|
@ -361,11 +361,9 @@ HWTEST_F_L0(StubTest, FastModTest)
|
||||
auto *factory = thread->GetEcmaVM()->GetFactory();
|
||||
thread->SetLastLeaveFrame(nullptr);
|
||||
auto y5 = factory->NewFromASCII("hello world");
|
||||
auto result5 = fn(thread->GetGlueAddr(), JSTaggedValue(x5).GetRawData(), y5.GetTaggedValue().GetRawData());
|
||||
EXPECT_EQ(result5, JSTaggedValue::Hole());
|
||||
auto expectRes5 = FastRuntimeStub::FastMod(JSTaggedValue(x5), y5.GetTaggedValue());
|
||||
auto result5 = FastRuntimeStub::FastMod(JSTaggedValue(x5), y5.GetTaggedValue());
|
||||
LOG_COMPILER(INFO) << "result1 for FastMod(7, 'helloworld') = " << result5.GetRawData();
|
||||
EXPECT_EQ(result5, expectRes5);
|
||||
EXPECT_EQ(result5, JSTaggedValue::Hole());
|
||||
}
|
||||
|
||||
HWTEST_F_L0(StubTest, TryLoadICByName)
|
||||
|
Loading…
Reference in New Issue
Block a user