AOT test262 bugfix for new isa

Issue: https://gitee.com/openharmony/arkcompiler_ets_runtime/issues/I5TAXQ
Signed-off-by: xujie <xujie101@huawei.com>
Change-Id: Iec5459a31ac5105362563592876fab9fe83aa37b
This commit is contained in:
xujie 2022-09-26 21:28:03 +08:00
parent 4e17ccd78f
commit 2c9ce39453
4 changed files with 54 additions and 10 deletions

View File

@ -201,9 +201,11 @@ void BytecodeCircuitBuilder::CollectTryCatchBlockInfo(std::map<std::pair<uint8_t
}
if (!flag) {
// pre block
if (byteCodeCurPrePc_.at(tryStartPc) != tryStartPc) {
bytecodeBlockInfos_.emplace_back(byteCodeCurPrePc_.at(tryStartPc), SplitKind::END,
std::vector<uint8_t *>(1, tryStartPc));
}
}
// try block
bytecodeBlockInfos_.emplace_back(tryStartPc, SplitKind::START, std::vector<uint8_t *>(1, tryStartPc));
flag = false;
@ -718,6 +720,7 @@ BytecodeInfo BytecodeCircuitBuilder::GetBytecodeInfo(const uint8_t *pc)
case EcmaOpcode::CALLTHISRANGE_IMM8_IMM8_V8: {
uint32_t actualNumArgs = READ_INST_8_1();
uint32_t startReg = READ_INST_8_2();
info.inputs.emplace_back(VirtualRegister(startReg));
for (size_t i = 1; i <= actualNumArgs; i++) {
info.inputs.emplace_back(VirtualRegister(startReg + i));
}
@ -726,6 +729,7 @@ BytecodeInfo BytecodeCircuitBuilder::GetBytecodeInfo(const uint8_t *pc)
case EcmaOpcode::WIDE_CALLTHISRANGE_PREF_IMM16_V8: {
uint32_t actualNumArgs = READ_INST_16_1();
uint32_t startReg = READ_INST_8_3();
info.inputs.emplace_back(VirtualRegister(startReg));
for (size_t i = 1; i <= actualNumArgs; i++) {
info.inputs.emplace_back(VirtualRegister(startReg + i));
}

View File

@ -1592,8 +1592,7 @@ void BytecodeInfoCollector::CollectMethodInfoFromNewBC(const BytecodeInstruction
CollectInnerMethods(method, methodId);
break;
}
case BytecodeInstruction::Opcode::DEFINECLASSWITHBUFFER_IMM8_ID16_ID16_IMM16_V8:
case BytecodeInstruction::Opcode::DEFINECLASSWITHBUFFER_IMM16_ID16_ID16_IMM16_V8: {
case BytecodeInstruction::Opcode::DEFINECLASSWITHBUFFER_IMM8_ID16_ID16_IMM16_V8:{
auto entityId = pf->ResolveMethodIndex(method->GetMethodId(),
(bcIns.GetId <BytecodeInstruction::Format::IMM8_ID16_ID16_IMM16_V8, 0>()).AsRawValue());
methodId = entityId.GetOffset();
@ -1603,6 +1602,16 @@ void BytecodeInfoCollector::CollectMethodInfoFromNewBC(const BytecodeInstruction
CollectInnerMethodsFromNewLiteral(method, literalId);
break;
}
case BytecodeInstruction::Opcode::DEFINECLASSWITHBUFFER_IMM16_ID16_ID16_IMM16_V8: {
auto entityId = pf->ResolveMethodIndex(method->GetMethodId(),
(bcIns.GetId <BytecodeInstruction::Format::IMM16_ID16_ID16_IMM16_V8, 0>()).AsRawValue());
methodId = entityId.GetOffset();
CollectInnerMethods(method, methodId);
auto literalId = pf->ResolveMethodIndex(method->GetMethodId(),
(bcIns.GetId <BytecodeInstruction::Format::IMM16_ID16_ID16_IMM16_V8, 1>()).AsRawValue());
CollectInnerMethodsFromNewLiteral(method, literalId);
break;
}
case BytecodeInstruction::Opcode::DEPRECATED_DEFINECLASSWITHBUFFER_PREF_ID16_IMM16_IMM16_V8_V8: {
methodId = pf->ResolveMethodIndex(method->GetMethodId(), bcIns.GetId().AsRawValue()).GetOffset();
auto imm = bcIns.GetImm<BytecodeInstruction::Format::PREF_ID16_IMM16_IMM16_V8_V8>();

View File

@ -353,8 +353,11 @@ void SlowPathLowering::Lower(GateRef gate)
case EcmaOpcode::WIDE_CALLTHISRANGE_PREF_IMM16_V8:
LowerWideCallthisrangePrefImm16V8(gate, glue);
break;
case EcmaOpcode::APPLY_IMM8_V8_V8:
LowerCallSpread(gate, glue, false);
break;
case EcmaOpcode::DEPRECATED_CALLSPREAD_PREF_V8_V8_V8:
LowerCallSpread(gate, glue);
LowerCallSpread(gate, glue, true);
break;
case EcmaOpcode::DEPRECATED_CALLRANGE_PREF_IMM16_V8:
LowerCallRange(gate, glue);
@ -557,9 +560,11 @@ void SlowPathLowering::Lower(GateRef gate)
break;
case EcmaOpcode::CREATEOBJECTWITHBUFFER_IMM8_ID16:
case EcmaOpcode::CREATEOBJECTWITHBUFFER_IMM16_ID16:
case EcmaOpcode::DEPRECATED_CREATEOBJECTWITHBUFFER_PREF_IMM16:
LowerCreateObjectWithBuffer(gate, glue, jsFunc);
break;
case EcmaOpcode::DEPRECATED_CREATEOBJECTWITHBUFFER_PREF_IMM16:
LowerDeprecatedCreateObjectWithBuffer(gate, glue, jsFunc);
break;
case EcmaOpcode::CREATEARRAYWITHBUFFER_IMM8_ID16:
case EcmaOpcode::CREATEARRAYWITHBUFFER_IMM16_ID16:
case EcmaOpcode::DEPRECATED_CREATEARRAYWITHBUFFER_PREF_IMM16:
@ -1224,7 +1229,7 @@ void SlowPathLowering::LowerWideCallthisrangePrefImm16V8(GateRef gate, GateRef g
ASSERT(acc_.GetNumValueIn(gate) - fixedInputsNum >= 0);
size_t numIns = acc_.GetNumValueIn(gate);
GateRef actualArgc = builder_.Int64(ComputeCallArgc(gate, EcmaOpcode::WIDE_CALLTHISRANGE_PREF_IMM16_V8));
GateRef callTarget = acc_.GetValueIn(gate, numIns - 1); // acc
GateRef callTarget = acc_.GetValueIn(gate, numIns - 2); // acc
GateRef thisObj = acc_.GetValueIn(gate, 0);
GateRef newTarget = builder_.Undefined();
GateRef env = builder_.Undefined();
@ -1238,17 +1243,24 @@ void SlowPathLowering::LowerWideCallthisrangePrefImm16V8(GateRef gate, GateRef g
for (size_t i = fixedInputsNum; i < numIns - 1; i++) {
vec.emplace_back(acc_.GetValueIn(gate, i));
}
vec.emplace_back(acc_.GetValueIn(gate, numIns - 1)); // bcoffset
LowerToJSCall(gate, glue, vec);
}
void SlowPathLowering::LowerCallSpread(GateRef gate, GateRef glue)
void SlowPathLowering::LowerCallSpread(GateRef gate, GateRef glue, bool isDeprecated)
{
// need to fixed in later
const int id = RTSTUB_ID(CallSpread);
// 3: number of value inputs
ASSERT(acc_.GetNumValueIn(gate) == 3);
GateRef newGate = LowerCallRuntime(glue, id,
GateRef newGate;
if (isDeprecated) {
newGate = LowerCallRuntime(glue, id,
{acc_.GetValueIn(gate, 2), acc_.GetValueIn(gate, 0), acc_.GetValueIn(gate, 1)});
} else {
newGate = LowerCallRuntime(glue, id,
{acc_.GetValueIn(gate, 1), acc_.GetValueIn(gate, 2), acc_.GetValueIn(gate, 0)});
}
ReplaceHirToCall(gate, newGate);
}
@ -1978,6 +1990,24 @@ void SlowPathLowering::LowerCreateArrayWithBuffer(GateRef gate, GateRef glue, Ga
}
void SlowPathLowering::LowerCreateObjectWithBuffer(GateRef gate, GateRef glue, GateRef jsFunc)
{
DebugPrintBC(gate, glue);
Label successExit(&builder_);
Label exceptionExit(&builder_);
// 1: number of value inputs
ASSERT(acc_.GetNumValueIn(gate) == 1);
GateRef index = acc_.GetValueIn(gate, 0);
GateRef obj = GetObjectFromConstPool(glue, jsFunc, builder_.TruncInt64ToInt32(index),
ConstPoolType::OBJECT_LITERAL);
GateRef lexEnv = LowerCallRuntime(glue, RTSTUB_ID(OptGetLexicalEnv), {}, true);
GateRef result = LowerCallRuntime(glue, RTSTUB_ID(CreateObjectHavingMethod), { obj, lexEnv }, true);
builder_.Branch(builder_.IsSpecial(result, JSTaggedValue::VALUE_EXCEPTION),
&exceptionExit, &successExit);
CREATE_DOUBLE_EXIT(successExit, exceptionExit)
ReplaceHirToSubCfg(gate, result, successControl, failControl);
}
void SlowPathLowering::LowerDeprecatedCreateObjectWithBuffer(GateRef gate, GateRef glue, GateRef jsFunc)
{
DebugPrintBC(gate, glue);
Label successExit(&builder_);

View File

@ -180,7 +180,7 @@ private:
void LowerCallThisRange(GateRef gate, GateRef glue);
void LowerCallthisrangeImm8Imm8V8(GateRef gate, GateRef glue);
void LowerWideCallthisrangePrefImm16V8(GateRef gate, GateRef glue);
void LowerCallSpread(GateRef gate, GateRef glue);
void LowerCallSpread(GateRef gate, GateRef glue, bool isDeprecated);
void LowerCallRange(GateRef gate, GateRef glue);
void LowerCallrangeImm8Imm8V8(GateRef gate, GateRef glue);
void LowerWideCallrangePrefImm16V8(GateRef gate, GateRef glue);
@ -229,6 +229,7 @@ private:
void LowerCreateEmptyObject(GateRef gate, GateRef glue);
void LowerCreateArrayWithBuffer(GateRef gate, GateRef glue, GateRef jsFunc);
void LowerCreateObjectWithBuffer(GateRef gate, GateRef glue, GateRef jsFunc);
void LowerDeprecatedCreateObjectWithBuffer(GateRef gate, GateRef glue, GateRef jsFunc);
void LowerStModuleVarByIndex(GateRef gate, GateRef glue, GateRef jsFunc);
void LowerStModuleVar(GateRef gate, GateRef glue, GateRef jsFunc);
void LowerGetTemplateObject(GateRef gate, GateRef glue);