reason:fix IntBuildTaggedWithNoGC

description:use SExtInt32ToInt64
issue:https://gitee.com/openharmony/ark_js_runtime/issues/I5EITG?from=project-issue

Signed-off-by: wupengyong <wupengyong@huawei.com>
Change-Id: I8374ffd008013bcfb9ed3d0b4030b7a0c9327720
This commit is contained in:
wupengyong 2022-06-28 16:16:35 +08:00
parent c115bb91e4
commit c7cfbf050e
5 changed files with 114 additions and 102 deletions

View File

@ -214,7 +214,7 @@ DECLARE_ASM_HANDLER(HandleCopyRestArgsPrefImm16)
DEFVARIABLE(varAcc, VariableType::JS_ANY(), acc);
auto env = GetEnvironment();
GateRef restIdx = ZExtInt16ToInt32(ReadInst16_1(pc));
GateRef res = CallRuntime(glue, RTSTUB_ID(CopyRestArgs), { IntBuildTaggedTypeWithNoGC(restIdx) });
GateRef res = CallRuntime(glue, RTSTUB_ID(CopyRestArgs), { IntToTaggedTypeNGC(restIdx) });
Label isException(env);
Label notException(env);
Branch(TaggedIsException(res), &isException, &notException);
@ -273,7 +273,7 @@ DECLARE_ASM_HANDLER(HandleCreateObjectWithExcludedKeysPrefImm16V8V8)
GateRef obj = GetVregValue(sp, ZExtInt8ToPtr(ReadInst8_3(pc)));
GateRef firstArgRegIdx = ZExtInt8ToInt16(ReadInst8_4(pc));
GateRef res = CallRuntime(glue, RTSTUB_ID(CreateObjectWithExcludedKeys),
{ Int16BuildTaggedTypeWithNoGC(numKeys), obj, Int16BuildTaggedTypeWithNoGC(firstArgRegIdx) });
{ Int16ToTaggedTypeNGC(numKeys), obj, Int16ToTaggedTypeNGC(firstArgRegIdx) });
Label isException(env);
Label notException(env);
Branch(TaggedIsException(res), &isException, &notException);
@ -310,7 +310,7 @@ DECLARE_ASM_HANDLER(HandleThrowIfSuperNotCorrectCallPrefImm16)
auto env = GetEnvironment();
GateRef imm = ReadInst16_1(pc);
GateRef res = CallRuntime(glue, RTSTUB_ID(ThrowIfSuperNotCorrectCall),
{ Int16BuildTaggedTypeWithNoGC(imm), acc }); // acc is thisValue
{ Int16ToTaggedTypeNGC(imm), acc }); // acc is thisValue
Label isException(env);
Label notException(env);
Branch(TaggedIsException(res), &isException, &notException);
@ -416,7 +416,7 @@ DECLARE_ASM_HANDLER(HandleNewObjDynRangePrefImm16V8)
GateRef firstArgIdx = Int16Add(firstArgRegIdx, firstArgOffset);
GateRef length = Int16Sub(numArgs, firstArgOffset);
res = CallRuntime(glue, RTSTUB_ID(NewObjDynRange),
{ ctor, ctor, Int16BuildTaggedTypeWithNoGC(firstArgIdx), Int16BuildTaggedTypeWithNoGC(length) });
{ ctor, ctor, Int16ToTaggedTypeNGC(firstArgIdx), Int16ToTaggedTypeNGC(length) });
Jump(&checkResult);
Bind(&checkResult);
{
@ -472,7 +472,7 @@ DECLARE_ASM_HANDLER(HandleDefineFuncDynPrefId16Imm16V8)
Bind(&defaultLabel);
{
GateRef hClass = LoadHClass(*result);
SetPropertyInlinedProps(glue, *result, hClass, Int16BuildTaggedWithNoGC(length),
SetPropertyInlinedProps(glue, *result, hClass, Int16ToTaggedNGC(length),
Int32(JSFunction::LENGTH_INLINE_PROPERTY_INDEX), VariableType::INT64());
GateRef envHandle = GetVregValue(sp, ZExtInt8ToPtr(v0));
SetLexicalEnvToFunction(glue, *result, envHandle);
@ -520,7 +520,7 @@ DECLARE_ASM_HANDLER(HandleDefineNCFuncDynPrefId16Imm16V8)
Bind(&defaultLabel);
{
GateRef hClass = LoadHClass(*result);
SetPropertyInlinedProps(glue, *result, hClass, Int16BuildTaggedWithNoGC(length),
SetPropertyInlinedProps(glue, *result, hClass, Int16ToTaggedNGC(length),
Int32(JSFunction::LENGTH_INLINE_PROPERTY_INDEX), VariableType::INT64());
GateRef lexEnv = GetVregValue(sp, ZExtInt8ToPtr(v0));
SetLexicalEnvToFunction(glue, *result, lexEnv);
@ -569,7 +569,7 @@ DECLARE_ASM_HANDLER(HandleDefineGeneratorFuncPrefId16Imm16V8)
Bind(&defaultLabel);
{
GateRef hClass = LoadHClass(*result);
SetPropertyInlinedProps(glue, *result, hClass, Int16BuildTaggedWithNoGC(length),
SetPropertyInlinedProps(glue, *result, hClass, Int16ToTaggedNGC(length),
Int32(JSFunction::LENGTH_INLINE_PROPERTY_INDEX), VariableType::INT64());
GateRef lexEnv = GetVregValue(sp, ZExtInt8ToPtr(v0));
SetLexicalEnvToFunction(glue, *result, lexEnv);
@ -617,7 +617,7 @@ DECLARE_ASM_HANDLER(HandleDefineAsyncFuncPrefId16Imm16V8)
Bind(&defaultLabel);
{
GateRef hClass = LoadHClass(*result);
SetPropertyInlinedProps(glue, *result, hClass, Int16BuildTaggedWithNoGC(length),
SetPropertyInlinedProps(glue, *result, hClass, Int16ToTaggedNGC(length),
Int32(JSFunction::LENGTH_INLINE_PROPERTY_INDEX), VariableType::INT64());
GateRef lexEnv = GetVregValue(sp, ZExtInt8ToPtr(v0));
SetLexicalEnvToFunction(glue, *result, lexEnv);
@ -666,7 +666,7 @@ DECLARE_ASM_HANDLER(HandleDefineMethodPrefId16Imm16V8)
Bind(&defaultLabel);
{
GateRef hClass = LoadHClass(*result);
SetPropertyInlinedProps(glue, *result, hClass, Int16BuildTaggedWithNoGC(length),
SetPropertyInlinedProps(glue, *result, hClass, Int16ToTaggedNGC(length),
Int32(JSFunction::LENGTH_INLINE_PROPERTY_INDEX), VariableType::INT64());
GateRef lexEnv = GetVregValue(sp, ZExtInt8ToPtr(v0));
SetLexicalEnvToFunction(glue, *result, lexEnv);
@ -775,7 +775,7 @@ DECLARE_ASM_HANDLER(HandleSuperCallPrefImm16V8)
GateRef v0 = ZExtInt8ToInt16(ReadInst8_3(pc));
// acc is thisFunc
GateRef res = CallRuntime(glue, RTSTUB_ID(SuperCall),
{ acc, Int16BuildTaggedTypeWithNoGC(v0), Int16BuildTaggedTypeWithNoGC(range) });
{ acc, Int16ToTaggedTypeNGC(v0), Int16ToTaggedTypeNGC(range) });
Label isException(env);
Label notException(env);
Branch(TaggedIsException(res), &isException, &notException);
@ -1548,7 +1548,7 @@ DECLARE_ASM_HANDLER(SingleStepDebugging)
varSp = TaggedCastToIntPtr(CallRuntime(glue,
RTSTUB_ID(JumpToCInterpreter),
{ constpool, profileTypeInfo, acc,
IntBuildTaggedTypeWithNoGC(hotnessCounter)}));
IntToTaggedTypeNGC(hotnessCounter)}));
GateRef frame = GetFrame(*varSp);
varPc = GetPcFromFrame(frame);
Label shouldReturn(env);
@ -1842,7 +1842,7 @@ DECLARE_ASM_HANDLER(HandleIncDynPrefV8)
Branch(Int32Equal(valueInt, Int32(INT32_MAX)), &valueNotInt, &valueNoOverflow);
Bind(&valueNoOverflow);
{
varAcc = IntBuildTaggedWithNoGC(Int32Add(valueInt, Int32(1)));
varAcc = IntToTaggedNGC(Int32Add(valueInt, Int32(1)));
Jump(&accDispatch);
}
}
@ -1898,7 +1898,7 @@ DECLARE_ASM_HANDLER(HandleDecDynPrefV8)
Branch(Int32Equal(valueInt, Int32(INT32_MIN)), &valueNotInt, &valueNoOverflow);
Bind(&valueNoOverflow);
{
varAcc = IntBuildTaggedWithNoGC(Int32Sub(valueInt, Int32(1)));
varAcc = IntToTaggedNGC(Int32Sub(valueInt, Int32(1)));
Jump(&accDispatch);
}
}
@ -2067,7 +2067,7 @@ DECLARE_ASM_HANDLER(HandleGetResumeModePrefV8)
GateRef vs = ReadInst8_1(pc);
GateRef obj = GetVregValue(sp, ZExtInt8ToPtr(vs));
varAcc = IntBuildTaggedWithNoGC(GetResumeModeFromGeneratorObject(obj));
varAcc = IntToTaggedNGC(GetResumeModeFromGeneratorObject(obj));
DISPATCH_WITH_ACC(PREF_V8);
}
@ -2511,7 +2511,7 @@ DECLARE_ASM_HANDLER(HandleLdObjByValuePrefV8V8)
Bind(&slowPath);
{
GateRef result = CallRuntime(glue, RTSTUB_ID(LoadICByValue),
{ profileTypeInfo, receiver, propKey, IntBuildTaggedTypeWithNoGC(slotId) });
{ profileTypeInfo, receiver, propKey, IntToTaggedTypeNGC(slotId) });
Label notException(env);
Branch(TaggedIsException(result), &isException, &notException);
Bind(&notException);
@ -2604,7 +2604,7 @@ DECLARE_ASM_HANDLER(HandleStObjByValuePrefV8V8)
Bind(&slowPath);
{
GateRef result = CallRuntime(glue, RTSTUB_ID(StoreICByValue),
{ profileTypeInfo, receiver, propKey, acc, IntBuildTaggedTypeWithNoGC(slotId) });
{ profileTypeInfo, receiver, propKey, acc, IntToTaggedTypeNGC(slotId) });
Branch(TaggedIsException(result), &isException, &notException);
}
Bind(&isException);
@ -2771,7 +2771,7 @@ DECLARE_ASM_HANDLER(HandleLdObjByIndexPrefV8Imm32)
Bind(&slowPath);
{
GateRef result = CallRuntime(glue, RTSTUB_ID(LdObjByIndex),
{ receiver, IntBuildTaggedTypeWithNoGC(index), TaggedFalse(), Undefined() });
{ receiver, IntToTaggedTypeNGC(index), TaggedFalse(), Undefined() });
Label notException(env);
Branch(TaggedIsException(result), &isException, &notException);
Bind(&notException);
@ -2809,7 +2809,7 @@ DECLARE_ASM_HANDLER(HandleStObjByIndexPrefV8Imm32)
Bind(&slowPath);
{
GateRef result = CallRuntime(glue, RTSTUB_ID(StObjByIndex),
{ receiver, IntBuildTaggedTypeWithNoGC(index), acc });
{ receiver, IntToTaggedTypeNGC(index), acc });
Branch(TaggedIsException(result), &isException, &notException);
}
Bind(&isException);
@ -2850,7 +2850,7 @@ DECLARE_ASM_HANDLER(HandleStOwnByIndexPrefV8Imm32)
Bind(&slowPath);
{
GateRef result = CallRuntime(glue, RTSTUB_ID(StOwnByIndex),
{ receiver, IntBuildTaggedTypeWithNoGC(index), acc });
{ receiver, IntToTaggedTypeNGC(index), acc });
Branch(TaggedIsException(result), &isException, &notException);
}
Bind(&isException);
@ -2946,7 +2946,7 @@ DECLARE_ASM_HANDLER(HandleNegDynPrefV8)
}
Bind(&valueNotZero);
{
varAcc = IntBuildTaggedWithNoGC(Int32Sub(Int32(0), valueInt));
varAcc = IntToTaggedNGC(Int32Sub(Int32(0), valueInt));
Jump(&accDispatch);
}
}
@ -2997,7 +2997,7 @@ DECLARE_ASM_HANDLER(HandleNotDynPrefV8)
Bind(&numberIsInt);
{
number = TaggedCastToInt32(value);
varAcc = IntBuildTaggedWithNoGC(Int32Not(*number));
varAcc = IntToTaggedNGC(Int32Not(*number));
Jump(&accDispatch);
}
Bind(&numberNotInt);
@ -3009,7 +3009,7 @@ DECLARE_ASM_HANDLER(HandleNotDynPrefV8)
{
GateRef valueDouble = TaggedCastToDouble(value);
number = DoubleToInt(glue, valueDouble);
varAcc = IntBuildTaggedWithNoGC(Int32Not(*number));
varAcc = IntToTaggedNGC(Int32Not(*number));
Jump(&accDispatch);
}
Bind(&numberNotDouble);
@ -3119,7 +3119,7 @@ DECLARE_ASM_HANDLER(HandleAnd2DynPrefV8)
Bind(&accDispatch);
{
GateRef ret = Int32And(*opNumber0, *opNumber1);
varAcc = IntBuildTaggedWithNoGC(ret);
varAcc = IntToTaggedNGC(ret);
DISPATCH_WITH_ACC(PREF_V8);
}
}
@ -3210,7 +3210,7 @@ DECLARE_ASM_HANDLER(HandleOr2DynPrefV8)
Bind(&accDispatch);
{
GateRef ret = Int32Or(*opNumber0, *opNumber1);
varAcc = IntBuildTaggedWithNoGC(ret);
varAcc = IntToTaggedNGC(ret);
DISPATCH_WITH_ACC(PREF_V8);
}
}
@ -3301,7 +3301,7 @@ DECLARE_ASM_HANDLER(HandleXOr2DynPrefV8)
Bind(&accDispatch);
{
GateRef ret = Int32Xor(*opNumber0, *opNumber1);
varAcc = IntBuildTaggedWithNoGC(ret);
varAcc = IntToTaggedNGC(ret);
DISPATCH_WITH_ACC(PREF_V8);
}
}
@ -3393,7 +3393,7 @@ DECLARE_ASM_HANDLER(HandleAshr2DynPrefV8)
{
GateRef shift = Int32And(*opNumber1, Int32(0x1f));
GateRef ret = Int32ASR(*opNumber0, shift);
varAcc = IntBuildTaggedWithNoGC(ret);
varAcc = IntToTaggedNGC(ret);
DISPATCH_WITH_ACC(PREF_V8);
}
}
@ -3497,7 +3497,7 @@ DECLARE_ASM_HANDLER(HandleShr2DynPrefV8)
}
Bind(&notOverflow);
{
varAcc = IntBuildTaggedWithNoGC(ret);
varAcc = IntToTaggedNGC(ret);
Jump(&accDispatch);
}
}
@ -3594,7 +3594,7 @@ DECLARE_ASM_HANDLER(HandleShl2DynPrefV8)
{
GateRef shift = Int32And(*opNumber1, Int32(0x1f));
GateRef ret = Int32LSL(*opNumber0, shift);
varAcc = IntBuildTaggedWithNoGC(ret);
varAcc = IntToTaggedNGC(ret);
DISPATCH_WITH_ACC(PREF_V8);
}
}
@ -3643,7 +3643,7 @@ DECLARE_ASM_HANDLER(HandleDefineClassWithBufferPrefId16Imm16Imm16V8V8)
Bind(&isNotException);
GateRef newLexicalEnv = GetVregValue(sp, ZExtInt8ToPtr(v0)); // slow runtime may gc
SetLexicalEnvToFunction(glue, *res, newLexicalEnv);
CallRuntime(glue, RTSTUB_ID(SetClassConstructorLength), { *res, Int16BuildTaggedTypeWithNoGC(length) });
CallRuntime(glue, RTSTUB_ID(SetClassConstructorLength), { *res, Int16ToTaggedTypeNGC(length) });
varAcc = *res;
DISPATCH_WITH_ACC(PREF_ID16_IMM16_IMM16_V8_V8);
}
@ -3726,7 +3726,7 @@ DECLARE_ASM_HANDLER(HandleLdObjByNamePrefId32V8)
GateRef stringId = ReadInst32_1(pc);
GateRef propKey = GetValueFromTaggedArray(VariableType::JS_ANY(), constpool, stringId);
result = CallRuntime(glue, RTSTUB_ID(LoadICByName),
{ profileTypeInfo, receiver, propKey, IntBuildTaggedTypeWithNoGC(slotId) });
{ profileTypeInfo, receiver, propKey, IntToTaggedTypeNGC(slotId) });
Branch(TaggedIsException(*result), &isException, &noException);
Bind(&isException);
{
@ -3805,7 +3805,7 @@ DECLARE_ASM_HANDLER(HandleStObjByNamePrefId32V8)
GateRef propKey = GetValueFromTaggedArray(VariableType::JS_ANY(), constpool, stringId);
result = ChangeTaggedPointerToInt64(CallRuntime(glue, RTSTUB_ID(StoreICByName),
{ profileTypeInfo, receiver, propKey, acc,
IntBuildTaggedTypeWithNoGC(slotId) }));
IntToTaggedTypeNGC(slotId) }));
Jump(&checkResult);
}
Bind(&checkResult);
@ -4018,7 +4018,7 @@ DECLARE_ASM_HANDLER(HandleLdaiDynImm32)
DEFVARIABLE(varAcc, VariableType::JS_ANY(), acc);
GateRef imm = ReadInst32_0(pc);
varAcc = IntBuildTaggedWithNoGC(imm);
varAcc = IntToTaggedNGC(imm);
DISPATCH_WITH_ACC(IMM32);
}
@ -4464,7 +4464,7 @@ DECLARE_ASM_HANDLER(HandleLdModuleVarPrefId32Imm8)
GateRef flag = ReadInst8_5(pc);
GateRef key = GetObjectFromConstPool(constpool, stringId);
GateRef innerFlag = ZExtInt8ToInt32(flag);
GateRef moduleVar = CallRuntime(glue, RTSTUB_ID(LdModuleVar), { key, IntBuildTaggedTypeWithNoGC(innerFlag) });
GateRef moduleVar = CallRuntime(glue, RTSTUB_ID(LdModuleVar), { key, IntToTaggedTypeNGC(innerFlag) });
varAcc = moduleVar;
DISPATCH_WITH_ACC(PREF_ID32_IMM8);
}
@ -4504,8 +4504,8 @@ DECLARE_ASM_HANDLER(HandleTryLdGlobalByNamePrefId32)
{
GateRef globalObject = GetGlobalObject(glue);
icResult = CallRuntime(glue, RTSTUB_ID(LoadMiss),
{ profileTypeInfo, globalObject, prop, IntBuildTaggedTypeWithNoGC(slotId),
IntBuildTaggedTypeWithNoGC(Int32(static_cast<int>(ICKind::NamedGlobalLoadIC))) });
{ profileTypeInfo, globalObject, prop, IntToTaggedTypeNGC(slotId),
IntToTaggedTypeNGC(Int32(static_cast<int>(ICKind::NamedGlobalLoadIC))) });
Jump(&icResultCheck);
}
Bind(&icResultCheck);
@ -4595,8 +4595,8 @@ DECLARE_ASM_HANDLER(HandleTryStGlobalByNamePrefId32)
{
GateRef globalObject = GetGlobalObject(glue);
result = CallRuntime(glue, RTSTUB_ID(StoreMiss),
{ profileTypeInfo, globalObject, propKey, acc, IntBuildTaggedTypeWithNoGC(slotId),
IntBuildTaggedTypeWithNoGC(Int32(static_cast<int>(ICKind::NamedGlobalStoreIC))) });
{ profileTypeInfo, globalObject, propKey, acc, IntToTaggedTypeNGC(slotId),
IntToTaggedTypeNGC(Int32(static_cast<int>(ICKind::NamedGlobalStoreIC))) });
Jump(&checkResult);
}
}
@ -4678,8 +4678,8 @@ DECLARE_ASM_HANDLER(HandleLdGlobalVarPrefId32)
Bind(&ldMiss);
{
result = CallRuntime(glue, RTSTUB_ID(LoadMiss),
{ profileTypeInfo, globalObject, propKey, IntBuildTaggedTypeWithNoGC(slotId),
IntBuildTaggedTypeWithNoGC(Int32(static_cast<int>(ICKind::NamedGlobalLoadIC))) });
{ profileTypeInfo, globalObject, propKey, IntToTaggedTypeNGC(slotId),
IntToTaggedTypeNGC(Int32(static_cast<int>(ICKind::NamedGlobalLoadIC))) });
Jump(&checkResult);
}
}
@ -4737,8 +4737,8 @@ DECLARE_ASM_HANDLER(HandleStGlobalVarPrefId32)
{
GateRef globalObject = GetGlobalObject(glue);
result = CallRuntime(glue, RTSTUB_ID(StoreMiss),
{ profileTypeInfo, globalObject, propKey, acc, IntBuildTaggedTypeWithNoGC(slotId),
IntBuildTaggedTypeWithNoGC(Int32(static_cast<int>(ICKind::NamedGlobalStoreIC))) });
{ profileTypeInfo, globalObject, propKey, acc, IntToTaggedTypeNGC(slotId),
IntToTaggedTypeNGC(Int32(static_cast<int>(ICKind::NamedGlobalStoreIC))) });
Jump(&checkResult);
}
}
@ -4768,7 +4768,7 @@ DECLARE_ASM_HANDLER(HandleCreateRegExpWithLiteralPrefId32Imm8)
GateRef pattern = GetObjectFromConstPool(constpool, stringId);
GateRef flags = ReadInst8_5(pc);
GateRef res = CallRuntime(glue, RTSTUB_ID(CreateRegExpWithLiteral),
{ pattern, Int8BuildTaggedTypeWithNoGC(flags) });
{ pattern, Int8ToTaggedTypeNGC(flags) });
Label isException(env);
Label notException(env);
Branch(TaggedIsException(res), &isException, &notException);
@ -5091,7 +5091,7 @@ DECLARE_ASM_HANDLER(HandleNewLexEnvWithNameDynPrefImm16Imm16)
GateRef numVars = ReadInst16_1(pc);
GateRef scopeId = ReadInst16_3(pc);
GateRef res = CallRuntime(glue, RTSTUB_ID(NewLexicalEnvWithNameDyn),
{ Int16BuildTaggedTypeWithNoGC(numVars), Int16BuildTaggedTypeWithNoGC(scopeId) });
{ Int16ToTaggedTypeNGC(numVars), Int16ToTaggedTypeNGC(scopeId) });
Label isException(env);
Label notException(env);
Branch(TaggedIsException(res), &isException, &notException);
@ -5127,7 +5127,7 @@ DECLARE_ASM_HANDLER(InterpreterGetPropertyByName)
{
GateRef slotId = ZExtInt8ToInt32(ReadInst8_0(pc));
result = CallRuntime(glue, RTSTUB_ID(LoadICByName),
{ profileTypeInfo, receiver, propKey, IntBuildTaggedTypeWithNoGC(slotId) });
{ profileTypeInfo, receiver, propKey, IntToTaggedTypeNGC(slotId) });
Jump(&checkResult);
}
Bind(&checkResult);

View File

@ -701,33 +701,33 @@ inline GateRef Stub::TaggedGetInt(GateRef x)
return TruncInt64ToInt32(Int64And(x, Int64(~JSTaggedValue::TAG_MARK)));
}
inline GateRef Stub::Int8BuildTaggedTypeWithNoGC(GateRef x)
inline GateRef Stub::Int8ToTaggedTypeNGC(GateRef x)
{
GateRef val = ZExtInt8ToInt64(x);
GateRef val = SExtInt8ToInt64(x);
return Int64Or(val, Int64(JSTaggedValue::TAG_INT));
}
inline GateRef Stub::Int16BuildTaggedWithNoGC(GateRef x)
inline GateRef Stub::Int16ToTaggedNGC(GateRef x)
{
GateRef val = ZExtInt16ToInt64(x);
GateRef val = SExtInt16ToInt64(x);
return ChangeInt64ToTagged(Int64Or(val, Int64(JSTaggedValue::TAG_INT)));
}
inline GateRef Stub::Int16BuildTaggedTypeWithNoGC(GateRef x)
inline GateRef Stub::Int16ToTaggedTypeNGC(GateRef x)
{
GateRef val = ZExtInt16ToInt64(x);
GateRef val = SExtInt16ToInt64(x);
return Int64Or(val, Int64(JSTaggedValue::TAG_INT));
}
inline GateRef Stub::IntBuildTaggedWithNoGC(GateRef x)
inline GateRef Stub::IntToTaggedNGC(GateRef x)
{
GateRef val = ZExtInt32ToInt64(x);
GateRef val = SExtInt32ToInt64(x);
return ChangeInt64ToTagged(Int64Or(val, Int64(JSTaggedValue::TAG_INT)));
}
inline GateRef Stub::IntBuildTaggedTypeWithNoGC(GateRef x)
inline GateRef Stub::IntToTaggedTypeNGC(GateRef x)
{
GateRef val = ZExtInt32ToInt64(x);
GateRef val = SExtInt32ToInt64(x);
return Int64Or(val, Int64(JSTaggedValue::TAG_INT));
}
@ -1612,6 +1612,16 @@ inline GateRef Stub::SExtInt32ToInt64(GateRef x)
return env_.GetBulder()->UnaryArithmetic(OpCode(OpCode::SEXT_TO_INT64), x);
}
inline GateRef Stub::SExtInt16ToInt64(GateRef x)
{
return env_.GetBulder()->UnaryArithmetic(OpCode(OpCode::SEXT_TO_INT64), x);
}
inline GateRef Stub::SExtInt8ToInt64(GateRef x)
{
return env_.GetBulder()->UnaryArithmetic(OpCode(OpCode::SEXT_TO_INT64), x);
}
inline GateRef Stub::SExtInt1ToInt64(GateRef x)
{
return env_.GetBulder()->UnaryArithmetic(OpCode(OpCode::SEXT_TO_INT64), x);

View File

@ -179,7 +179,7 @@ GateRef Stub::FindElementFromNumberDictionary(GateRef glue, GateRef elements, Ga
DEFVARIABLE(count, VariableType::INT32(), Int32(1));
GateRef len = Int32(sizeof(int) / sizeof(uint8_t));
GateRef hash = CallRuntime(glue, RTSTUB_ID(GetHash32),
{ IntBuildTaggedTypeWithNoGC(index), IntBuildTaggedTypeWithNoGC(len) });
{ IntToTaggedTypeNGC(index), IntToTaggedTypeNGC(len) });
DEFVARIABLE(entry, VariableType::INT32(),
Int32And(TruncInt64ToInt32(ChangeTaggedPointerToInt64(hash)), Int32Sub(capacity, Int32(1))));
Label loopHead(env);
@ -700,11 +700,11 @@ void Stub::JSHClassAddProperty(GateRef glue, GateRef receiver, GateRef key, Gate
Int32(JSTaggedValue::TaggedTypeSize()));
GateRef inlineProps = GetInlinedPropertiesFromHClass(hclass);
GateRef newJshclass = CallRuntime(glue, RTSTUB_ID(NewEcmaDynClass),
{ IntBuildTaggedTypeWithNoGC(size), IntBuildTaggedTypeWithNoGC(type),
IntBuildTaggedTypeWithNoGC(inlineProps) });
{ IntToTaggedTypeNGC(size), IntToTaggedTypeNGC(type),
IntToTaggedTypeNGC(inlineProps) });
CopyAllHClass(glue, newJshclass, hclass);
CallRuntime(glue, RTSTUB_ID(UpdateLayOutAndAddTransition),
{ hclass, newJshclass, key, IntBuildTaggedTypeWithNoGC(attr) });
{ hclass, newJshclass, key, IntToTaggedTypeNGC(attr) });
#if ECMASCRIPT_ENABLE_IC
NotifyHClassChanged(glue, hclass, newJshclass);
#endif
@ -785,7 +785,7 @@ GateRef Stub::AddPropertyByName(GateRef glue, GateRef receiver, GateRef key, Gat
Bind(&lenIsZero);
{
length = Int32(JSObject::MIN_PROPERTIES_LENGTH);
array = CallRuntime(glue, RTSTUB_ID(NewTaggedArray), { IntBuildTaggedTypeWithNoGC(*length) });
array = CallRuntime(glue, RTSTUB_ID(NewTaggedArray), { IntToTaggedTypeNGC(*length) });
SetPropertiesArray(VariableType::JS_POINTER(), glue, receiver, *array);
Jump(&afterLenCon);
}
@ -800,7 +800,7 @@ GateRef Stub::AddPropertyByName(GateRef glue, GateRef receiver, GateRef key, Gat
Bind(&isDictMode);
{
GateRef res = CallRuntime(glue, RTSTUB_ID(NameDictPutIfAbsent),
{receiver, *array, key, value, IntBuildTaggedTypeWithNoGC(*attr), TaggedFalse()});
{receiver, *array, key, value, IntToTaggedTypeNGC(*attr), TaggedFalse()});
SetPropertiesArray(VariableType::JS_POINTER(), glue, receiver, res);
Jump(&exit);
}
@ -826,7 +826,7 @@ GateRef Stub::AddPropertyByName(GateRef glue, GateRef receiver, GateRef key, Gat
attr = SetDictionaryOrderFieldInPropAttr(*attr,
Int32(PropertyAttributes::MAX_CAPACITY_OF_PROPERTIES));
GateRef res = CallRuntime(glue, RTSTUB_ID(NameDictPutIfAbsent),
{ receiver, *array, key, value, IntBuildTaggedTypeWithNoGC(*attr), TaggedTrue() });
{ receiver, *array, key, value, IntToTaggedTypeNGC(*attr), TaggedTrue() });
SetPropertiesArray(VariableType::JS_POINTER(), glue, receiver, res);
result = Undefined(VariableType::INT64());
Jump(&exit);
@ -837,7 +837,7 @@ GateRef Stub::AddPropertyByName(GateRef glue, GateRef receiver, GateRef key, Gat
Bind(&afterDictChangeCon);
GateRef capacity = ComputePropertyCapacityInJSObj(*length);
array = CallRuntime(glue, RTSTUB_ID(CopyArray),
{ *array, IntBuildTaggedTypeWithNoGC(*length), IntBuildTaggedTypeWithNoGC(capacity) });
{ *array, IntToTaggedTypeNGC(*length), IntToTaggedTypeNGC(capacity) });
SetPropertiesArray(VariableType::JS_POINTER(), glue, receiver, *array);
Jump(&afterArrLenCon);
}
@ -862,7 +862,7 @@ GateRef Stub::AddPropertyByName(GateRef glue, GateRef receiver, GateRef key, Gat
void Stub::ThrowTypeAndReturn(GateRef glue, int messageId, GateRef val)
{
GateRef msgIntId = Int32(messageId);
CallRuntime(glue, RTSTUB_ID(ThrowTypeError), { IntBuildTaggedTypeWithNoGC(msgIntId) });
CallRuntime(glue, RTSTUB_ID(ThrowTypeError), { IntToTaggedTypeNGC(msgIntId) });
Return(val);
}
@ -1517,7 +1517,7 @@ GateRef Stub::ICStoreElement(GateRef glue, GateRef receiver, GateRef key, GateRe
Bind(&indexGreaterLength);
Store(VariableType::INT64(), glue, receiver,
IntPtr(panda::ecmascript::JSArray::LENGTH_OFFSET),
IntBuildTaggedWithNoGC(Int32Add(index, Int32(1))));
IntToTaggedNGC(Int32Add(index, Int32(1))));
Jump(&handerInfoNotJSArray);
}
Bind(&handerInfoNotJSArray);
@ -1529,8 +1529,8 @@ GateRef Stub::ICStoreElement(GateRef glue, GateRef receiver, GateRef key, GateRe
{
result = ChangeTaggedPointerToInt64(CallRuntime(glue,
RTSTUB_ID(TaggedArraySetValue),
{ receiver, value, elements, IntBuildTaggedTypeWithNoGC(index),
IntBuildTaggedTypeWithNoGC(capacity) }));
{ receiver, value, elements, IntToTaggedTypeNGC(index),
IntToTaggedTypeNGC(capacity) }));
Jump(&exit);
}
Bind(&storeElement);
@ -1729,8 +1729,8 @@ void Stub::StoreWithTransition(GateRef glue, GateRef receiver, GateRef value, Ga
{
CallRuntime(glue,
RTSTUB_ID(PropertiesSetValue),
{ receiver, value, array, IntBuildTaggedTypeWithNoGC(capacity),
IntBuildTaggedTypeWithNoGC(index) });
{ receiver, value, array, IntToTaggedTypeNGC(capacity),
IntToTaggedTypeNGC(index) });
Jump(&exit);
}
Bind(&indexLessCapacity);
@ -1844,7 +1844,7 @@ inline void Stub::UpdateValueAndAttributes(GateRef glue, GateRef elements, GateR
GateRef attroffset =
PtrMul(ChangeInt32ToIntPtr(attributesIndex), IntPtr(JSTaggedValue::TaggedTypeSize()));
GateRef dataOffset = PtrAdd(attroffset, IntPtr(TaggedArray::DATA_OFFSET));
Store(VariableType::INT64(), glue, elements, dataOffset, IntBuildTaggedWithNoGC(attr));
Store(VariableType::INT64(), glue, elements, dataOffset, IntToTaggedNGC(attr));
}
inline void Stub::UpdateValueInDict(GateRef glue, GateRef elements, GateRef index, GateRef value)
@ -1884,7 +1884,7 @@ GateRef Stub::GetPropertyByIndex(GateRef glue, GateRef receiver, GateRef index)
Bind(&isFastTypeArray);
{
result = CallRuntime(glue, RTSTUB_ID(GetTypeArrayPropertyByIndex),
{ *holder, IntBuildTaggedTypeWithNoGC(index), IntBuildTaggedTypeWithNoGC(jsType)});
{ *holder, IntToTaggedTypeNGC(index), IntToTaggedTypeNGC(jsType)});
Jump(&exit);
}
Bind(&notFastTypeArray);
@ -2335,7 +2335,7 @@ GateRef Stub::SetPropertyByIndex(GateRef glue, GateRef receiver, GateRef index,
Bind(&isFastTypeArray);
{
returnValue = ChangeTaggedPointerToInt64(CallRuntime(glue, RTSTUB_ID(SetTypeArrayPropertyByIndex),
{ receiver, IntBuildTaggedTypeWithNoGC(index), value, IntBuildTaggedTypeWithNoGC(jsType)}));
{ receiver, IntToTaggedTypeNGC(index), value, IntToTaggedTypeNGC(jsType)}));
Jump(&exit);
}
Bind(&notFastTypeArray);
@ -2407,8 +2407,8 @@ GateRef Stub::SetPropertyByIndex(GateRef glue, GateRef receiver, GateRef index,
Bind(&isExtensible);
{
GateRef result = CallRuntime(glue, RTSTUB_ID(AddElementInternal),
{ receiver, IntBuildTaggedTypeWithNoGC(index), value,
IntBuildTaggedTypeWithNoGC(Int32(PropertyAttributes::GetDefaultAttributes())) });
{ receiver, IntToTaggedTypeNGC(index), value,
IntToTaggedTypeNGC(Int32(PropertyAttributes::GetDefaultAttributes())) });
Label success(env);
Label failed(env);
Branch(TaggedIsTrue(result), &success, &failed);
@ -2426,7 +2426,7 @@ GateRef Stub::SetPropertyByIndex(GateRef glue, GateRef receiver, GateRef index,
Bind(&notExtensible);
{
GateRef taggedId = Int32(GET_MESSAGE_STRING_ID(SetPropertyWhenNotExtensible));
CallRuntime(glue, RTSTUB_ID(ThrowTypeError), { IntBuildTaggedTypeWithNoGC(taggedId) });
CallRuntime(glue, RTSTUB_ID(ThrowTypeError), { IntToTaggedTypeNGC(taggedId) });
returnValue = Exception(VariableType::INT64());
Jump(&exit);
}
@ -2491,7 +2491,7 @@ GateRef Stub::SetPropertyByName(GateRef glue, GateRef receiver, GateRef key, Gat
Bind(&isSpecialContainer);
{
GateRef taggedId = Int32(GET_MESSAGE_STRING_ID(CanNotSetPropertyOnContainer));
CallRuntime(glue, RTSTUB_ID(ThrowTypeError), { IntBuildTaggedTypeWithNoGC(taggedId) });
CallRuntime(glue, RTSTUB_ID(ThrowTypeError), { IntToTaggedTypeNGC(taggedId) });
result = Exception(VariableType::INT64());
Jump(&exit);
}
@ -2551,7 +2551,7 @@ GateRef Stub::SetPropertyByName(GateRef glue, GateRef receiver, GateRef key, Gat
Bind(&notWritable);
{
GateRef taggedId = Int32(GET_MESSAGE_STRING_ID(SetReadOnlyProperty));
CallRuntime(glue, RTSTUB_ID(ThrowTypeError), { IntBuildTaggedTypeWithNoGC(taggedId) });
CallRuntime(glue, RTSTUB_ID(ThrowTypeError), { IntToTaggedTypeNGC(taggedId) });
result = Exception(VariableType::INT64());
Jump(&exit);
}
@ -2616,7 +2616,7 @@ GateRef Stub::SetPropertyByName(GateRef glue, GateRef receiver, GateRef key, Gat
Bind(&notWritable1);
{
GateRef taggedId = Int32(GET_MESSAGE_STRING_ID(SetReadOnlyProperty));
CallRuntime(glue, RTSTUB_ID(ThrowTypeError), { IntBuildTaggedTypeWithNoGC(taggedId) });
CallRuntime(glue, RTSTUB_ID(ThrowTypeError), { IntToTaggedTypeNGC(taggedId) });
result = Exception(VariableType::INT64());
Jump(&exit);
}
@ -2661,7 +2661,7 @@ GateRef Stub::SetPropertyByName(GateRef glue, GateRef receiver, GateRef key, Gat
Bind(&inextensible);
{
GateRef taggedId = Int32(GET_MESSAGE_STRING_ID(SetPropertyWhenNotExtensible));
CallRuntime(glue, RTSTUB_ID(ThrowTypeError), { IntBuildTaggedTypeWithNoGC(taggedId) });
CallRuntime(glue, RTSTUB_ID(ThrowTypeError), { IntToTaggedTypeNGC(taggedId) });
result = Exception(VariableType::INT64());
Jump(&exit);
}
@ -3452,7 +3452,7 @@ GateRef Stub::FastAddSubAndMul(GateRef left, GateRef right)
}
Bind(&notOverflow);
{
result = IntBuildTaggedWithNoGC(ChangeInt64ToInt32(res));
result = IntToTaggedNGC(ChangeInt64ToInt32(res));
Jump(&exit);
}
Bind(&exit);
@ -3512,7 +3512,7 @@ GateRef Stub::FastMod(GateRef glue, GateRef left, GateRef right)
Branch(Int32GreaterThan(*intRight, Int32(0)), &rightGreaterZero, &leftNotIntOrRightNotInt);
Bind(&rightGreaterZero);
{
result = IntBuildTaggedWithNoGC(Int32Mod(*intLeft, *intRight));
result = IntToTaggedNGC(Int32Mod(*intLeft, *intRight));
Jump(&exit);
}
}
@ -3666,7 +3666,7 @@ GateRef Stub::JSAPIContainerGet(GateRef glue, GateRef receiver, GateRef index)
Bind(&notValidIndex);
{
GateRef taggedId = Int32(GET_MESSAGE_STRING_ID(GetPropertyOutOfBounds));
CallRuntime(glue, RTSTUB_ID(ThrowTypeError), { IntBuildTaggedTypeWithNoGC(taggedId) });
CallRuntime(glue, RTSTUB_ID(ThrowTypeError), { IntToTaggedTypeNGC(taggedId) });
result = Exception();
Jump(&exit);
}
@ -3780,7 +3780,7 @@ GateRef Stub::AllocateInYoung(GateRef glue, GateRef size)
Bind(&callRuntime);
{
result = CallRuntime(glue, RTSTUB_ID(AllocateInYoung), {
IntBuildTaggedTypeWithNoGC(size) });
IntToTaggedTypeNGC(size) });
Jump(&exit);
}
Bind(&exit);
@ -4265,7 +4265,7 @@ GateRef Stub::GetTypeArrayPropertyByName(GateRef glue, GateRef receiver, GateRef
Bind(&validIndex);
{
result = CallRuntime(glue, RTSTUB_ID(GetTypeArrayPropertyByIndex),
{ holder, IntBuildTaggedTypeWithNoGC(index), IntBuildTaggedTypeWithNoGC(jsType) });
{ holder, IntToTaggedTypeNGC(index), IntToTaggedTypeNGC(jsType) });
Jump(&exit);
}
Bind(&notValidIndex);
@ -4326,7 +4326,7 @@ GateRef Stub::SetTypeArrayPropertyByName(GateRef glue, GateRef receiver, GateRef
Bind(&validIndex);
{
result = CallRuntime(glue, RTSTUB_ID(SetTypeArrayPropertyByIndex),
{ receiver, IntBuildTaggedTypeWithNoGC(index), value, IntBuildTaggedTypeWithNoGC(jsType) });
{ receiver, IntToTaggedTypeNGC(index), value, IntToTaggedTypeNGC(jsType) });
Jump(&exit);
}
Bind(&notValidIndex);

View File

@ -182,11 +182,11 @@ public:
GateRef TaggedIsFalse(GateRef x);
GateRef TaggedIsBoolean(GateRef x);
GateRef TaggedGetInt(GateRef x);
GateRef Int8BuildTaggedTypeWithNoGC(GateRef x);
GateRef Int16BuildTaggedWithNoGC(GateRef x);
GateRef Int16BuildTaggedTypeWithNoGC(GateRef x);
GateRef IntBuildTaggedWithNoGC(GateRef x);
GateRef IntBuildTaggedTypeWithNoGC(GateRef x);
GateRef Int8ToTaggedTypeNGC(GateRef x);
GateRef Int16ToTaggedNGC(GateRef x);
GateRef Int16ToTaggedTypeNGC(GateRef x);
GateRef IntToTaggedNGC(GateRef x);
GateRef IntToTaggedTypeNGC(GateRef x);
GateRef DoubleBuildTaggedWithNoGC(GateRef x);
GateRef DoubleBuildTaggedTypeWithNoGC(GateRef x);
GateRef CastDoubleToInt64(GateRef x);
@ -369,6 +369,8 @@ public:
GateRef ChangeInt64ToTagged(GateRef x);
GateRef CastInt64ToFloat64(GateRef x);
GateRef SExtInt32ToInt64(GateRef x);
GateRef SExtInt16ToInt64(GateRef x);
GateRef SExtInt8ToInt64(GateRef x);
GateRef SExtInt1ToInt64(GateRef x);
GateRef SExtInt1ToInt32(GateRef x);
GateRef ZExtInt8ToInt16(GateRef x);

View File

@ -35,8 +35,8 @@ void FooAOTStub::GenerateCircuit(const CompilationConfig *cfg)
GateRef b = TaggedArgument(6);
GateRef bcOffset = Int32Argument(1);
(void)calltarget;
GateRef barIndex = IntBuildTaggedWithNoGC(Int32(CommonStubCSigns::BarAOT));
GateRef numArgs = IntBuildTaggedWithNoGC(Int32(2));
GateRef barIndex = IntToTaggedNGC(Int32(CommonStubCSigns::BarAOT));
GateRef numArgs = IntToTaggedNGC(Int32(2));
GateRef barfunc = CallRuntime(glue, RTSTUB_ID(DefineAotFunc), {barIndex, numArgs});
GateRef result = CallNGCRuntime(glue, RTSTUB_ID(JSCall), {glue, argc, barfunc, newtarget, thisObj, a, b, bcOffset});
Return(result);
@ -68,8 +68,8 @@ void Foo1AOTStub::GenerateCircuit(const CompilationConfig *cfg)
GateRef b = TaggedArgument(6);
GateRef bcOffset = Int32Argument(1);
(void)calltarget;
GateRef barIndex = IntBuildTaggedTypeWithNoGC(Int32(CommonStubCSigns::Bar1AOT));
GateRef numArgs = IntBuildTaggedTypeWithNoGC(Int32(3));
GateRef barIndex = IntToTaggedTypeNGC(Int32(CommonStubCSigns::Bar1AOT));
GateRef numArgs = IntToTaggedTypeNGC(Int32(3));
GateRef barfunc = CallRuntime(glue, RTSTUB_ID(DefineAotFunc), {barIndex, numArgs});
GateRef result = CallNGCRuntime(glue, RTSTUB_ID(JSCall), {glue, argc, barfunc, newtarget, thisObj, a, b, bcOffset});
Return(result);
@ -108,8 +108,8 @@ void Foo2AOTStub::GenerateCircuit(const CompilationConfig *cfg)
GateRef bcOffset = Int32Argument(1);
(void)calltarget;
GateRef actualArgC = Int32Add(argc, Int32(1));
GateRef barIndex = IntBuildTaggedTypeWithNoGC(Int32(CommonStubCSigns::BarAOT));
GateRef numArgs = IntBuildTaggedTypeWithNoGC(Int32(2));
GateRef barIndex = IntToTaggedTypeNGC(Int32(CommonStubCSigns::BarAOT));
GateRef numArgs = IntToTaggedTypeNGC(Int32(2));
GateRef barfunc = CallRuntime(glue, RTSTUB_ID(DefineAotFunc), {barIndex, numArgs});
GateRef result = CallNGCRuntime(glue, RTSTUB_ID(JSCall), {glue, actualArgC, barfunc, newtarget, thisObj,
a, b, Undefined(), bcOffset});
@ -145,11 +145,11 @@ void FooBoundAOTStub::GenerateCircuit(const CompilationConfig *cfg)
GateRef thisObj = TaggedArgument(4);
GateRef a = TaggedArgument(5);
GateRef b = TaggedArgument(6);
GateRef bindArguments = IntBuildTaggedTypeWithNoGC(Int32(37));
GateRef bindArguments = IntToTaggedTypeNGC(Int32(37));
GateRef bcOffset = Int32Argument(1);
(void)calltarget;
GateRef numArgs = IntBuildTaggedTypeWithNoGC(Int32(2));
GateRef barIndex = IntBuildTaggedTypeWithNoGC(Int32(CommonStubCSigns::BarAOT));
GateRef numArgs = IntToTaggedTypeNGC(Int32(2));
GateRef barIndex = IntToTaggedTypeNGC(Int32(CommonStubCSigns::BarAOT));
GateRef barfunc = CallRuntime(glue, RTSTUB_ID(DefineAotFunc), {barIndex, numArgs});
GateRef bindfunc = CallRuntime(glue, RTSTUB_ID(GetBindFunc), {barfunc});
GateRef newjsfunc = CallNGCRuntime(glue, RTSTUB_ID(JSCall), {glue, Int32(5), bindfunc, newtarget, barfunc,
@ -171,8 +171,8 @@ void FooProxyAOTStub::GenerateCircuit(const CompilationConfig *cfg)
GateRef b = TaggedArgument(6);
GateRef bcOffset = Int32Argument(1);
GateRef barIndex = IntBuildTaggedTypeWithNoGC(Int32(CommonStubCSigns::BarAOT));
GateRef numArgs = IntBuildTaggedTypeWithNoGC(Int32(2));
GateRef barIndex = IntToTaggedTypeNGC(Int32(CommonStubCSigns::BarAOT));
GateRef numArgs = IntToTaggedTypeNGC(Int32(2));
GateRef barfunc = CallRuntime(glue, RTSTUB_ID(DefineAotFunc), {barIndex, numArgs});
GateRef proxyfunc = CallRuntime(glue, RTSTUB_ID(DefineProxyFunc), {barfunc});
@ -193,8 +193,8 @@ void FooProxy2AOTStub::GenerateCircuit(const CompilationConfig *cfg)
GateRef b = TaggedArgument(6);
GateRef bcOffset = Int32Argument(1);
GateRef barIndex = IntBuildTaggedTypeWithNoGC(Int32(CommonStubCSigns::Bar2AOT));
GateRef numArgs = IntBuildTaggedTypeWithNoGC(Int32(2));
GateRef barIndex = IntToTaggedTypeNGC(Int32(CommonStubCSigns::Bar2AOT));
GateRef numArgs = IntToTaggedTypeNGC(Int32(2));
GateRef barfunc = CallRuntime(glue, RTSTUB_ID(DefineAotFunc), {barIndex, numArgs});
GateRef proxyHandler = CallRuntime(glue, RTSTUB_ID(DefineProxyHandler), {barfunc});