mirror of
https://gitee.com/openharmony/arkcompiler_ets_runtime
synced 2024-10-07 08:03:29 +00:00
reason:enable interpreterAsm Gc
Description:save leaveframe on thread leaveframe and save pc before callruntime issue:https://gitee.com/openharmony/ark_js_runtime/issues/I4XCL5?from=project-issue Signed-off-by: wupengyong <wupengyong@huawei.com> Change-Id: I770f18facaeb7e62f5dc02f280828a8f6a420b6f
This commit is contained in:
parent
e10df01e62
commit
db0aa88cac
@ -339,7 +339,7 @@ GateRef CircuitBuilder::NewRuntimeCallGate(GateRef glue, GateRef target,
|
||||
inputs.push_back(arg);
|
||||
}
|
||||
OpCode opcode(OpCode::RUNTIME_CALL);
|
||||
StubDescriptor *descriptor = GET_STUBDESCRIPTOR(RuntimeCallTrampoline);
|
||||
StubDescriptor *descriptor = GET_STUBDESCRIPTOR(RuntimeCallTrampolineAot);
|
||||
MachineType machineType = GetCallMachineTypeFromVariableType(descriptor->GetReturnType());
|
||||
GateType type = VariableType2GateType(descriptor->GetReturnType());
|
||||
// 2 : 2 means extra two input gates (target glue)
|
||||
|
@ -159,7 +159,8 @@ namespace panda::ecmascript::kungfu {
|
||||
V(DefineGetterSetterByValue, 6) \
|
||||
V(SuperCall, 5) \
|
||||
I(DoubleToInt, 1) \
|
||||
I(RuntimeCallTrampoline, 3)
|
||||
I(RuntimeCallTrampolineAot, 3) \
|
||||
I(RuntimeCallTrampolineInterpreterAsm, 3)
|
||||
|
||||
// NOLINTNEXTLINE(cppcoreguidelines-macro-usage)
|
||||
|
||||
|
@ -155,6 +155,7 @@ DECLARE_ASM_HANDLER(HandleLdFalsePref)
|
||||
|
||||
DECLARE_ASM_HANDLER(HandleThrowDynPref)
|
||||
{
|
||||
SetPcToFrame(glue, GetFrame(sp), pc);
|
||||
CallRuntimeTrampoline(glue, GetInt64Constant(FAST_STUB_ID(ThrowDyn)), { acc });
|
||||
DISPATCH_LAST();
|
||||
}
|
||||
@ -312,6 +313,7 @@ DECLARE_ASM_HANDLER(HandleGetUnmappedArgsPref)
|
||||
{
|
||||
DEFVARIABLE(varAcc, VariableType::JS_ANY(), acc);
|
||||
auto env = GetEnvironment();
|
||||
SetPcToFrame(glue, GetFrame(sp), pc);
|
||||
GateRef res = CallRuntimeTrampoline(glue, GetInt64Constant(FAST_STUB_ID(GetUnmapedArgs)),
|
||||
{});
|
||||
Label isException(env);
|
||||
@ -331,6 +333,7 @@ DECLARE_ASM_HANDLER(HandleCopyRestArgsPrefImm16)
|
||||
DEFVARIABLE(varAcc, VariableType::JS_ANY(), acc);
|
||||
auto env = GetEnvironment();
|
||||
GateRef restIdx = ZExtInt16ToInt32(ReadInst16_1(pc));
|
||||
SetPcToFrame(glue, GetFrame(sp), pc);
|
||||
GateRef res = CallRuntimeTrampoline(glue, GetInt64Constant(FAST_STUB_ID(CopyRestArgs)),
|
||||
{ IntBuildTaggedTypeWithNoGC(restIdx) });
|
||||
Label isException(env);
|
||||
@ -351,6 +354,7 @@ DECLARE_ASM_HANDLER(HandleCreateArrayWithBufferPrefImm16)
|
||||
auto env = GetEnvironment();
|
||||
GateRef imm = ZExtInt16ToInt32(ReadInst16_1(pc));
|
||||
GateRef result = GetObjectFromConstPool(constpool, imm);
|
||||
SetPcToFrame(glue, GetFrame(sp), pc);
|
||||
GateRef res = CallRuntimeTrampoline(glue,
|
||||
GetInt64Constant(FAST_STUB_ID(CreateArrayWithBuffer)), { result });
|
||||
Label isException(env);
|
||||
@ -371,6 +375,7 @@ DECLARE_ASM_HANDLER(HandleCreateObjectWithBufferPrefImm16)
|
||||
auto env = GetEnvironment();
|
||||
GateRef imm = ZExtInt16ToInt32(ReadInst16_1(pc));
|
||||
GateRef result = GetObjectFromConstPool(constpool, imm);
|
||||
SetPcToFrame(glue, GetFrame(sp), pc);
|
||||
GateRef res = CallRuntimeTrampoline(glue,
|
||||
GetInt64Constant(FAST_STUB_ID(CreateObjectWithBuffer)), { result });
|
||||
Label isException(env);
|
||||
@ -392,6 +397,7 @@ DECLARE_ASM_HANDLER(HandleCreateObjectWithExcludedKeysPrefImm16V8V8)
|
||||
GateRef numKeys = ReadInst16_1(pc);
|
||||
GateRef obj = GetVregValue(sp, ZExtInt8ToPtr(ReadInst8_3(pc)));
|
||||
GateRef firstArgRegIdx = ZExtInt8ToInt16(ReadInst8_4(pc));
|
||||
SetPcToFrame(glue, GetFrame(sp), pc);
|
||||
GateRef res = CallRuntimeTrampoline(glue, GetInt64Constant(FAST_STUB_ID(CreateObjectWithExcludedKeys)),
|
||||
{ Int16BuildTaggedTypeWithNoGC(numKeys), obj, Int16BuildTaggedTypeWithNoGC(firstArgRegIdx) });
|
||||
Label isException(env);
|
||||
@ -412,6 +418,7 @@ DECLARE_ASM_HANDLER(HandleCreateObjectHavingMethodPrefImm16)
|
||||
auto env = GetEnvironment();
|
||||
GateRef imm = ZExtInt16ToInt32(ReadInst16_1(pc));
|
||||
GateRef result = GetObjectFromConstPool(constpool, imm);
|
||||
SetPcToFrame(glue, GetFrame(sp), pc);
|
||||
GateRef res = CallRuntimeTrampoline(glue, GetInt64Constant(FAST_STUB_ID(CreateObjectHavingMethod)),
|
||||
{ result, acc, constpool }); // acc is env
|
||||
Label isException(env);
|
||||
@ -430,6 +437,7 @@ DECLARE_ASM_HANDLER(HandleThrowIfSuperNotCorrectCallPrefImm16)
|
||||
{
|
||||
auto env = GetEnvironment();
|
||||
GateRef imm = ReadInst16_1(pc);
|
||||
SetPcToFrame(glue, GetFrame(sp), pc);
|
||||
GateRef res = CallRuntimeTrampoline(glue, GetInt64Constant(FAST_STUB_ID(ThrowIfSuperNotCorrectCall)),
|
||||
{ Int16BuildTaggedTypeWithNoGC(imm), acc }); // acc is thisValue
|
||||
Label isException(env);
|
||||
@ -448,6 +456,7 @@ DECLARE_ASM_HANDLER(HandleNewLexEnvDynPrefImm16)
|
||||
DEFVARIABLE(varAcc, VariableType::JS_ANY(), acc);
|
||||
auto env = GetEnvironment();
|
||||
GateRef numVars = ReadInst16_1(pc);
|
||||
SetPcToFrame(glue, GetFrame(sp), pc);
|
||||
GateRef res = CallRuntimeTrampoline(glue, GetInt64Constant(FAST_STUB_ID(NewLexicalEnvDyn)),
|
||||
{ Int16BuildTaggedTypeWithNoGC(numVars) });
|
||||
Label isException(env);
|
||||
@ -474,6 +483,7 @@ DECLARE_ASM_HANDLER(HandleNewObjDynRangePrefImm16V8)
|
||||
GateRef newTarget = GetVregValue(sp, IntPtrAdd(ZExtInt16ToPtr(firstArgRegIdx), GetIntPtrConstant(1)));
|
||||
GateRef firstArgIdx = Int16Add(firstArgRegIdx, firstArgOffset);
|
||||
GateRef length = Int16Sub(numArgs, firstArgOffset);
|
||||
SetPcToFrame(glue, GetFrame(sp), pc);
|
||||
GateRef res = CallRuntimeTrampoline(glue, GetInt64Constant(FAST_STUB_ID(NewObjDynRange)),
|
||||
{ func, newTarget, Int16BuildTaggedTypeWithNoGC(firstArgIdx), Int16BuildTaggedTypeWithNoGC(length) });
|
||||
Label isException(env);
|
||||
@ -503,6 +513,7 @@ DECLARE_ASM_HANDLER(HandleDefineFuncDynPrefId16Imm16V8)
|
||||
Branch(FunctionIsResolved(*result), &isResolved, ¬Resolved);
|
||||
Bind(&isResolved);
|
||||
{
|
||||
SetPcToFrame(glue, GetFrame(sp), pc);
|
||||
result = CallRuntimeTrampoline(glue,
|
||||
GetInt64Constant(FAST_STUB_ID(DefinefuncDyn)), { *result });
|
||||
Label isException(env);
|
||||
@ -550,6 +561,7 @@ DECLARE_ASM_HANDLER(HandleDefineNCFuncDynPrefId16Imm16V8)
|
||||
Branch(FunctionIsResolved(*result), &isResolved, ¬Resolved);
|
||||
Bind(&isResolved);
|
||||
{
|
||||
SetPcToFrame(glue, GetFrame(sp), pc);
|
||||
result = CallRuntimeTrampoline(glue,
|
||||
GetInt64Constant(FAST_STUB_ID(DefineNCFuncDyn)), { *result });
|
||||
Label isException(env);
|
||||
@ -598,6 +610,7 @@ DECLARE_ASM_HANDLER(HandleDefineGeneratorFuncPrefId16Imm16V8)
|
||||
Branch(FunctionIsResolved(*result), &isResolved, ¬Resolved);
|
||||
Bind(&isResolved);
|
||||
{
|
||||
SetPcToFrame(glue, GetFrame(sp), pc);
|
||||
result = CallRuntimeTrampoline(glue,
|
||||
GetInt64Constant(FAST_STUB_ID(DefineGeneratorFunc)), { *result });
|
||||
Label isException(env);
|
||||
@ -645,6 +658,7 @@ DECLARE_ASM_HANDLER(HandleDefineAsyncFuncPrefId16Imm16V8)
|
||||
Branch(FunctionIsResolved(*result), &isResolved, ¬Resolved);
|
||||
Bind(&isResolved);
|
||||
{
|
||||
SetPcToFrame(glue, GetFrame(sp), pc);
|
||||
result = CallRuntimeTrampoline(glue,
|
||||
GetInt64Constant(FAST_STUB_ID(DefineAsyncFunc)), { *result });
|
||||
Label isException(env);
|
||||
@ -692,6 +706,7 @@ DECLARE_ASM_HANDLER(HandleDefineMethodPrefId16Imm16V8)
|
||||
Branch(FunctionIsResolved(*result), &isResolved, ¬Resolved);
|
||||
Bind(&isResolved);
|
||||
{
|
||||
SetPcToFrame(glue, GetFrame(sp), pc);
|
||||
result = CallRuntimeTrampoline(glue, GetInt64Constant(FAST_STUB_ID(DefineMethod)),
|
||||
{ *result, acc }); // acc is homeObject
|
||||
Label isException(env);
|
||||
@ -732,6 +747,7 @@ DECLARE_ASM_HANDLER(HandleCallSpreadDynPrefV8V8V8)
|
||||
GateRef func = GetVregValue(sp, ZExtInt8ToPtr(ReadInst8_1(pc)));
|
||||
GateRef obj = GetVregValue(sp, ZExtInt8ToPtr(ReadInst8_2(pc)));
|
||||
GateRef array = GetVregValue(sp, ZExtInt8ToPtr(ReadInst8_3(pc)));
|
||||
SetPcToFrame(glue, GetFrame(sp), pc);
|
||||
GateRef res = CallRuntimeTrampoline(glue, GetInt64Constant(FAST_STUB_ID(CallSpreadDyn)),
|
||||
{ func, obj, array });
|
||||
Label isException(env);
|
||||
@ -754,6 +770,7 @@ DECLARE_ASM_HANDLER(HandleAsyncFunctionResolvePrefV8V8V8)
|
||||
auto env = GetEnvironment();
|
||||
GateRef asyncFuncObj = GetVregValue(sp, ZExtInt8ToPtr(ReadInst8_1(pc)));
|
||||
GateRef value = GetVregValue(sp, ZExtInt8ToPtr(ReadInst8_3(pc)));
|
||||
SetPcToFrame(glue, GetFrame(sp), pc);
|
||||
GateRef res = CallRuntimeTrampoline(glue, GetInt64Constant(FAST_STUB_ID(AsyncFunctionResolveOrReject)),
|
||||
{ asyncFuncObj, value, TaggedTrue() });
|
||||
Label isException(env);
|
||||
@ -775,6 +792,7 @@ DECLARE_ASM_HANDLER(HandleAsyncFunctionRejectPrefV8V8V8)
|
||||
auto env = GetEnvironment();
|
||||
GateRef asyncFuncObj = GetVregValue(sp, ZExtInt8ToPtr(ReadInst8_1(pc)));
|
||||
GateRef value = GetVregValue(sp, ZExtInt8ToPtr(ReadInst8_3(pc)));
|
||||
SetPcToFrame(glue, GetFrame(sp), pc);
|
||||
GateRef res = CallRuntimeTrampoline(glue, GetInt64Constant(FAST_STUB_ID(AsyncFunctionResolveOrReject)),
|
||||
{ asyncFuncObj, value, TaggedFalse() });
|
||||
Label isException(env);
|
||||
@ -798,6 +816,7 @@ DECLARE_ASM_HANDLER(HandleDefineGetterSetterByValuePrefV8V8V8V8)
|
||||
GateRef prop = GetVregValue(sp, ZExtInt8ToPtr(ReadInst8_2(pc)));
|
||||
GateRef getter = GetVregValue(sp, ZExtInt8ToPtr(ReadInst8_3(pc)));
|
||||
GateRef setter = GetVregValue(sp, ZExtInt8ToPtr(ReadInst8_4(pc)));
|
||||
SetPcToFrame(glue, GetFrame(sp), pc);
|
||||
GateRef res = CallRuntimeTrampoline(glue, GetInt64Constant(FAST_STUB_ID(DefineGetterSetterByValue)),
|
||||
{ obj, prop, getter, setter, acc }); // acc is flag
|
||||
Label isException(env);
|
||||
@ -820,6 +839,7 @@ DECLARE_ASM_HANDLER(HandleSuperCallPrefImm16V8)
|
||||
auto env = GetEnvironment();
|
||||
GateRef range = ReadInst16_1(pc);
|
||||
GateRef v0 = ZExtInt8ToInt16(ReadInst8_3(pc));
|
||||
SetPcToFrame(glue, GetFrame(sp), pc);
|
||||
// acc is thisFunc
|
||||
GateRef res = CallRuntimeTrampoline(glue, GetInt64Constant(FAST_STUB_ID(SuperCall)),
|
||||
{ acc, Int16BuildTaggedTypeWithNoGC(v0), Int16BuildTaggedTypeWithNoGC(range) });
|
||||
@ -841,7 +861,7 @@ DECLARE_ASM_HANDLER(HandleGetPropIteratorPref)
|
||||
{
|
||||
DEFVARIABLE(varAcc, VariableType::JS_ANY(), acc);
|
||||
auto env = GetEnvironment();
|
||||
|
||||
SetPcToFrame(glue, GetFrame(sp), pc);
|
||||
GateRef res = CallRuntimeTrampoline(glue, GetInt64Constant(FAST_STUB_ID(GetPropIterator)), { *varAcc });
|
||||
Label isException(env);
|
||||
Label notException(env);
|
||||
@ -859,6 +879,7 @@ DECLARE_ASM_HANDLER(HandleAsyncFunctionEnterPref)
|
||||
{
|
||||
DEFVARIABLE(varAcc, VariableType::JS_ANY(), acc);
|
||||
auto env = GetEnvironment();
|
||||
SetPcToFrame(glue, GetFrame(sp), pc);
|
||||
GateRef res = CallRuntimeTrampoline(glue, GetInt64Constant(FAST_STUB_ID(AsyncFunctionEnter)), {});
|
||||
Label isException(env);
|
||||
Label notException(env);
|
||||
@ -912,6 +933,7 @@ DECLARE_ASM_HANDLER(HandleGetIteratorPref)
|
||||
}
|
||||
Bind(¬GeneratorObj);
|
||||
{
|
||||
SetPcToFrame(glue, GetFrame(sp), pc);
|
||||
GateRef res = CallRuntimeTrampoline(glue, GetInt64Constant(FAST_STUB_ID(GetIterator)), { *varAcc });
|
||||
Label isException(env);
|
||||
Label notException(env);
|
||||
@ -930,12 +952,14 @@ DECLARE_ASM_HANDLER(HandleGetIteratorPref)
|
||||
|
||||
DECLARE_ASM_HANDLER(HandleThrowThrowNotExistsPref)
|
||||
{
|
||||
SetPcToFrame(glue, GetFrame(sp), pc);
|
||||
CallRuntimeTrampoline(glue, GetInt64Constant(FAST_STUB_ID(ThrowThrowNotExists)), {});
|
||||
DISPATCH_LAST();
|
||||
}
|
||||
|
||||
DECLARE_ASM_HANDLER(HandleThrowPatternNonCoerciblePref)
|
||||
{
|
||||
SetPcToFrame(glue, GetFrame(sp), pc);
|
||||
CallRuntimeTrampoline(glue, GetInt64Constant(FAST_STUB_ID(ThrowPatternNonCoercible)), {});
|
||||
DISPATCH_LAST();
|
||||
}
|
||||
@ -950,6 +974,7 @@ DECLARE_ASM_HANDLER(HandleLdHomeObjectPref)
|
||||
|
||||
DECLARE_ASM_HANDLER(HandleThrowDeleteSuperPropertyPref)
|
||||
{
|
||||
SetPcToFrame(glue, GetFrame(sp), pc);
|
||||
CallRuntimeTrampoline(glue, GetInt64Constant(FAST_STUB_ID(ThrowDeleteSuperProperty)), {});
|
||||
DISPATCH_LAST();
|
||||
}
|
||||
@ -973,6 +998,7 @@ DECLARE_ASM_HANDLER(HandleMul2DynPrefV8)
|
||||
Branch(TaggedIsHole(*result), &isHole, ¬Hole);
|
||||
Bind(&isHole);
|
||||
{
|
||||
SetPcToFrame(glue, GetFrame(sp), pc);
|
||||
// slow path
|
||||
result = CallRuntimeTrampoline(glue, GetInt64Constant(FAST_STUB_ID(Mul2Dyn)), { left, acc });
|
||||
Label isException(env);
|
||||
@ -1011,6 +1037,7 @@ DECLARE_ASM_HANDLER(HandleDiv2DynPrefV8)
|
||||
Branch(TaggedIsHole(*result), &isHole, ¬Hole);
|
||||
Bind(&isHole);
|
||||
{
|
||||
SetPcToFrame(glue, GetFrame(sp), pc);
|
||||
// slow path
|
||||
result = CallRuntimeTrampoline(glue, GetInt64Constant(FAST_STUB_ID(Div2Dyn)), { left, acc });
|
||||
Label isException(env);
|
||||
@ -1049,6 +1076,7 @@ DECLARE_ASM_HANDLER(HandleMod2DynPrefV8)
|
||||
Branch(TaggedIsHole(*result), &isHole, ¬Hole);
|
||||
Bind(&isHole);
|
||||
{
|
||||
SetPcToFrame(glue, GetFrame(sp), pc);
|
||||
// slow path
|
||||
result = CallRuntimeTrampoline(glue, GetInt64Constant(FAST_STUB_ID(Mod2Dyn)), { left, acc });
|
||||
Label isException(env);
|
||||
@ -1087,6 +1115,7 @@ DECLARE_ASM_HANDLER(HandleEqDynPrefV8)
|
||||
Branch(TaggedIsHole(*result), &isHole, ¬Hole);
|
||||
Bind(&isHole);
|
||||
{
|
||||
SetPcToFrame(glue, GetFrame(sp), pc);
|
||||
// slow path
|
||||
result = CallRuntimeTrampoline(glue, GetInt64Constant(FAST_STUB_ID(EqDyn)), { left, acc });
|
||||
Label isException(env);
|
||||
@ -1125,6 +1154,7 @@ DECLARE_ASM_HANDLER(HandleNotEqDynPrefV8)
|
||||
Branch(TaggedIsHole(*result), &isHole, ¬Hole);
|
||||
Bind(&isHole);
|
||||
{
|
||||
SetPcToFrame(glue, GetFrame(sp), pc);
|
||||
// slow path
|
||||
result = CallRuntimeTrampoline(glue, GetInt64Constant(FAST_STUB_ID(NotEqDyn)), { left, acc });
|
||||
Label isException(env);
|
||||
@ -1247,6 +1277,7 @@ DECLARE_ASM_HANDLER(HandleLessDynPrefV8)
|
||||
}
|
||||
Bind(&slowPath);
|
||||
{
|
||||
SetPcToFrame(glue, GetFrame(sp), pc);
|
||||
// slow path
|
||||
GateRef result = CallRuntimeTrampoline(glue, GetInt64Constant(FAST_STUB_ID(LessDyn)), { left, acc });
|
||||
Label isException(env);
|
||||
@ -1353,6 +1384,7 @@ DECLARE_ASM_HANDLER(HandleLessEqDynPrefV8)
|
||||
}
|
||||
Bind(&slowPath);
|
||||
{
|
||||
SetPcToFrame(glue, GetFrame(sp), pc);
|
||||
// slow path
|
||||
GateRef result = CallRuntimeTrampoline(glue, GetInt64Constant(FAST_STUB_ID(LessEqDyn)), { left, acc });
|
||||
Label isException(env);
|
||||
@ -1459,6 +1491,7 @@ DECLARE_ASM_HANDLER(HandleGreaterDynPrefV8)
|
||||
}
|
||||
Bind(&slowPath);
|
||||
{
|
||||
SetPcToFrame(glue, GetFrame(sp), pc);
|
||||
// slow path
|
||||
GateRef result = CallRuntimeTrampoline(glue, GetInt64Constant(FAST_STUB_ID(GreaterDyn)), { left, acc });
|
||||
Label isException(env);
|
||||
@ -1566,6 +1599,7 @@ DECLARE_ASM_HANDLER(HandleGreaterEqDynPrefV8)
|
||||
}
|
||||
Bind(&slowPath);
|
||||
{
|
||||
SetPcToFrame(glue, GetFrame(sp), pc);
|
||||
// slow path
|
||||
GateRef result = CallRuntimeTrampoline(glue, GetInt64Constant(FAST_STUB_ID(GreaterEqDyn)), { left, acc });
|
||||
Label isException(env);
|
||||
@ -1888,6 +1922,7 @@ DECLARE_ASM_HANDLER(HandleIncDynPrefV8)
|
||||
Bind(&valueNotDouble);
|
||||
}
|
||||
{
|
||||
SetPcToFrame(glue, GetFrame(sp), pc);
|
||||
// slow path
|
||||
GateRef result = CallRuntimeTrampoline(glue, GetInt64Constant(FAST_STUB_ID(IncDyn)), { value });
|
||||
Label isException(env);
|
||||
@ -1942,6 +1977,7 @@ DECLARE_ASM_HANDLER(HandleDecDynPrefV8)
|
||||
Bind(&valueNotDouble);
|
||||
}
|
||||
{
|
||||
SetPcToFrame(glue, GetFrame(sp), pc);
|
||||
// slow path
|
||||
GateRef result = CallRuntimeTrampoline(glue, GetInt64Constant(FAST_STUB_ID(DecDyn)), { value });
|
||||
Label isException(env);
|
||||
@ -1967,6 +2003,7 @@ DECLARE_ASM_HANDLER(HandleExpDynPrefV8)
|
||||
|
||||
GateRef v0 = ReadInst8_1(pc);
|
||||
GateRef base = GetVregValue(sp, ZExtInt8ToPtr(v0));
|
||||
SetPcToFrame(glue, GetFrame(sp), pc);
|
||||
GateRef result = CallRuntimeTrampoline(glue, GetInt64Constant(FAST_STUB_ID(ExpDyn)),
|
||||
{ base, acc }); // acc is exponent
|
||||
Label isException(env);
|
||||
@ -1988,6 +2025,7 @@ DECLARE_ASM_HANDLER(HandleIsInDynPrefV8)
|
||||
|
||||
GateRef v0 = ReadInst8_1(pc);
|
||||
GateRef prop = GetVregValue(sp, ZExtInt8ToPtr(v0));
|
||||
SetPcToFrame(glue, GetFrame(sp), pc);
|
||||
GateRef result = CallRuntimeTrampoline(glue, GetInt64Constant(FAST_STUB_ID(IsInDyn)),
|
||||
{ prop, acc }); // acc is obj
|
||||
Label isException(env);
|
||||
@ -2009,6 +2047,7 @@ DECLARE_ASM_HANDLER(HandleInstanceOfDynPrefV8)
|
||||
|
||||
GateRef v0 = ReadInst8_1(pc);
|
||||
GateRef obj = GetVregValue(sp, ZExtInt8ToPtr(v0));
|
||||
SetPcToFrame(glue, GetFrame(sp), pc);
|
||||
GateRef result = CallRuntimeTrampoline(glue, GetInt64Constant(FAST_STUB_ID(InstanceOfDyn)),
|
||||
{ obj, acc }); // acc is target
|
||||
Label isException(env);
|
||||
@ -2075,6 +2114,7 @@ DECLARE_ASM_HANDLER(HandleCreateGeneratorObjPrefV8)
|
||||
|
||||
GateRef v0 = ReadInst8_1(pc);
|
||||
GateRef genFunc = GetVregValue(sp, ZExtInt8ToPtr(v0));
|
||||
SetPcToFrame(glue, GetFrame(sp), pc);
|
||||
GateRef result = CallRuntimeTrampoline(glue, GetInt64Constant(FAST_STUB_ID(CreateGeneratorObj)),
|
||||
{ genFunc });
|
||||
Label isException(env);
|
||||
@ -2093,6 +2133,7 @@ DECLARE_ASM_HANDLER(HandleThrowConstAssignmentPrefV8)
|
||||
{
|
||||
GateRef v0 = ReadInst8_1(pc);
|
||||
GateRef value = GetVregValue(sp, ZExtInt8ToPtr(v0));
|
||||
SetPcToFrame(glue, GetFrame(sp), pc);
|
||||
CallRuntimeTrampoline(glue, GetInt64Constant(FAST_STUB_ID(ThrowConstAssignment)), { value });
|
||||
DISPATCH_LAST();
|
||||
}
|
||||
@ -2124,6 +2165,7 @@ DECLARE_ASM_HANDLER(HandleGetNextPropNamePrefV8)
|
||||
|
||||
GateRef v0 = ReadInst8_1(pc);
|
||||
GateRef iter = GetVregValue(sp, ZExtInt8ToPtr(v0));
|
||||
SetPcToFrame(glue, GetFrame(sp), pc);
|
||||
GateRef result = CallRuntimeTrampoline(glue, GetInt64Constant(FAST_STUB_ID(GetNextPropName)), { iter });
|
||||
Label isException(env);
|
||||
Label notException(env);
|
||||
@ -2151,6 +2193,7 @@ DECLARE_ASM_HANDLER(HandleThrowIfNotObjectPrefV8)
|
||||
DISPATCH(PREF_V8);
|
||||
}
|
||||
Bind(¬EcmaObject);
|
||||
SetPcToFrame(glue, GetFrame(sp), pc);
|
||||
CallRuntimeTrampoline(glue, GetInt64Constant(FAST_STUB_ID(ThrowIfNotObject)), {});
|
||||
DISPATCH_LAST();
|
||||
}
|
||||
@ -2162,6 +2205,7 @@ DECLARE_ASM_HANDLER(HandleIterNextPrefV8)
|
||||
|
||||
GateRef v0 = ReadInst8_1(pc);
|
||||
GateRef iter = GetVregValue(sp, ZExtInt8ToPtr(v0));
|
||||
SetPcToFrame(glue, GetFrame(sp), pc);
|
||||
GateRef result = CallRuntimeTrampoline(glue, GetInt64Constant(FAST_STUB_ID(IterNext)), { iter });
|
||||
Label isException(env);
|
||||
Label notException(env);
|
||||
@ -2182,6 +2226,7 @@ DECLARE_ASM_HANDLER(HandleCloseIteratorPrefV8)
|
||||
|
||||
GateRef v0 = ReadInst8_1(pc);
|
||||
GateRef iter = GetVregValue(sp, ZExtInt8ToPtr(v0));
|
||||
SetPcToFrame(glue, GetFrame(sp), pc);
|
||||
GateRef result = CallRuntimeTrampoline(glue, GetInt64Constant(FAST_STUB_ID(CloseIterator)), { iter });
|
||||
Label isException(env);
|
||||
Label notException(env);
|
||||
@ -2207,6 +2252,7 @@ DECLARE_ASM_HANDLER(HandleSuperCallSpreadPrefV8)
|
||||
|
||||
GateRef v0 = ReadInst8_1(pc);
|
||||
GateRef array = GetVregValue(sp, ZExtInt8ToPtr(v0));
|
||||
SetPcToFrame(glue, GetFrame(sp), pc);
|
||||
GateRef result = CallRuntimeTrampoline(glue, GetInt64Constant(FAST_STUB_ID(SuperCallSpread)),
|
||||
{ acc, array }); // acc is thisFunc, sp for newTarget
|
||||
Label isException(env);
|
||||
@ -2230,6 +2276,7 @@ DECLARE_ASM_HANDLER(HandleDelObjPropPrefV8V8)
|
||||
GateRef v1 = ReadInst8_2(pc);
|
||||
GateRef obj = GetVregValue(sp, ZExtInt8ToPtr(v0));
|
||||
GateRef prop = GetVregValue(sp, ZExtInt8ToPtr(v1));
|
||||
SetPcToFrame(glue, GetFrame(sp), pc);
|
||||
GateRef result = CallRuntimeTrampoline(glue, GetInt64Constant(FAST_STUB_ID(DelObjProp)),
|
||||
{ obj, prop });
|
||||
Label isException(env);
|
||||
@ -2253,6 +2300,7 @@ DECLARE_ASM_HANDLER(HandleNewObjSpreadDynPrefV8V8)
|
||||
GateRef v1 = ReadInst8_2(pc);
|
||||
GateRef func = GetVregValue(sp, ZExtInt8ToPtr(v0));
|
||||
GateRef newTarget = GetVregValue(sp, ZExtInt8ToPtr(v1));
|
||||
SetPcToFrame(glue, GetFrame(sp), pc);
|
||||
GateRef result = CallRuntimeTrampoline(glue, GetInt64Constant(FAST_STUB_ID(NewObjSpreadDyn)),
|
||||
{ func, newTarget, acc }); // acc is array
|
||||
Label isException(env);
|
||||
@ -2276,6 +2324,7 @@ DECLARE_ASM_HANDLER(HandleCreateIterResultObjPrefV8V8)
|
||||
GateRef v1 = ReadInst8_2(pc);
|
||||
GateRef value = GetVregValue(sp, ZExtInt8ToPtr(v0));
|
||||
GateRef flag = GetVregValue(sp, ZExtInt8ToPtr(v1));
|
||||
SetPcToFrame(glue, GetFrame(sp), pc);
|
||||
GateRef result = CallRuntimeTrampoline(glue, GetInt64Constant(FAST_STUB_ID(CreateIterResultObj)),
|
||||
{ value, flag });
|
||||
Label isException(env);
|
||||
@ -2299,6 +2348,7 @@ DECLARE_ASM_HANDLER(HandleAsyncFunctionAwaitUncaughtPrefV8V8)
|
||||
GateRef v1 = ReadInst8_2(pc);
|
||||
GateRef asyncFuncObj = GetVregValue(sp, ZExtInt8ToPtr(v0));
|
||||
GateRef value = GetVregValue(sp, ZExtInt8ToPtr(v1));
|
||||
SetPcToFrame(glue, GetFrame(sp), pc);
|
||||
GateRef result = CallRuntimeTrampoline(glue, GetInt64Constant(FAST_STUB_ID(AsyncFunctionAwaitUncaught)),
|
||||
{ asyncFuncObj, value });
|
||||
Label isException(env);
|
||||
@ -2329,6 +2379,7 @@ DECLARE_ASM_HANDLER(HandleThrowUndefinedIfHolePrefV8V8)
|
||||
}
|
||||
Bind(&isHole);
|
||||
GateRef obj = GetVregValue(sp, ZExtInt8ToPtr(v1));
|
||||
SetPcToFrame(glue, GetFrame(sp), pc);
|
||||
// assert obj.IsString()
|
||||
CallRuntimeTrampoline(glue, GetInt64Constant(FAST_STUB_ID(ThrowUndefinedIfHole)), { obj });
|
||||
DISPATCH_LAST();
|
||||
@ -2343,6 +2394,7 @@ DECLARE_ASM_HANDLER(HandleCopyDataPropertiesPrefV8V8)
|
||||
GateRef v1 = ReadInst8_2(pc);
|
||||
GateRef dst = GetVregValue(sp, ZExtInt8ToPtr(v0));
|
||||
GateRef src = GetVregValue(sp, ZExtInt8ToPtr(v1));
|
||||
SetPcToFrame(glue, GetFrame(sp), pc);
|
||||
GateRef result = CallRuntimeTrampoline(glue, GetInt64Constant(FAST_STUB_ID(CopyDataProperties)),
|
||||
{ dst, src });
|
||||
Label isException(env);
|
||||
@ -2366,6 +2418,7 @@ DECLARE_ASM_HANDLER(HandleStArraySpreadPrefV8V8)
|
||||
GateRef v1 = ReadInst8_2(pc);
|
||||
GateRef dst = GetVregValue(sp, ZExtInt8ToPtr(v0));
|
||||
GateRef index = GetVregValue(sp, ZExtInt8ToPtr(v1));
|
||||
SetPcToFrame(glue, GetFrame(sp), pc);
|
||||
GateRef result = CallRuntimeTrampoline(glue, GetInt64Constant(FAST_STUB_ID(StArraySpread)),
|
||||
{ dst, index, acc }); // acc is res
|
||||
Label isException(env);
|
||||
@ -2389,6 +2442,7 @@ DECLARE_ASM_HANDLER(HandleGetIteratorNextPrefV8V8)
|
||||
GateRef v1 = ReadInst8_2(pc);
|
||||
GateRef obj = GetVregValue(sp, ZExtInt8ToPtr(v0));
|
||||
GateRef method = GetVregValue(sp, ZExtInt8ToPtr(v1));
|
||||
SetPcToFrame(glue, GetFrame(sp), pc);
|
||||
GateRef result = CallRuntimeTrampoline(glue, GetInt64Constant(FAST_STUB_ID(GetIteratorNext)),
|
||||
{ obj, method });
|
||||
Label isException(env);
|
||||
@ -2412,6 +2466,7 @@ DECLARE_ASM_HANDLER(HandleSetObjectWithProtoPrefV8V8)
|
||||
GateRef v1 = ReadInst8_2(pc);
|
||||
GateRef proto = GetVregValue(sp, ZExtInt8ToPtr(v0));
|
||||
GateRef obj = GetVregValue(sp, ZExtInt8ToPtr(v1));
|
||||
SetPcToFrame(glue, GetFrame(sp), pc);
|
||||
GateRef result = CallRuntimeTrampoline(glue, GetInt64Constant(FAST_STUB_ID(SetObjectWithProto)),
|
||||
{ proto, obj });
|
||||
Label isException(env);
|
||||
@ -2440,6 +2495,7 @@ DECLARE_ASM_HANDLER(HandleLdObjByValuePrefV8V8)
|
||||
Label slowPath(env);
|
||||
Label isException(env);
|
||||
Label accDispatch(env);
|
||||
SetPcToFrame(glue, GetFrame(sp), pc);
|
||||
Branch(TaggedIsHeapObject(receiver), &receiverIsHeapObject, &slowPath);
|
||||
Bind(&receiverIsHeapObject);
|
||||
{
|
||||
@ -2541,6 +2597,7 @@ DECLARE_ASM_HANDLER(HandleStObjByValuePrefV8V8)
|
||||
Label slowPath(env);
|
||||
Label isException(env);
|
||||
Label notException(env);
|
||||
SetPcToFrame(glue, GetFrame(sp), pc);
|
||||
Branch(TaggedIsHeapObject(receiver), &receiverIsHeapObject, &slowPath);
|
||||
Bind(&receiverIsHeapObject);
|
||||
{
|
||||
@ -2631,6 +2688,7 @@ DECLARE_ASM_HANDLER(HandleStOwnByValuePrefV8V8)
|
||||
Branch(IsClassConstructor(receiver), &slowPath, ¬ClassConstructor);
|
||||
Bind(¬ClassConstructor);
|
||||
Label notClassPrototype(env);
|
||||
SetPcToFrame(glue, GetFrame(sp), pc);
|
||||
Branch(IsClassPrototype(receiver), &slowPath, ¬ClassPrototype);
|
||||
Bind(¬ClassPrototype);
|
||||
{
|
||||
@ -2666,6 +2724,7 @@ DECLARE_ASM_HANDLER(HandleLdSuperByValuePrefV8V8)
|
||||
GateRef v1 = ReadInst8_2(pc);
|
||||
GateRef receiver = GetVregValue(sp, ZExtInt8ToPtr(v0));
|
||||
GateRef propKey = GetVregValue(sp, ZExtInt8ToPtr(v1));
|
||||
SetPcToFrame(glue, GetFrame(sp), pc);
|
||||
GateRef result = CallRuntimeTrampoline(glue, GetInt64Constant(FAST_STUB_ID(LdSuperByValue)),
|
||||
{ receiver, propKey }); // sp for thisFunc
|
||||
Label isException(env);
|
||||
@ -2693,6 +2752,7 @@ DECLARE_ASM_HANDLER(HandleStSuperByValuePrefV8V8)
|
||||
{ receiver, propKey, acc });
|
||||
Label isException(env);
|
||||
Label notException(env);
|
||||
SetPcToFrame(glue, GetFrame(sp), pc);
|
||||
Branch(TaggedIsException(result), &isException, ¬Exception);
|
||||
Bind(&isException);
|
||||
{
|
||||
@ -2714,7 +2774,7 @@ DECLARE_ASM_HANDLER(HandleLdSuperByNamePrefId32V8)
|
||||
GateRef v0 = ReadInst8_5(pc);
|
||||
GateRef receiver = GetVregValue(sp, ZExtInt8ToPtr(v0));
|
||||
GateRef propKey = GetObjectFromConstPool(constpool, stringId);
|
||||
|
||||
SetPcToFrame(glue, GetFrame(sp), pc);
|
||||
GateRef result = CallRuntimeTrampoline(glue, GetInt64Constant(FAST_STUB_ID(LdSuperByValue)),
|
||||
{ receiver, propKey }); // sp for thisFunc
|
||||
Branch(TaggedIsException(result), &isException, &dispatch);
|
||||
@ -2738,7 +2798,7 @@ DECLARE_ASM_HANDLER(HandleStSuperByNamePrefId32V8)
|
||||
GateRef v0 = ReadInst8_5(pc);
|
||||
GateRef receiver = GetVregValue(sp, ZExtInt8ToPtr(v0));
|
||||
GateRef propKey = GetObjectFromConstPool(constpool, stringId);
|
||||
|
||||
SetPcToFrame(glue, GetFrame(sp), pc);
|
||||
GateRef result = CallRuntimeTrampoline(glue, GetInt64Constant(FAST_STUB_ID(StSuperByValue)),
|
||||
{ receiver, propKey, acc }); // sp for thisFunc
|
||||
Branch(TaggedIsException(result), &isException, &dispatch);
|
||||
@ -2762,6 +2822,7 @@ DECLARE_ASM_HANDLER(HandleLdObjByIndexPrefV8Imm32)
|
||||
Label slowPath(env);
|
||||
Label isException(env);
|
||||
Label accDispatch(env);
|
||||
SetPcToFrame(glue, GetFrame(sp), pc);
|
||||
Branch(TaggedIsHeapObject(receiver), &fastPath, &slowPath);
|
||||
Bind(&fastPath);
|
||||
{
|
||||
@ -2806,6 +2867,7 @@ DECLARE_ASM_HANDLER(HandleStObjByIndexPrefV8Imm32)
|
||||
Label slowPath(env);
|
||||
Label isException(env);
|
||||
Label notException(env);
|
||||
SetPcToFrame(glue, GetFrame(sp), pc);
|
||||
Branch(TaggedIsHeapObject(receiver), &fastPath, &slowPath);
|
||||
Bind(&fastPath);
|
||||
{
|
||||
@ -2842,6 +2904,7 @@ DECLARE_ASM_HANDLER(HandleStOwnByIndexPrefV8Imm32)
|
||||
Label slowPath(env);
|
||||
Label isException(env);
|
||||
Label notException(env);
|
||||
SetPcToFrame(glue, GetFrame(sp), pc);
|
||||
Branch(TaggedIsHeapObject(receiver), &isHeapObject, &slowPath);
|
||||
Bind(&isHeapObject);
|
||||
Label notClassConstructor(env);
|
||||
@ -2883,6 +2946,7 @@ DECLARE_ASM_HANDLER(HandleStConstToGlobalRecordPrefId32)
|
||||
Label notException(env);
|
||||
GateRef stringId = ReadInst32_1(pc);
|
||||
GateRef propKey = GetValueFromTaggedArray(VariableType::JS_ANY(), constpool, stringId);
|
||||
SetPcToFrame(glue, GetFrame(sp), pc);
|
||||
GateRef result = CallRuntimeTrampoline(glue, GetInt64Constant(FAST_STUB_ID(StGlobalRecord)),
|
||||
{ propKey, *varAcc, TaggedTrue() });
|
||||
Branch(TaggedIsException(result), &isException, ¬Exception);
|
||||
@ -2903,6 +2967,7 @@ DECLARE_ASM_HANDLER(HandleStLetToGlobalRecordPrefId32)
|
||||
Label notException(env);
|
||||
GateRef stringId = ReadInst32_1(pc);
|
||||
GateRef propKey = GetValueFromTaggedArray(VariableType::JS_ANY(), constpool, stringId);
|
||||
SetPcToFrame(glue, GetFrame(sp), pc);
|
||||
GateRef result = CallRuntimeTrampoline(glue, GetInt64Constant(FAST_STUB_ID(StGlobalRecord)),
|
||||
{ propKey, *varAcc, TaggedFalse() });
|
||||
Branch(TaggedIsException(result), &isException, ¬Exception);
|
||||
@ -2923,6 +2988,7 @@ DECLARE_ASM_HANDLER(HandleStClassToGlobalRecordPrefId32)
|
||||
Label notException(env);
|
||||
GateRef stringId = ReadInst32_1(pc);
|
||||
GateRef propKey = GetValueFromTaggedArray(VariableType::JS_ANY(), constpool, stringId);
|
||||
SetPcToFrame(glue, GetFrame(sp), pc);
|
||||
GateRef result = CallRuntimeTrampoline(glue, GetInt64Constant(FAST_STUB_ID(StGlobalRecord)),
|
||||
{ propKey, *varAcc, TaggedFalse() });
|
||||
Branch(TaggedIsException(result), &isException, ¬Exception);
|
||||
@ -2979,6 +3045,7 @@ DECLARE_ASM_HANDLER(HandleNegDynPrefV8)
|
||||
Label notException(env);
|
||||
Bind(&valueNotDouble);
|
||||
{
|
||||
SetPcToFrame(glue, GetFrame(sp), pc);
|
||||
// slow path
|
||||
GateRef result = CallRuntimeTrampoline(glue, GetInt64Constant(FAST_STUB_ID(NegDyn)), { value });
|
||||
Branch(TaggedIsException(result), &isException, ¬Exception);
|
||||
@ -3028,6 +3095,7 @@ DECLARE_ASM_HANDLER(HandleNotDynPrefV8)
|
||||
}
|
||||
Bind(&numberNotDouble);
|
||||
{
|
||||
SetPcToFrame(glue, GetFrame(sp), pc);
|
||||
// slow path
|
||||
GateRef result = CallRuntimeTrampoline(glue, GetInt64Constant(FAST_STUB_ID(NotDyn)), { value });
|
||||
Label isException(env);
|
||||
@ -3116,6 +3184,7 @@ DECLARE_ASM_HANDLER(HandleAnd2DynPrefV8)
|
||||
// slow path
|
||||
Bind(&leftNotNumberOrRightNotNumber);
|
||||
{
|
||||
SetPcToFrame(glue, GetFrame(sp), pc);
|
||||
GateRef taggedNumber = CallRuntimeTrampoline(glue,
|
||||
GetInt64Constant(FAST_STUB_ID(ChangeTwoInt32AndToJSTaggedValue)), { left, right });
|
||||
Label isException(env);
|
||||
@ -3208,6 +3277,7 @@ DECLARE_ASM_HANDLER(HandleOr2DynPrefV8)
|
||||
// slow path
|
||||
Bind(&leftNotNumberOrRightNotNumber);
|
||||
{
|
||||
SetPcToFrame(glue, GetFrame(sp), pc);
|
||||
GateRef taggedNumber = CallRuntimeTrampoline(glue,
|
||||
GetInt64Constant(FAST_STUB_ID(ChangeTwoInt32OrToJSTaggedValue)), { left, right });
|
||||
Label isException(env);
|
||||
@ -3300,6 +3370,7 @@ DECLARE_ASM_HANDLER(HandleXOr2DynPrefV8)
|
||||
// slow path
|
||||
Bind(&leftNotNumberOrRightNotNumber);
|
||||
{
|
||||
SetPcToFrame(glue, GetFrame(sp), pc);
|
||||
GateRef taggedNumber = CallRuntimeTrampoline(glue,
|
||||
GetInt64Constant(FAST_STUB_ID(ChangeTwoInt32XorToJSTaggedValue)), { left, right });
|
||||
Label isException(env);
|
||||
@ -3392,6 +3463,7 @@ DECLARE_ASM_HANDLER(HandleAshr2DynPrefV8)
|
||||
// slow path
|
||||
Bind(&leftNotNumberOrRightNotNumber);
|
||||
{
|
||||
SetPcToFrame(glue, GetFrame(sp), pc);
|
||||
GateRef taggedNumber = CallRuntimeTrampoline(glue,
|
||||
GetInt64Constant(FAST_STUB_ID(ChangeTwoUint32AndToJSTaggedValue)), { left, right });
|
||||
Label isException(env);
|
||||
@ -3485,6 +3557,7 @@ DECLARE_ASM_HANDLER(HandleShr2DynPrefV8)
|
||||
// slow path
|
||||
Bind(&leftNotNumberOrRightNotNumber);
|
||||
{
|
||||
SetPcToFrame(glue, GetFrame(sp), pc);
|
||||
GateRef taggedNumber = CallRuntimeTrampoline(glue,
|
||||
GetInt64Constant(FAST_STUB_ID(ChangeUintAndIntShrToJSTaggedValue)), { left, right });
|
||||
Label isException(env);
|
||||
@ -3577,6 +3650,7 @@ DECLARE_ASM_HANDLER(HandleShl2DynPrefV8)
|
||||
// slow path
|
||||
Bind(&leftNotNumberOrRightNotNumber);
|
||||
{
|
||||
SetPcToFrame(glue, GetFrame(sp), pc);
|
||||
GateRef taggedNumber = CallRuntimeTrampoline(glue,
|
||||
GetInt64Constant(FAST_STUB_ID(ChangeUintAndIntShlToJSTaggedValue)), { left, right });
|
||||
Label IsException(env);
|
||||
@ -3622,6 +3696,7 @@ DECLARE_ASM_HANDLER(HandleDefineClassWithBufferPrefId16Imm16Imm16V8V8)
|
||||
Label isResolved(env);
|
||||
Label isNotResolved(env);
|
||||
Label afterCheckResolved(env);
|
||||
SetPcToFrame(glue, GetFrame(sp), pc);
|
||||
Branch(FunctionIsResolved(classTemplate), &isResolved, &isNotResolved);
|
||||
Bind(&isResolved);
|
||||
{
|
||||
@ -3662,6 +3737,7 @@ DECLARE_ASM_HANDLER(HandleLdObjByNamePrefId32V8)
|
||||
Label receiverIsHeapObject(env);
|
||||
Label dispatch(env);
|
||||
Label slowPath(env);
|
||||
SetPcToFrame(glue, GetFrame(sp), pc);
|
||||
Branch(TaggedIsHeapObject(receiver), &receiverIsHeapObject, &slowPath);
|
||||
Bind(&receiverIsHeapObject);
|
||||
{
|
||||
@ -3747,6 +3823,7 @@ DECLARE_ASM_HANDLER(HandleStObjByNamePrefId32V8)
|
||||
GateRef receiver = GetVregValue(sp, ZExtInt8ToPtr(ReadInst8_5(pc)));
|
||||
GateRef slotId = ZExtInt8ToInt32(ReadInst8_0(pc));
|
||||
DEFVARIABLE(result, VariableType::INT64(), GetHoleConstant(VariableType::INT64()));
|
||||
SetPcToFrame(glue, GetFrame(sp), pc);
|
||||
|
||||
Label checkResult(env);
|
||||
Label dispatch(env);
|
||||
@ -3833,7 +3910,7 @@ DECLARE_ASM_HANDLER(HandleStOwnByValueWithNameSetPrefV8V8)
|
||||
Label notException(env);
|
||||
Label isException1(env);
|
||||
Label notException1(env);
|
||||
|
||||
SetPcToFrame(glue, GetFrame(sp), pc);
|
||||
Branch(TaggedIsHeapObject(receiver), &isHeapObject, &slowPath);
|
||||
Bind(&isHeapObject);
|
||||
{
|
||||
@ -3883,7 +3960,7 @@ DECLARE_ASM_HANDLER(HandleStOwnByNamePrefId32V8)
|
||||
GateRef propKey = GetValueFromTaggedArray(VariableType::JS_ANY(), constpool, stringId);
|
||||
GateRef receiver = GetVregValue(sp, ZExtInt8ToPtr(ReadInst8_5(pc)));
|
||||
DEFVARIABLE(result, VariableType::INT64(), GetHoleConstant(VariableType::INT64()));
|
||||
|
||||
SetPcToFrame(glue, GetFrame(sp), pc);
|
||||
Label checkResult(env);
|
||||
Label dispatch(env);
|
||||
|
||||
@ -3939,6 +4016,7 @@ DECLARE_ASM_HANDLER(HandleStOwnByNameWithNameSetPrefId32V8)
|
||||
Label notException(env);
|
||||
Label isException1(env);
|
||||
Label notException1(env);
|
||||
SetPcToFrame(glue, GetFrame(sp), pc);
|
||||
Branch(IsJSObject(receiver), &isJSObject, ¬JSObject);
|
||||
Bind(&isJSObject);
|
||||
{
|
||||
@ -4487,6 +4565,7 @@ DECLARE_ASM_HANDLER(HandleTryLdGlobalByNamePrefId32)
|
||||
Label dispatch(env);
|
||||
Label icAvailable(env);
|
||||
Label icNotAvailable(env);
|
||||
SetPcToFrame(glue, GetFrame(sp), pc);
|
||||
Branch(TaggedIsUndefined(profileTypeInfo), &icNotAvailable, &icAvailable);
|
||||
Bind(&icAvailable);
|
||||
{
|
||||
@ -4584,6 +4663,7 @@ DECLARE_ASM_HANDLER(HandleTryStGlobalByNamePrefId32)
|
||||
|
||||
Label icAvailable(env);
|
||||
Label icNotAvailable(env);
|
||||
SetPcToFrame(glue, GetFrame(sp), pc);
|
||||
Branch(TaggedIsUndefined(profileTypeInfo), &icNotAvailable, &icAvailable);
|
||||
Bind(&icAvailable);
|
||||
{
|
||||
@ -4667,7 +4747,7 @@ DECLARE_ASM_HANDLER(HandleLdGlobalVarPrefId32)
|
||||
Label dispatch(env);
|
||||
Label slowPath(env);
|
||||
GateRef globalObject = GetGlobalObject(glue);
|
||||
|
||||
SetPcToFrame(glue, GetFrame(sp), pc);
|
||||
Label icAvailable(env);
|
||||
Label icNotAvailable(env);
|
||||
Branch(TaggedIsUndefined(profileTypeInfo), &icNotAvailable, &icAvailable);
|
||||
@ -4731,6 +4811,7 @@ DECLARE_ASM_HANDLER(HandleStGlobalVarPrefId32)
|
||||
|
||||
Label icAvailable(env);
|
||||
Label icNotAvailable(env);
|
||||
SetPcToFrame(glue, GetFrame(sp), pc);
|
||||
Branch(TaggedIsUndefined(profileTypeInfo), &icNotAvailable, &icAvailable);
|
||||
Bind(&icAvailable);
|
||||
{
|
||||
@ -4780,6 +4861,7 @@ DECLARE_ASM_HANDLER(HandleCreateRegExpWithLiteralPrefId32Imm8)
|
||||
GateRef stringId = ReadInst32_1(pc);
|
||||
GateRef pattern = GetObjectFromConstPool(constpool, stringId);
|
||||
GateRef flags = ReadInst8_5(pc);
|
||||
SetPcToFrame(glue, GetFrame(sp), pc);
|
||||
GateRef res = CallRuntimeTrampoline(glue, GetInt64Constant(FAST_STUB_ID(CreateRegExpWithLiteral)),
|
||||
{ pattern, Int8BuildTaggedTypeWithNoGC(flags) });
|
||||
Label isException(env);
|
||||
@ -4883,6 +4965,7 @@ DECLARE_ASM_HANDLER(HandleToNumberPrefV8)
|
||||
}
|
||||
Bind(&valueNotNumber);
|
||||
{
|
||||
SetPcToFrame(glue, GetFrame(sp), pc);
|
||||
GateRef res = CallRuntimeTrampoline(glue, GetInt64Constant(FAST_STUB_ID(ToNumber)), { value });
|
||||
Label isException(env);
|
||||
Label notException(env);
|
||||
@ -4986,6 +5069,7 @@ DECLARE_ASM_HANDLER(HandleAdd2DynPrefV8)
|
||||
// slow path
|
||||
Bind(&slowPath);
|
||||
{
|
||||
SetPcToFrame(glue, GetFrame(sp), pc);
|
||||
GateRef taggedNumber = CallRuntimeTrampoline(glue, GetInt64Constant(FAST_STUB_ID(Add2Dyn)),
|
||||
{ left, right });
|
||||
Label isException(env);
|
||||
@ -5095,6 +5179,7 @@ DECLARE_ASM_HANDLER(HandleSub2DynPrefV8)
|
||||
// slow path
|
||||
Bind(&slowPath);
|
||||
{
|
||||
SetPcToFrame(glue, GetFrame(sp), pc);
|
||||
GateRef taggedNumber = CallRuntimeTrampoline(glue, GetInt64Constant(FAST_STUB_ID(Sub2Dyn)),
|
||||
{ left, right });
|
||||
Label isException(env);
|
||||
|
@ -155,7 +155,12 @@ bool LLVMStackMapParser::CollectStackMapSlots(uintptr_t callSiteAddr, uintptr_t
|
||||
PrintCallSiteInfo(infos, fp);
|
||||
#endif
|
||||
uintptr_t callsiteFp = *fp;
|
||||
uintptr_t callsiteSp = callsiteFp + FrameConstants::CALLSITE_SP_TO_FP_DELTA_OFFSET;
|
||||
uintptr_t callsiteSp;
|
||||
if (FrameHandler(reinterpret_cast<JSTaggedType *>(frameFp)).GetFrameType() == FrameType::ASM_LEAVE_FRAME) {
|
||||
callsiteSp = OptimizedLeaveFrame::GetFrameFromSp(reinterpret_cast<JSTaggedType *>(frameFp))->GetCallSiteSp();
|
||||
} else {
|
||||
callsiteSp = callsiteFp + FrameConstants::CALLSITE_SP_TO_FP_DELTA_OFFSET;
|
||||
}
|
||||
|
||||
for (auto &info: *infos) {
|
||||
if (info.first == FrameConstants::SP_DWARF_REG_NUM) {
|
||||
|
@ -460,15 +460,22 @@ void LLVMIRBuilder::VisitRuntimeCall(GateRef gate, const std::vector<GateRef> &i
|
||||
ASSERT(stubModule_ != nullptr);
|
||||
LLVMValueRef callee;
|
||||
LLVMValueRef rtoffset;
|
||||
LLVMTypeRef rtfuncType = stubModule_->GetStubFunctionType(FAST_STUB_ID(RuntimeCallTrampoline));
|
||||
LLVMTypeRef rtfuncType = stubModule_->GetStubFunctionType(FAST_STUB_ID(RuntimeCallTrampolineAot));
|
||||
LLVMTypeRef rtfuncTypePtr = LLVMPointerType(rtfuncType, 0);
|
||||
LLVMValueRef glue = gateToLLVMMaps_[inList[2]]; // 2 : 2 means skip two input gates (target glue)
|
||||
LLVMTypeRef glue_type = LLVMTypeOf(glue);
|
||||
|
||||
rtoffset = LLVMConstInt(glue_type,
|
||||
JSThread::GlueData::GetRTInterfacesOffset(compCfg_->Is32Bit()) +
|
||||
(FAST_STUB_ID(RuntimeCallTrampoline) - FAST_STUB_MAXCOUNT) * slotSize_,
|
||||
0);
|
||||
if (circuit_->GetFrameType() == FrameType::INTERPRETER_FRAME ||
|
||||
circuit_->GetFrameType() == FrameType::OPTIMIZED_ENTRY_FRAME) {
|
||||
rtoffset = LLVMConstInt(glue_type,
|
||||
JSThread::GlueData::GetRTInterfacesOffset(compCfg_->Is32Bit()) +
|
||||
(FAST_STUB_ID(RuntimeCallTrampolineInterpreterAsm) - FAST_STUB_MAXCOUNT) * slotSize_,
|
||||
0);
|
||||
} else {
|
||||
rtoffset = LLVMConstInt(glue_type,
|
||||
JSThread::GlueData::GetRTInterfacesOffset(compCfg_->Is32Bit()) +
|
||||
(FAST_STUB_ID(RuntimeCallTrampolineAot) - FAST_STUB_MAXCOUNT) * slotSize_,
|
||||
0);
|
||||
}
|
||||
LLVMValueRef rtbaseoffset = LLVMBuildAdd(builder_, glue, rtoffset, "");
|
||||
LLVMValueRef rtbaseAddr = LLVMBuildIntToPtr(builder_, rtbaseoffset, LLVMPointerType(glue_type, 0), "");
|
||||
LLVMValueRef llvmAddr = LLVMBuildLoad(builder_, rtbaseAddr, "");
|
||||
|
@ -1048,12 +1048,28 @@ CALL_STUB_INIT_DESCRIPTOR(IterNext)
|
||||
descriptor->SetStubKind(StubDescriptor::CallStubKind::RUNTIME_STUB);
|
||||
}
|
||||
|
||||
CALL_STUB_INIT_DESCRIPTOR(RuntimeCallTrampoline)
|
||||
CALL_STUB_INIT_DESCRIPTOR(RuntimeCallTrampolineAot)
|
||||
{
|
||||
/* 3 : 3 input parameters */
|
||||
StubDescriptor runtimeCallTrampoline("RuntimeCallTrampoline", 0, 3,
|
||||
StubDescriptor runtimeCallTrampolineAot("RuntimeCallTrampolineAot", 0, 3,
|
||||
ArgumentsOrder::DEFAULT_ORDER, VariableType::JS_ANY());
|
||||
*descriptor = runtimeCallTrampoline;
|
||||
*descriptor = runtimeCallTrampolineAot;
|
||||
std::array<VariableType, 3> params = { /* 3 : 3 input parameters */
|
||||
VariableType::POINTER(),
|
||||
VariableType::INT64(),
|
||||
VariableType::INT64(),
|
||||
};
|
||||
descriptor->SetVariableArgs(true);
|
||||
descriptor->SetParameters(params.data());
|
||||
descriptor->SetStubKind(StubDescriptor::CallStubKind::RUNTIME_STUB);
|
||||
}
|
||||
|
||||
CALL_STUB_INIT_DESCRIPTOR(RuntimeCallTrampolineInterpreterAsm)
|
||||
{
|
||||
/* 3 : 3 input parameters */
|
||||
StubDescriptor runtimeCallTrampolineInterpreterAsm("RuntimeCallTrampolineInterpreterAsm", 0, 3,
|
||||
ArgumentsOrder::DEFAULT_ORDER, VariableType::JS_ANY());
|
||||
*descriptor = runtimeCallTrampolineInterpreterAsm;
|
||||
std::array<VariableType, 3> params = { /* 3 : 3 input parameters */
|
||||
VariableType::POINTER(),
|
||||
VariableType::INT64(),
|
||||
|
@ -214,6 +214,7 @@ enum class FrameType: uint64_t {
|
||||
INTERPRETER_FRAME = 2,
|
||||
OPTIMIZED_LEAVE_FRAME = 3,
|
||||
INTERPRETER_FAST_NEW_FRAME = 4,
|
||||
ASM_LEAVE_FRAME = 5,
|
||||
};
|
||||
|
||||
class FrameConstants {
|
||||
@ -432,6 +433,7 @@ struct OptimizedLeaveFrame {
|
||||
static_assert(static_cast<uint64_t>(FrameType::OPTIMIZED_FRAME) == OPTIMIZE_FRAME_TYPE);
|
||||
static_assert(static_cast<uint64_t>(FrameType::OPTIMIZED_ENTRY_FRAME) == JS_ENTRY_FRAME_TYPE);
|
||||
static_assert(static_cast<uint64_t>(FrameType::OPTIMIZED_LEAVE_FRAME) == LEAVE_FRAME_TYPE);
|
||||
static_assert(static_cast<uint64_t>(FrameType::ASM_LEAVE_FRAME) == ASM_LEAVE_FRAME_TYPE);
|
||||
#ifdef PANDA_TARGET_64
|
||||
static_assert(OptimizedFrame::GetCallsiteSpToFpDelta() ==
|
||||
FrameConstants::CALLSITE_SP_TO_FP_DELTA * sizeof(uintptr_t));
|
||||
|
@ -49,6 +49,7 @@ void FrameHandler::PrevFrame()
|
||||
framehandle->PrevFrame();
|
||||
break;
|
||||
}
|
||||
case FrameType::ASM_LEAVE_FRAME:
|
||||
case FrameType::OPTIMIZED_LEAVE_FRAME: {
|
||||
auto framehandle =
|
||||
reinterpret_cast<OptimizedLeaveFrameHandler *>(this);
|
||||
@ -310,7 +311,12 @@ void FrameIterator::Iterate(const RootVisitor &v0, const RootRangeVisitor &v1) c
|
||||
#if ECMASCRIPT_ENABLE_HEAP_VERIFY
|
||||
isVerifying = thread_->GetEcmaVM()->GetHeap()->GetIsVerifying();
|
||||
#endif
|
||||
|
||||
auto leaveFrame = const_cast<JSTaggedType *>(thread_->GetLastLeaveFrame());
|
||||
if (leaveFrame != nullptr) {
|
||||
ASSERT(OptimizedLeaveFrame::GetFrameFromSp(leaveFrame)->type == FrameType::ASM_LEAVE_FRAME);
|
||||
OptimizedLeaveFrameHandler(reinterpret_cast<uintptr_t *>(leaveFrame)).Iterate(v0,
|
||||
v1, derivedPointers, isVerifying);
|
||||
}
|
||||
JSTaggedType *current = const_cast<JSTaggedType *>(thread_->GetCurrentSPFrame());
|
||||
while (current) {
|
||||
FrameType type = FrameHandler(current).GetFrameType();
|
||||
@ -327,7 +333,7 @@ void FrameIterator::Iterate(const RootVisitor &v0, const RootRangeVisitor &v1) c
|
||||
current = frame->GetPrevFrameFp();
|
||||
ASSERT(FrameHandler(current).IsInterpretedFrame());
|
||||
} else {
|
||||
ASSERT(type == FrameType::OPTIMIZED_LEAVE_FRAME);
|
||||
ASSERT(type == FrameType::OPTIMIZED_LEAVE_FRAME || type == FrameType::ASM_LEAVE_FRAME);
|
||||
OptimizedLeaveFrame *frame = OptimizedLeaveFrame::GetFrameFromSp(current);
|
||||
OptimizedLeaveFrameHandler(reinterpret_cast<uintptr_t *>(current)).Iterate(v0,
|
||||
v1, derivedPointers, isVerifying);
|
||||
@ -335,7 +341,8 @@ void FrameIterator::Iterate(const RootVisitor &v0, const RootRangeVisitor &v1) c
|
||||
// Leave Frame.
|
||||
current = reinterpret_cast<JSTaggedType *>(frame->callsiteFp);
|
||||
ASSERT(FrameHandler(current).GetFrameType() == FrameType::OPTIMIZED_ENTRY_FRAME ||
|
||||
FrameHandler(current).GetFrameType() == FrameType::OPTIMIZED_FRAME);
|
||||
FrameHandler(current).GetFrameType() == FrameType::OPTIMIZED_FRAME ||
|
||||
FrameHandler(current).GetFrameType() == FrameType::INTERPRETER_FRAME);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -66,7 +66,7 @@ public:
|
||||
|
||||
bool IsOptimizedLeaveFrame() const
|
||||
{
|
||||
return GetFrameType() == FrameType::OPTIMIZED_LEAVE_FRAME;
|
||||
return GetFrameType() == FrameType::OPTIMIZED_LEAVE_FRAME || GetFrameType() == FrameType::ASM_LEAVE_FRAME;
|
||||
}
|
||||
|
||||
OptimizedLeaveFrame* GetOptimizedLeaveFrame() const
|
||||
|
@ -433,10 +433,17 @@ JSTaggedValue EcmaInterpreter::Execute(JSThread *thread, const CallParams& param
|
||||
return JSTaggedValue::Undefined();
|
||||
}
|
||||
InterpretedFrame *breakState = GET_FRAME(newSp);
|
||||
auto leaveFrame = const_cast<JSTaggedType *>(thread->GetLastLeaveFrame());
|
||||
if (leaveFrame != nullptr) {
|
||||
[[maybe_unused]] OptimizedLeaveFrame *frame = OptimizedLeaveFrame::GetFrameFromSp(leaveFrame);
|
||||
frame->callsiteFp = reinterpret_cast<uintptr_t>(sp);
|
||||
breakState->base.prev = leaveFrame;
|
||||
} else {
|
||||
breakState->base.prev = sp;
|
||||
}
|
||||
breakState->pc = nullptr;
|
||||
breakState->sp = nullptr;
|
||||
breakState->function = JSTaggedValue::Hole();
|
||||
breakState->base.prev = sp;
|
||||
breakState->base.type = FrameType::INTERPRETER_FRAME;
|
||||
JSTaggedType *prevSp = newSp;
|
||||
|
||||
|
@ -419,6 +419,7 @@ public:
|
||||
};
|
||||
static_assert(MEMBER_OFFSET(GlueData, rtInterfaces_) == ASM_GLUE_RUNTIME_FUNCTIONS_OFFSET);
|
||||
static_assert(MEMBER_OFFSET(GlueData, currentFrame_) == ASM_GLUE_CURRENT_FRAME_OFFSET);
|
||||
static_assert(MEMBER_OFFSET(GlueData, leaveFrame_) == ASM_GLUE_LEAVE_FRAME_OFFSET);
|
||||
STATIC_ASSERT_EQ_ARCH(sizeof(GlueData), GlueData::SizeArch32, GlueData::SizeArch64);
|
||||
|
||||
private:
|
||||
|
@ -21,8 +21,10 @@
|
||||
#include "ecmascript/js_thread.h"
|
||||
|
||||
namespace panda::ecmascript {
|
||||
extern "C" JSTaggedType RuntimeCallTrampoline(uintptr_t glue, uint64_t runtime_id, uint64_t patch_id,
|
||||
uint64_t argc, ...);
|
||||
extern "C" JSTaggedType RuntimeCallTrampolineAot(uintptr_t glue, uint64_t runtime_id,
|
||||
uint64_t argc, ...);
|
||||
extern "C" JSTaggedType RuntimeCallTrampolineInterpreterAsm(uintptr_t glue, uint64_t runtime_id,
|
||||
uint64_t argc, ...);
|
||||
class RuntimeTrampolines {
|
||||
public:
|
||||
enum RuntimeTrampolineId {
|
||||
|
@ -18,16 +18,19 @@
|
||||
|
||||
#ifdef PANDA_TARGET_64
|
||||
#define ASM_GLUE_CURRENT_FRAME_OFFSET 2200
|
||||
#define ASM_GLUE_LEAVE_FRAME_OFFSET 2208
|
||||
#define ASM_GLUE_RUNTIME_FUNCTIONS_OFFSET 4264
|
||||
#endif
|
||||
|
||||
#ifdef PANDA_TARGET_32
|
||||
#define ASM_GLUE_CURRENT_FRAME_OFFSET 2200
|
||||
#define ASM_GLUE_LEAVE_FRAME_OFFSET 2208
|
||||
#define ASM_GLUE_RUNTIME_FUNCTIONS_OFFSET 3240
|
||||
#endif
|
||||
|
||||
#define OPTIMIZE_FRAME_TYPE 0
|
||||
#define JS_ENTRY_FRAME_TYPE 1
|
||||
#define LEAVE_FRAME_TYPE 3
|
||||
#define ASM_LEAVE_FRAME_TYPE 5
|
||||
|
||||
#endif // ECMASCRIPT_ASM_DEFINES_H
|
||||
|
@ -158,9 +158,9 @@ JSFunctionEntry:
|
||||
// current sp - 8: type
|
||||
// current sp - 16: callee save x19
|
||||
|
||||
.global RuntimeCallTrampoline
|
||||
.type RuntimeCallTrampoline, %function
|
||||
RuntimeCallTrampoline:
|
||||
.global RuntimeCallTrampolineAot
|
||||
.type RuntimeCallTrampolineAot, %function
|
||||
RuntimeCallTrampolineAot:
|
||||
stp x29, x30, [sp, #-16]! // save register for fp, rip
|
||||
mov x29, sp // set frame pointer = callsiteFp
|
||||
str x29, [x0, #ASM_GLUE_CURRENT_FRAME_OFFSET] // save to thread->currentFrame_
|
||||
@ -185,3 +185,30 @@ RuntimeCallTrampoline:
|
||||
// restore register
|
||||
ldp x29, x30, [sp], #16
|
||||
ret
|
||||
|
||||
.global RuntimeCallTrampolineInterpreterAsm
|
||||
.type RuntimeCallTrampolineInterpreterAsm, %function
|
||||
RuntimeCallTrampolineInterpreterAsm:
|
||||
stp #0, x30, [sp, #-16]! // save register for fp, rip
|
||||
str sp, [x0, #ASM_GLUE_LEAVE_FRAME_OFFSET] // save to thread->currentFrame_
|
||||
str x19, [sp, #-16] // callee save register
|
||||
|
||||
// construct leave frame
|
||||
mov x19, #ASM_LEAVE_FRAME_TYPE
|
||||
str x19, [sp, #-8]
|
||||
add sp, sp, #-16
|
||||
|
||||
// load runtime trampoline address
|
||||
ldr x19, [sp, #32] // runtime_id
|
||||
add x19, x0, x19, lsl #3
|
||||
ldr x19, [x19, #ASM_GLUE_RUNTIME_FUNCTIONS_OFFSET]
|
||||
ldr x1, [sp, #40] // argc
|
||||
add x2, sp, #48 // argv[]
|
||||
blr x19
|
||||
|
||||
// descontruct leave frame and callee save register
|
||||
ldr x19, [sp]
|
||||
add sp, sp, #24
|
||||
// restore register
|
||||
ldr x30, [sp], #8
|
||||
ret
|
@ -49,7 +49,7 @@
|
||||
// %r9 - codeAddr
|
||||
.global JSFunctionEntry
|
||||
.type JSFunctionEntry, %function
|
||||
JSFunctionEntry:
|
||||
JSFunctionEntry:
|
||||
PUSH_GENERAL_REGS
|
||||
// construct the frame
|
||||
pushq %rbp
|
||||
@ -102,7 +102,7 @@ JSFunctionEntry:
|
||||
|
||||
.LPopFrame:
|
||||
popq %rsi // pop prev-managed frame
|
||||
addq $8, %rsp
|
||||
addq $8, %rsp
|
||||
popq %rbp
|
||||
|
||||
POP_GENERAL_REGS
|
||||
@ -141,9 +141,9 @@ JSFunctionEntry:
|
||||
// sp - 16: rbp <---------current rbp & current sp
|
||||
// current sp - 8: type
|
||||
|
||||
.global RuntimeCallTrampoline
|
||||
.type RuntimeCallTrampoline, %function
|
||||
RuntimeCallTrampoline:
|
||||
.global RuntimeCallTrampolineAot
|
||||
.type RuntimeCallTrampolineAot, %function
|
||||
RuntimeCallTrampolineAot:
|
||||
pushq %rbp
|
||||
movq %rsp, %rbp // set frame pointer
|
||||
movq %rbp, ASM_GLUE_CURRENT_FRAME_OFFSET(%rax) // save to thread->currentFrame_
|
||||
@ -172,4 +172,36 @@ RuntimeCallTrampoline:
|
||||
|
||||
addq $8, %rsp
|
||||
popq %rbp
|
||||
ret
|
||||
|
||||
.global RuntimeCallTrampolineInterpreterAsm
|
||||
.type RuntimeCallTrampolineInterpreterAsm, %function
|
||||
RuntimeCallTrampolineInterpreterAsm:
|
||||
pushq $0
|
||||
movq %rsp, ASM_GLUE_LEAVE_FRAME_OFFSET(%rax) // save to thread->leaveFrame_
|
||||
pushq $ASM_LEAVE_FRAME_TYPE
|
||||
|
||||
// callee save
|
||||
pushq %r10
|
||||
pushq %rdx
|
||||
pushq %rax
|
||||
|
||||
// construct leave frame
|
||||
movq %rsp, %rdx
|
||||
addq $48, %rdx // 16 : for rbp & return address
|
||||
|
||||
// load runtime trampoline address
|
||||
movq (%rdx), %r10 // runtime id
|
||||
movq ASM_GLUE_RUNTIME_FUNCTIONS_OFFSET(%rax, %r10, 8), %r10
|
||||
movq %rax, %rdi // glue
|
||||
movl 8(%rdx), %esi // argc
|
||||
addq $16, %rdx // argV
|
||||
call *%r10
|
||||
|
||||
addq $8, %rsp
|
||||
popq %rdx
|
||||
popq %r10
|
||||
|
||||
addq $8, %rsp
|
||||
addq $8, %rsp
|
||||
ret
|
@ -112,9 +112,9 @@ JSFunctionEntry:
|
||||
// | frameType | v
|
||||
// +--------------------------+ ---
|
||||
|
||||
.global RuntimeCallTrampoline
|
||||
.type RuntimeCallTrampoline, %function
|
||||
RuntimeCallTrampoline:
|
||||
.global RuntimeCallTrampolineAot
|
||||
.type RuntimeCallTrampolineAot, %function
|
||||
RuntimeCallTrampolineAot:
|
||||
push {r11, lr} // save register for fp, rip
|
||||
mov r11, sp // set frame pointer = callsiteFp
|
||||
str r11, [r0, #ASM_GLUE_CURRENT_FRAME_OFFSET] // save to thread->currentFrame_
|
||||
@ -139,4 +139,33 @@ RuntimeCallTrampoline:
|
||||
pop {r4, r5}
|
||||
add sp, sp, #8
|
||||
pop {r11, lr}
|
||||
bx lr
|
||||
|
||||
.global RuntimeCallTrampolineInterpreterAsm
|
||||
.type RuntimeCallTrampolineInterpreterAsm, %function
|
||||
RuntimeCallTrampolineInterpreterAsm:
|
||||
add sp, sp, #-8
|
||||
str lr, [sp, #4]
|
||||
str sp, [r0, #ASM_GLUE_LEAVE_FRAME_OFFSET] // save to thread->currentFrame_
|
||||
add sp, sp, #-8 // increase frame size
|
||||
push {r4, r5} // callee save
|
||||
|
||||
// construct leave frame
|
||||
mov r4, #0
|
||||
mov r5, #ASM_LEAVE_FRAME_TYPE
|
||||
str r4, [sp, #12]
|
||||
str r5, [sp, #8] // save frame type
|
||||
|
||||
|
||||
// load runtime trampoline address
|
||||
add r2, r0, r2, lsl #2
|
||||
ldr r4, [r2, #ASM_GLUE_RUNTIME_FUNCTIONS_OFFSET]
|
||||
ldr r1, [sp, #24] // argc
|
||||
add r2, sp, #32 // argv[]
|
||||
blx r4
|
||||
|
||||
// descontruct leave frame and callee save register
|
||||
pop {r4, r5}
|
||||
add sp, sp, #12
|
||||
ldr r1, [sp, #0]
|
||||
bx lr
|
Loading…
Reference in New Issue
Block a user