Descriptor: Fix test262

Details: Fix test262

Issue: https://gitee.com/openharmony/arkcompiler_ets_runtime/issues/I5LPNL

Signed-off-by: wengchangcheng <wengchangcheng@huawei.com>
Change-Id: I67d85a67af60a72894c7c01011f77253ed56f709
This commit is contained in:
wengchangcheng 2022-09-06 00:06:09 +08:00
parent b1faee9a9a
commit f660f1734a
5 changed files with 19 additions and 5 deletions

View File

@ -244,6 +244,11 @@ GateRef InterpreterStubBuilder::GetModuleFromFunction(GateRef function)
return Load(VariableType::JS_POINTER(), function, IntPtr(JSFunction::ECMA_MODULE_OFFSET));
}
GateRef InterpreterStubBuilder::GetHomeObjectFromFunction(GateRef function)
{
return Load(VariableType::JS_POINTER(), function, IntPtr(JSFunction::HOME_OBJECT_OFFSET));
}
GateRef InterpreterStubBuilder::GetConstpoolFromFunction(GateRef function)
{
GateRef method = GetMethodFromJSFunction(function);

View File

@ -5909,6 +5909,7 @@ DECLARE_ASM_HANDLER(HandleDefinefuncImm8Id16Imm8)
SetLexicalEnvToFunction(glue, *result, envHandle);
GateRef currentFunc = GetFunctionFromFrame(frame);
SetModuleToFunction(glue, *result, GetModuleFromFunction(currentFunc));
SetHomeObjectToFunction(glue, *result, GetHomeObjectFromFunction(currentFunc));
varAcc = *result;
DISPATCH_WITH_ACC(DEFINEFUNC_IMM8_ID16_IMM8);
}
@ -5919,7 +5920,7 @@ DECLARE_ASM_HANDLER(HandleDefinefuncImm16Id16Imm8)
auto env = GetEnvironment();
DEFVARIABLE(varAcc, VariableType::JS_ANY(), acc);
GateRef methodId = ReadInst16_2(pc);
GateRef length = ReadInst16_4(pc);
GateRef length = ReadInst8_4(pc);
DEFVARIABLE(result, VariableType::JS_POINTER(),
GetMethodFromConstPool(constpool, ZExtInt16ToInt32(methodId)));
result = CallRuntime(glue, RTSTUB_ID(DefineFunc), { *result, acc });
@ -5928,13 +5929,14 @@ DECLARE_ASM_HANDLER(HandleDefinefuncImm16Id16Imm8)
Bind(&notException);
{
GateRef hclass = LoadHClass(*result);
SetPropertyInlinedProps(glue, *result, hclass, Int16ToTaggedInt(length),
SetPropertyInlinedProps(glue, *result, hclass, Int8ToTaggedInt(length),
Int32(JSFunction::LENGTH_INLINE_PROPERTY_INDEX), VariableType::INT64());
auto frame = GetFrame(sp);
GateRef envHandle = GetEnvFromFrame(frame);
SetLexicalEnvToFunction(glue, *result, envHandle);
GateRef currentFunc = GetFunctionFromFrame(frame);
SetModuleToFunction(glue, *result, GetModuleFromFunction(currentFunc));
SetHomeObjectToFunction(glue, *result, GetHomeObjectFromFunction(currentFunc));
varAcc = *result;
DISPATCH_WITH_ACC(DEFINEFUNC_IMM16_ID16_IMM8);
}

View File

@ -75,6 +75,7 @@ public:
inline GateRef GetConstpoolFromFunction(GateRef function);
inline GateRef GetProfileTypeInfoFromFunction(GateRef function);
inline GateRef GetModuleFromFunction(GateRef function);
inline GateRef GetHomeObjectFromFunction(GateRef function);
inline GateRef GetResumeModeFromGeneratorObject(GateRef obj);
inline GateRef GetResumeModeFromAsyncGeneratorObject(GateRef obj);
inline GateRef GetHotnessCounterFromMethod(GateRef method);

View File

@ -725,6 +725,7 @@ void SlowPathLowering::SaveFrameToContext(GateRef gate, GateRef glue, GateRef js
// set bc size
GateRef bcSizeOffset = builder_.IntPtr(GeneratorContext::GENERATOR_BC_OFFSET_OFFSET);
// TODO: add bytecode size here
GateRef bcSizeGate = acc_.GetValueIn(gate, 0); // saved bc_offset
bcSizeGate = builder_.TruncInt64ToInt32(bcSizeGate);
builder_.Store(VariableType::INT32(), glue, context, bcSizeOffset, bcSizeGate);

View File

@ -67,6 +67,9 @@ using CommonStubCSigns = kungfu::CommonStubCSigns;
HANDLE_##opcode:
#endif
#define FIRST_HANDLE_OPCODE(opcode) \
HANDLE_##opcode:
#define LOG_INST() false && LOG_INTERPRETER(DEBUG)
#define DEBUG_HANDLE_OPCODE(opcode) \
@ -3632,13 +3635,13 @@ NO_UB_SANITIZE void EcmaInterpreter::RunInternal(JSThread *thread, const uint8_t
LOG_INST() << "intrinsics::nop";
DISPATCH(NOP);
}
HANDLE_OPCODE(THROW) {
FIRST_HANDLE_OPCODE(THROW) {
DISPATCH_THROW();
}
HANDLE_OPCODE(WIDE) {
FIRST_HANDLE_OPCODE(WIDE) {
DISPATCH_WIDE();
}
HANDLE_OPCODE(DEPRECATED) {
FIRST_HANDLE_OPCODE(DEPRECATED) {
DISPATCH_DEPRECATED();
}
HANDLE_OPCODE(THROW_PREF_NONE) {
@ -4632,6 +4635,7 @@ NO_UB_SANITIZE void EcmaInterpreter::RunInternal(JSThread *thread, const uint8_t
JSFunction *currentFunc = JSFunction::Cast((GET_FRAME(sp)->function).GetTaggedObject());
jsFunc->SetModule(thread, currentFunc->GetModule());
jsFunc->SetHomeObject(thread, currentFunc->GetHomeObject());
SET_ACC(JSTaggedValue(jsFunc));
DISPATCH(DEFINEFUNC_IMM8_ID16_IMM8);
@ -4655,6 +4659,7 @@ NO_UB_SANITIZE void EcmaInterpreter::RunInternal(JSThread *thread, const uint8_t
JSFunction *currentFunc = JSFunction::Cast((GET_FRAME(sp)->function).GetTaggedObject());
jsFunc->SetModule(thread, currentFunc->GetModule());
jsFunc->SetHomeObject(thread, currentFunc->GetHomeObject());
SET_ACC(JSTaggedValue(jsFunc));
DISPATCH(DEFINEFUNC_IMM16_ID16_IMM8);