mirror of
https://gitee.com/openharmony/arkcompiler_ets_runtime
synced 2025-02-25 23:08:22 +00:00
!8156 DefineField 函数IR化导致三方库应用启动失败
Merge pull request !8156 from 马昌友/master
This commit is contained in:
commit
47931be0df
@ -260,7 +260,7 @@ CallSignature BaselineStubCSigns::callSigns_[BaselineStubCSigns::NUM_OF_STUBS];
|
||||
} \
|
||||
Bind(&slowPath); \
|
||||
{ \
|
||||
result = CallRuntime(glue, RTSTUB_ID(DefineField), {receiver, propKey, acc}); \
|
||||
result = DefineField(glue, receiver, propKey, acc); \
|
||||
Jump(&exit); \
|
||||
} \
|
||||
Bind(&exit)
|
||||
@ -5431,7 +5431,7 @@ void BaselineCallRuntimeDefineFieldByValuePrefImm8V8V8StubBuilder::GenerateCircu
|
||||
GateRef obj = GetVregValue(sp, ZExtInt8ToPtr(v1));
|
||||
GateRef propKey = GetVregValue(sp, ZExtInt8ToPtr(v0));
|
||||
|
||||
GateRef res = CallRuntime(glue, RTSTUB_ID(DefineField), {obj, propKey, acc});
|
||||
GateRef res = DefineField(glue, obj, propKey, acc);
|
||||
CHECK_EXCEPTION_WITH_ACC(res);
|
||||
}
|
||||
|
||||
@ -5445,7 +5445,7 @@ void BaselineCallRuntimeDefineFieldByIndexPrefImm8Imm32V8StubBuilder::GenerateCi
|
||||
|
||||
GateRef propKey = IntToTaggedInt(index);
|
||||
GateRef obj = GetVregValue(sp, ZExtInt8ToPtr(v0));
|
||||
GateRef res = CallRuntime(glue, RTSTUB_ID(DefineField), {obj, propKey, acc});
|
||||
GateRef res = DefineField(glue, obj, propKey, acc);
|
||||
CHECK_EXCEPTION_WITH_ACC(res);
|
||||
}
|
||||
|
||||
|
@ -420,7 +420,7 @@ void name##StubBuilder::GenerateCircuitImpl(GateRef glue, GateRef sp, GateRef pc
|
||||
} \
|
||||
Bind(&slowPath); \
|
||||
{ \
|
||||
result = CallRuntime(glue, RTSTUB_ID(DefineField), {receiver, propKey, acc}); \
|
||||
result = DefineField(glue, receiver, propKey, acc); \
|
||||
Jump(&exit); \
|
||||
} \
|
||||
Bind(&exit)
|
||||
@ -5587,7 +5587,7 @@ DECLARE_ASM_HANDLER(HandleCallRuntimeDefineFieldByValuePrefImm8V8V8)
|
||||
GateRef v1 = ReadInst8_3(pc);
|
||||
GateRef obj = GetVregValue(sp, ZExtInt8ToPtr(v1));
|
||||
GateRef propKey = GetVregValue(sp, ZExtInt8ToPtr(v0));
|
||||
GateRef res = CallRuntime(glue, RTSTUB_ID(DefineField), {obj, propKey, acc}); // acc as value
|
||||
GateRef res = DefineField(glue, obj, propKey, acc); // acc as value
|
||||
CHECK_EXCEPTION_WITH_ACC(res, INT_PTR(CALLRUNTIME_DEFINEFIELDBYVALUE_PREF_IMM8_V8_V8));
|
||||
}
|
||||
|
||||
@ -5597,7 +5597,7 @@ DECLARE_ASM_HANDLER(HandleCallRuntimeDefineFieldByIndexPrefImm8Imm32V8)
|
||||
GateRef v0 = ReadInst8_6(pc);
|
||||
GateRef obj = GetVregValue(sp, ZExtInt8ToPtr(v0));
|
||||
GateRef propKey = IntToTaggedInt(index);
|
||||
GateRef res = CallRuntime(glue, RTSTUB_ID(DefineField), {obj, propKey, acc}); // acc as value
|
||||
GateRef res = DefineField(glue, obj, propKey, acc); // acc as value
|
||||
CHECK_EXCEPTION_WITH_ACC(res, INT_PTR(CALLRUNTIME_DEFINEFIELDBYINDEX_PREF_IMM8_IMM32_V8));
|
||||
}
|
||||
|
||||
|
@ -1130,6 +1130,16 @@ inline GateRef StubBuilder::TruncFloatToInt64(GateRef val)
|
||||
return env_->GetBuilder()->TruncFloatToInt64(val);
|
||||
}
|
||||
|
||||
inline void StubBuilder::CanNotConvertNotValidObject([[maybe_unused]] GateRef obj)
|
||||
{
|
||||
ASM_ASSERT(GET_MESSAGE_STRING_ID(CanNotConvertNotValidObject), IsEcmaObject(obj));
|
||||
}
|
||||
|
||||
inline void StubBuilder::IsNotPropertyKey([[maybe_unused]] GateRef flag)
|
||||
{
|
||||
ASM_ASSERT(GET_MESSAGE_STRING_ID(IsNotPropertyKey), flag);
|
||||
}
|
||||
|
||||
inline GateRef StubBuilder::ChangeInt64ToIntPtr(GateRef val)
|
||||
{
|
||||
if (env_->IsArch32Bit()) {
|
||||
@ -2303,11 +2313,11 @@ inline GateRef StubBuilder::IsSpecialIndexedObj(GateRef jsType)
|
||||
}
|
||||
|
||||
inline void StubBuilder::CheckUpdateSharedType(bool isDicMode, Variable *result, GateRef glue, GateRef receiver,
|
||||
GateRef attr, GateRef value, Label *executeSetProp, Label *exit)
|
||||
GateRef attr, GateRef value, Label *executeSetProp, Label *exit, GateRef SCheckModelIsCHECK)
|
||||
{
|
||||
auto *env = GetEnvironment();
|
||||
Label isJSShared(env);
|
||||
BRANCH(IsJSShared(receiver), &isJSShared, executeSetProp);
|
||||
BRANCH(BoolAnd(IsJSShared(receiver), SCheckModelIsCHECK), &isJSShared, executeSetProp);
|
||||
Bind(&isJSShared);
|
||||
{
|
||||
Label typeMismatch(env);
|
||||
|
@ -555,6 +555,154 @@ GateRef StubBuilder::GetKeyHashCode(GateRef glue, GateRef key, GateRef hir)
|
||||
return ret;
|
||||
}
|
||||
|
||||
GateRef StubBuilder::CreateDataProperty(GateRef glue, GateRef obj, GateRef propKey, GateRef value)
|
||||
{
|
||||
auto env = GetEnvironment();
|
||||
Label subentry(env);
|
||||
env->SubCfgEntry(&subentry);
|
||||
Label exit(env);
|
||||
Label next(env);
|
||||
Label objIsShared(env);
|
||||
Label objIsNotShared(env);
|
||||
Label isHole(env);
|
||||
Label notHole(env);
|
||||
Label hasPendingException(env);
|
||||
Label isJSShared(env);
|
||||
Label isNotJSShared(env);
|
||||
|
||||
DEFVARIABLE(result, VariableType::BOOL(), True());
|
||||
DEFVARIABLE(SCheckModelIsCHECK, VariableType::BOOL(), False());
|
||||
BRANCH(IsJSShared(obj), &isJSShared, &isNotJSShared);
|
||||
Bind(&isNotJSShared);
|
||||
{
|
||||
SCheckModelIsCHECK = True();
|
||||
Jump(&isJSShared);
|
||||
}
|
||||
Bind(&isJSShared);
|
||||
auto flag = SetPropertyByValue(glue, obj, propKey, value, *SCheckModelIsCHECK, false, ProfileOperation(), true);
|
||||
BRANCH(HasPendingException(glue), &hasPendingException, &next);
|
||||
Bind(&hasPendingException);
|
||||
{
|
||||
result = False();
|
||||
Jump(&exit);
|
||||
}
|
||||
Bind(&next);
|
||||
{
|
||||
BRANCH(TaggedIsHole(flag), &isHole, ¬Hole);
|
||||
Bind(&isHole);
|
||||
{
|
||||
GateRef temp = CallRuntime(glue, RTSTUB_ID(DefineOwnProperty), {obj, propKey, value});
|
||||
result = TaggedIsTrue(temp);
|
||||
Jump(&exit);
|
||||
}
|
||||
Bind(¬Hole);
|
||||
{
|
||||
result = BoolNot(TaggedIsException(flag));
|
||||
Jump(&exit);
|
||||
}
|
||||
}
|
||||
Bind(&exit);
|
||||
auto ret = *result;
|
||||
env->SubCfgExit();
|
||||
return ret;
|
||||
}
|
||||
|
||||
GateRef StubBuilder::CreateDataPropertyOrThrow(GateRef glue, GateRef obj, GateRef key, GateRef value)
|
||||
{
|
||||
auto env = GetEnvironment();
|
||||
Label subentry(env);
|
||||
env->SubCfgEntry(&subentry);
|
||||
Label exit(env);
|
||||
Label isPropertyKey(env);
|
||||
Label isNotStringOrSymbol(env);
|
||||
Label isNotNumber(env);
|
||||
Label newThrow(env);
|
||||
Label isThrow(env);
|
||||
|
||||
DEFVARIABLE(result, VariableType::BOOL(), True());
|
||||
DEFVARIABLE(isPropertyKeyFlag, VariableType::BOOL(), True());
|
||||
|
||||
CanNotConvertNotValidObject(obj);
|
||||
BRANCH(TaggedIsStringOrSymbol(key), &isPropertyKey, &isNotStringOrSymbol);
|
||||
Bind(&isNotStringOrSymbol);
|
||||
{
|
||||
BRANCH(TaggedIsNumber(key), &isPropertyKey, &isNotNumber);
|
||||
Bind(&isNotNumber);
|
||||
{
|
||||
isPropertyKeyFlag = False();
|
||||
Jump(&isPropertyKey);
|
||||
}
|
||||
}
|
||||
Bind(&isPropertyKey);
|
||||
{
|
||||
IsNotPropertyKey(*isPropertyKeyFlag);
|
||||
result = CreateDataProperty(glue, obj, key, value);
|
||||
BRANCH(*result, &exit, &isThrow);
|
||||
Bind(&isThrow);
|
||||
{
|
||||
BRANCH(HasPendingException(glue), &exit, &newThrow);
|
||||
Bind(&newThrow);
|
||||
{
|
||||
GateRef msgIntId = Int32(GET_MESSAGE_STRING_ID(CreateDataPropertyFailed));
|
||||
CallRuntime(glue, RTSTUB_ID(ThrowTypeError), { IntToTaggedInt(msgIntId)});
|
||||
Jump(&exit);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Bind(&exit);
|
||||
auto ret = *result;
|
||||
env->SubCfgExit();
|
||||
return ret;
|
||||
}
|
||||
|
||||
GateRef StubBuilder::DefineField(GateRef glue, GateRef obj, GateRef propKey, GateRef value)
|
||||
{
|
||||
auto env = GetEnvironment();
|
||||
Label entry(env);
|
||||
env->SubCfgEntry(&entry);
|
||||
Label exit(env);
|
||||
Label next(env);
|
||||
Label newThrow(env);
|
||||
Label isObj(env);
|
||||
Label notObj(env);
|
||||
Label hasPendingException(env);
|
||||
DEFVARIABLE(result, VariableType::JS_ANY(), Undefined());
|
||||
DEFVARIABLE(key, VariableType::JS_ANY(), Undefined());
|
||||
BRANCH(IsEcmaObject(obj), &isObj, ¬Obj);
|
||||
Bind(&isObj);
|
||||
{
|
||||
key = CallRuntime(glue, RTSTUB_ID(ToPropertyKey), {propKey});
|
||||
BRANCH(HasPendingException(glue), &hasPendingException, &next);
|
||||
}
|
||||
Bind(&next);
|
||||
{
|
||||
CreateDataPropertyOrThrow(glue, obj, *key, value);
|
||||
BRANCH(HasPendingException(glue), &hasPendingException, &exit);
|
||||
}
|
||||
Bind(¬Obj);
|
||||
{
|
||||
BRANCH(HasPendingException(glue), &hasPendingException, &newThrow);
|
||||
}
|
||||
Bind(&hasPendingException);
|
||||
{
|
||||
result = Exception();
|
||||
Jump(&exit);
|
||||
}
|
||||
Bind(&newThrow);
|
||||
{
|
||||
GateRef msgIntId = Int32(GET_MESSAGE_STRING_ID(DefineFieldField));
|
||||
CallRuntime(glue, RTSTUB_ID(ThrowTypeError), { IntToTaggedInt(msgIntId)});
|
||||
result = Exception();
|
||||
Jump(&exit);
|
||||
}
|
||||
|
||||
Bind(&exit);
|
||||
auto ret = *result;
|
||||
env->SubCfgExit();
|
||||
return ret;
|
||||
}
|
||||
|
||||
GateRef StubBuilder::FindElementFromNumberDictionary(GateRef glue, GateRef elements, GateRef index)
|
||||
{
|
||||
auto env = GetEnvironment();
|
||||
@ -3932,7 +4080,7 @@ GateRef StubBuilder::SetPropertyByIndex(GateRef glue, GateRef receiver, GateRef
|
||||
Bind(¬DictionaryElement);
|
||||
{
|
||||
Label isReceiver(env);
|
||||
if (useOwn) {
|
||||
if (useOwn || defineSemantics) {
|
||||
BRANCH(Equal(*holder, receiver), &isReceiver, &ifEnd);
|
||||
} else {
|
||||
BRANCH(Equal(*holder, receiver), &isReceiver, &afterLoop);
|
||||
@ -3941,7 +4089,7 @@ GateRef StubBuilder::SetPropertyByIndex(GateRef glue, GateRef receiver, GateRef
|
||||
{
|
||||
GateRef length = GetLengthOfTaggedArray(elements);
|
||||
Label inRange(env);
|
||||
if (useOwn) {
|
||||
if (useOwn || defineSemantics) {
|
||||
BRANCH(Int64LessThan(index, length), &inRange, &ifEnd);
|
||||
} else {
|
||||
BRANCH(Int64LessThan(index, length), &inRange, &loopExit);
|
||||
@ -3950,7 +4098,7 @@ GateRef StubBuilder::SetPropertyByIndex(GateRef glue, GateRef receiver, GateRef
|
||||
{
|
||||
GateRef value1 = GetTaggedValueWithElementsKind(*holder, index);
|
||||
Label notHole(env);
|
||||
if (useOwn) {
|
||||
if (useOwn || defineSemantics) {
|
||||
BRANCH(Int64NotEqual(value1, Hole()), ¬Hole, &ifEnd);
|
||||
} else {
|
||||
BRANCH(Int64NotEqual(value1, Hole()), ¬Hole, &loopExit);
|
||||
@ -4014,7 +4162,7 @@ GateRef StubBuilder::SetPropertyByIndex(GateRef glue, GateRef receiver, GateRef
|
||||
Bind(¬Accessor);
|
||||
{
|
||||
Label holdEqualsRecv(env);
|
||||
if (useOwn) {
|
||||
if (useOwn || defineSemantics) {
|
||||
BRANCH(Equal(*holder, receiver), &holdEqualsRecv, &ifEnd);
|
||||
} else {
|
||||
BRANCH(Equal(*holder, receiver), &holdEqualsRecv, &afterLoop);
|
||||
@ -4038,7 +4186,7 @@ GateRef StubBuilder::SetPropertyByIndex(GateRef glue, GateRef receiver, GateRef
|
||||
Jump(&exit);
|
||||
}
|
||||
}
|
||||
if (useOwn) {
|
||||
if (useOwn || defineSemantics) {
|
||||
Bind(&ifEnd);
|
||||
} else {
|
||||
Bind(&loopExit);
|
||||
@ -4091,6 +4239,14 @@ GateRef StubBuilder::SetPropertyByIndex(GateRef glue, GateRef receiver, GateRef
|
||||
|
||||
GateRef StubBuilder::SetPropertyByName(GateRef glue, GateRef receiver, GateRef key, GateRef value,
|
||||
bool useOwn, GateRef isInternal, ProfileOperation callback, bool canUseIsInternal, bool defineSemantics)
|
||||
{
|
||||
return SetPropertyByName(glue, receiver, key, value, useOwn, isInternal,
|
||||
True(), callback, canUseIsInternal, defineSemantics);
|
||||
}
|
||||
|
||||
GateRef StubBuilder::SetPropertyByName(GateRef glue, GateRef receiver, GateRef key, GateRef value,
|
||||
bool useOwn, GateRef isInternal, GateRef SCheckModelIsCHECK, ProfileOperation callback,
|
||||
bool canUseIsInternal, bool defineSemantics)
|
||||
{
|
||||
auto env = GetEnvironment();
|
||||
Label entryPass(env);
|
||||
@ -4105,7 +4261,7 @@ GateRef StubBuilder::SetPropertyByName(GateRef glue, GateRef receiver, GateRef k
|
||||
Label loopExit(env);
|
||||
Label afterLoop(env);
|
||||
Label findProperty(env);
|
||||
if (!useOwn) {
|
||||
if (!useOwn && !defineSemantics) {
|
||||
// a do while loop
|
||||
Jump(&loopHead);
|
||||
LoopBegin(&loopHead);
|
||||
@ -4159,7 +4315,7 @@ GateRef StubBuilder::SetPropertyByName(GateRef glue, GateRef receiver, GateRef k
|
||||
Bind(¬SIndexObj);
|
||||
{
|
||||
if (canUseIsInternal) {
|
||||
if (useOwn) {
|
||||
if (useOwn || defineSemantics) {
|
||||
BRANCH(isInternal, &findProperty, &ifEnd);
|
||||
} else {
|
||||
BRANCH(isInternal, &findProperty, &loopExit);
|
||||
@ -4196,18 +4352,24 @@ GateRef StubBuilder::SetPropertyByName(GateRef glue, GateRef receiver, GateRef k
|
||||
BRANCH(IsAccessor(attr), &isAccessor, ¬Accessor);
|
||||
Bind(&isAccessor);
|
||||
if (defineSemantics) {
|
||||
Jump(&exit);
|
||||
} else {
|
||||
// auto accessor = JSObject::Cast(holder)->GetProperty(hclass, attr)
|
||||
GateRef accessor = JSObjectGetProperty(*holder, hclass, attr);
|
||||
Label shouldCall(env);
|
||||
// ShouldCallSetter(receiver, *holder, accessor, attr)
|
||||
BRANCH(ShouldCallSetter(receiver, *holder, accessor, attr), &shouldCall, ¬Accessor);
|
||||
Bind(&shouldCall);
|
||||
Label isSCheckModelIsCHECK(env);
|
||||
Label isNotSCheckModelIsCHECK(env);
|
||||
BRANCH(SCheckModelIsCHECK, &isSCheckModelIsCHECK, &isNotSCheckModelIsCHECK);
|
||||
Bind(&isSCheckModelIsCHECK);
|
||||
{
|
||||
result = CallSetterHelper(glue, receiver, accessor, value, callback);
|
||||
Jump(&exit);
|
||||
}
|
||||
Bind(&isNotSCheckModelIsCHECK);
|
||||
}
|
||||
// auto accessor = JSObject::Cast(holder)->GetProperty(hclass, attr)
|
||||
GateRef accessor = JSObjectGetProperty(*holder, hclass, attr);
|
||||
Label shouldCall(env);
|
||||
// ShouldCallSetter(receiver, *holder, accessor, attr)
|
||||
BRANCH(ShouldCallSetter(receiver, *holder, accessor, attr), &shouldCall, ¬Accessor);
|
||||
Bind(&shouldCall);
|
||||
{
|
||||
result = CallSetterHelper(glue, receiver, accessor, value, callback);
|
||||
Jump(&exit);
|
||||
}
|
||||
Bind(¬Accessor);
|
||||
{
|
||||
@ -4216,13 +4378,19 @@ GateRef StubBuilder::SetPropertyByName(GateRef glue, GateRef receiver, GateRef k
|
||||
BRANCH(IsWritable(attr), &writable, ¬Writable);
|
||||
Bind(¬Writable);
|
||||
if (defineSemantics) {
|
||||
Jump(&exit);
|
||||
} else {
|
||||
GateRef taggedId = Int32(GET_MESSAGE_STRING_ID(SetReadOnlyProperty));
|
||||
CallRuntime(glue, RTSTUB_ID(ThrowTypeError), { IntToTaggedInt(taggedId) });
|
||||
result = Exception();
|
||||
Jump(&exit);
|
||||
Label isSCheckModelIsCHECK(env);
|
||||
Label isNotSCheckModelIsCHECK(env);
|
||||
BRANCH(SCheckModelIsCHECK, &isSCheckModelIsCHECK, &isNotSCheckModelIsCHECK);
|
||||
Bind(&isSCheckModelIsCHECK);
|
||||
{
|
||||
Jump(&exit);
|
||||
}
|
||||
Bind(&isNotSCheckModelIsCHECK);
|
||||
}
|
||||
GateRef taggedId = Int32(GET_MESSAGE_STRING_ID(SetReadOnlyProperty));
|
||||
CallRuntime(glue, RTSTUB_ID(ThrowTypeError), { IntToTaggedInt(taggedId) });
|
||||
result = Exception();
|
||||
Jump(&exit);
|
||||
Bind(&writable);
|
||||
{
|
||||
Label isTS(env);
|
||||
@ -4266,7 +4434,8 @@ GateRef StubBuilder::SetPropertyByName(GateRef glue, GateRef receiver, GateRef k
|
||||
// JSObject::Cast(holder)->SetProperty(thread, hclass, attr, value)
|
||||
// return JSTaggedValue::Undefined()
|
||||
Label executeSetProp(env);
|
||||
CheckUpdateSharedType(false, &result, glue, receiver, attr, value, &executeSetProp, &exit);
|
||||
CheckUpdateSharedType(false, &result, glue, receiver, attr, value,
|
||||
&executeSetProp, &exit, SCheckModelIsCHECK);
|
||||
Bind(&executeSetProp);
|
||||
JSObjectSetProperty(glue, *holder, hclass, attr, key, value);
|
||||
ProfilerStubBuilder(env).UpdatePropAttrWithValue(
|
||||
@ -4300,17 +4469,23 @@ GateRef StubBuilder::SetPropertyByName(GateRef glue, GateRef receiver, GateRef k
|
||||
BRANCH(IsAccessor(attr1), &isAccessor1, ¬Accessor1);
|
||||
Bind(&isAccessor1);
|
||||
if (defineSemantics) {
|
||||
Jump(&exit);
|
||||
} else {
|
||||
// auto accessor = dict->GetValue(entry)
|
||||
GateRef accessor1 = GetValueFromDictionary<NameDictionary>(array, entry1);
|
||||
Label shouldCall1(env);
|
||||
BRANCH(ShouldCallSetter(receiver, *holder, accessor1, attr1), &shouldCall1, ¬Accessor1);
|
||||
Bind(&shouldCall1);
|
||||
Label isSCheckModelIsCHECK(env);
|
||||
Label isNotSCheckModelIsCHECK(env);
|
||||
BRANCH(SCheckModelIsCHECK, &isSCheckModelIsCHECK, &isNotSCheckModelIsCHECK);
|
||||
Bind(&isSCheckModelIsCHECK);
|
||||
{
|
||||
result = CallSetterHelper(glue, receiver, accessor1, value, callback);
|
||||
Jump(&exit);
|
||||
}
|
||||
Bind(&isNotSCheckModelIsCHECK);
|
||||
}
|
||||
// auto accessor = dict->GetValue(entry)
|
||||
GateRef accessor1 = GetValueFromDictionary<NameDictionary>(array, entry1);
|
||||
Label shouldCall1(env);
|
||||
BRANCH(ShouldCallSetter(receiver, *holder, accessor1, attr1), &shouldCall1, ¬Accessor1);
|
||||
Bind(&shouldCall1);
|
||||
{
|
||||
result = CallSetterHelper(glue, receiver, accessor1, value, callback);
|
||||
Jump(&exit);
|
||||
}
|
||||
Bind(¬Accessor1);
|
||||
{
|
||||
@ -4319,17 +4494,23 @@ GateRef StubBuilder::SetPropertyByName(GateRef glue, GateRef receiver, GateRef k
|
||||
BRANCH(IsWritable(attr1), &writable1, ¬Writable1);
|
||||
Bind(¬Writable1);
|
||||
if (defineSemantics) {
|
||||
Jump(&exit);
|
||||
} else {
|
||||
GateRef taggedId = Int32(GET_MESSAGE_STRING_ID(SetReadOnlyProperty));
|
||||
CallRuntime(glue, RTSTUB_ID(ThrowTypeError), { IntToTaggedInt(taggedId) });
|
||||
result = Exception();
|
||||
Jump(&exit);
|
||||
Label isSCheckModelIsCHECK(env);
|
||||
Label isNotSCheckModelIsCHECK(env);
|
||||
BRANCH(SCheckModelIsCHECK, &isSCheckModelIsCHECK, &isNotSCheckModelIsCHECK);
|
||||
Bind(&isSCheckModelIsCHECK);
|
||||
{
|
||||
Jump(&exit);
|
||||
}
|
||||
Bind(&isNotSCheckModelIsCHECK);
|
||||
}
|
||||
GateRef taggedId = Int32(GET_MESSAGE_STRING_ID(SetReadOnlyProperty));
|
||||
CallRuntime(glue, RTSTUB_ID(ThrowTypeError), { IntToTaggedInt(taggedId) });
|
||||
result = Exception();
|
||||
Jump(&exit);
|
||||
Bind(&writable1);
|
||||
{
|
||||
Label holdEqualsRecv1(env);
|
||||
if (useOwn) {
|
||||
if (useOwn || defineSemantics) {
|
||||
BRANCH(Equal(*holder, receiver), &holdEqualsRecv1, &ifEnd);
|
||||
} else {
|
||||
BRANCH(Equal(*holder, receiver), &holdEqualsRecv1, &afterLoop);
|
||||
@ -4339,7 +4520,8 @@ GateRef StubBuilder::SetPropertyByName(GateRef glue, GateRef receiver, GateRef k
|
||||
// dict->UpdateValue(thread, entry, value)
|
||||
// return JSTaggedValue::Undefined()
|
||||
Label executeSetProp(env);
|
||||
CheckUpdateSharedType(true, &result, glue, receiver, attr1, value, &executeSetProp, &exit);
|
||||
CheckUpdateSharedType(true, &result, glue, receiver, attr1,
|
||||
value, &executeSetProp, &exit, SCheckModelIsCHECK);
|
||||
Bind(&executeSetProp);
|
||||
UpdateValueInDict<NameDictionary>(glue, array, entry1, value);
|
||||
result = Undefined();
|
||||
@ -4404,6 +4586,12 @@ GateRef StubBuilder::SetPropertyByName(GateRef glue, GateRef receiver, GateRef k
|
||||
|
||||
GateRef StubBuilder::SetPropertyByValue(GateRef glue, GateRef receiver, GateRef key, GateRef value, bool useOwn,
|
||||
ProfileOperation callback, bool defineSemantics)
|
||||
{
|
||||
return SetPropertyByValue(glue, receiver, key, value, True(), useOwn, callback, defineSemantics);
|
||||
}
|
||||
|
||||
GateRef StubBuilder::SetPropertyByValue(GateRef glue, GateRef receiver, GateRef key, GateRef value,
|
||||
GateRef SCheckModelIsCHECK, bool useOwn, ProfileOperation callback, bool defineSemantics)
|
||||
{
|
||||
auto env = GetEnvironment();
|
||||
Label subEntry1(env);
|
||||
@ -4490,8 +4678,8 @@ GateRef StubBuilder::SetPropertyByValue(GateRef glue, GateRef receiver, GateRef
|
||||
CheckDetectorName(glue, *varKey, &setByName, &exit);
|
||||
Bind(&setByName);
|
||||
{
|
||||
result = SetPropertyByName(glue, receiver, *varKey, value, useOwn, *isInternal, callback,
|
||||
true, defineSemantics);
|
||||
result = SetPropertyByName(glue, receiver, *varKey, value, useOwn, *isInternal,
|
||||
SCheckModelIsCHECK, callback, true, defineSemantics);
|
||||
Jump(&exit);
|
||||
}
|
||||
}
|
||||
|
@ -369,6 +369,11 @@ ShortcutBoolOr([&]{ return first; }, [&]{ return second; })
|
||||
// object operation
|
||||
GateRef IsJSHClass(GateRef obj);
|
||||
GateRef LoadHClass(GateRef object);
|
||||
void CanNotConvertNotValidObject(GateRef obj);
|
||||
void IsNotPropertyKey(GateRef obj);
|
||||
GateRef CreateDataProperty(GateRef glue, GateRef obj, GateRef proKey, GateRef value);
|
||||
GateRef CreateDataPropertyOrThrow(GateRef glue, GateRef onj, GateRef proKey, GateRef value);
|
||||
GateRef DefineField(GateRef glue, GateRef obj, GateRef proKey, GateRef value);
|
||||
void StoreHClass(GateRef glue, GateRef object, GateRef hClass);
|
||||
void StoreHClassWithoutBarrier(GateRef glue, GateRef object, GateRef hClass);
|
||||
void StoreBuiltinHClass(GateRef glue, GateRef object, GateRef hClass);
|
||||
@ -547,7 +552,7 @@ ShortcutBoolOr([&]{ return first; }, [&]{ return second; })
|
||||
GateRef GetUnsharedConstpool(GateRef array, GateRef index);
|
||||
GateRef GetValueFromMutantTaggedArray(GateRef elements, GateRef index);
|
||||
void CheckUpdateSharedType(bool isDicMode, Variable *result, GateRef glue, GateRef receiver, GateRef attr,
|
||||
GateRef value, Label *executeSetProp, Label *exit);
|
||||
GateRef value, Label *executeSetProp, Label *exit, GateRef SCheckModelIsCHECK);
|
||||
void MatchFieldType(Variable *result, GateRef glue, GateRef fieldType, GateRef value, Label *executeSetProp,
|
||||
Label *exit);
|
||||
GateRef GetFieldTypeFromHandler(GateRef attr);
|
||||
@ -718,8 +723,14 @@ ShortcutBoolOr([&]{ return first; }, [&]{ return second; })
|
||||
GateRef SetPropertyByName(GateRef glue, GateRef receiver, GateRef key,
|
||||
GateRef value, bool useOwn, GateRef isInternal, ProfileOperation callback = ProfileOperation(),
|
||||
bool canUseIsInternal = false, bool defineSemantics = false); // Crawl prototype chain
|
||||
GateRef SetPropertyByName(GateRef glue, GateRef receiver, GateRef key,
|
||||
GateRef value, bool useOwn, GateRef isInternal, GateRef SCheckModelIsCHECK,
|
||||
ProfileOperation callback = ProfileOperation(), bool canUseIsInternal = false, bool defineSemantics = false);
|
||||
GateRef SetPropertyByValue(GateRef glue, GateRef receiver, GateRef key, GateRef value, bool useOwn,
|
||||
ProfileOperation callback = ProfileOperation(), bool defineSemantics = false);
|
||||
GateRef SetPropertyByValue(GateRef glue, GateRef receiver, GateRef key, GateRef value,
|
||||
GateRef SCheckModelIsCHECK, bool useOwn, ProfileOperation callback = ProfileOperation(),
|
||||
bool defineSemantics = false);
|
||||
GateRef GetParentEnv(GateRef object);
|
||||
GateRef GetSendableParentEnv(GateRef object);
|
||||
GateRef GetPropertiesFromLexicalEnv(GateRef object, GateRef index);
|
||||
|
@ -64,7 +64,10 @@ namespace panda::ecmascript {
|
||||
V(InvalidRadixLength, "radix must be 2 to 36") \
|
||||
V(SetPrototypeOfFailed, "SetPrototypeOf: prototype set failed") \
|
||||
V(ReviverOnlySupportUndefined, "reviver only supports undefined for SENDABLE_JSON") \
|
||||
V(ReturnTypeNotSupportMap, "parseReturnType is not support MAP")
|
||||
V(ReturnTypeNotSupportMap, "parseReturnType is not support MAP") \
|
||||
V(DefineFieldField, "DefineField: obj is not Object") \
|
||||
V(IsNotPropertyKey, "key is not a property key") \
|
||||
V(CreateDataPropertyFailed, "failed to create data property")
|
||||
|
||||
#define DEBUG_CHECK_MESSAGE_STRING_LIST(V) \
|
||||
V(IsCallable) \
|
||||
|
@ -213,6 +213,17 @@ DEF_RUNTIME_STUBS(AllocateInSNonMovable)
|
||||
return JSTaggedValue(result).GetRawData();
|
||||
}
|
||||
|
||||
DEF_RUNTIME_STUBS(DefineOwnProperty)
|
||||
{
|
||||
RUNTIME_STUBS_HEADER(DefineOwnProperty);
|
||||
JSHandle<JSTaggedValue> obj = GetHArg<JSTaggedValue>(argv, argc, 0);
|
||||
JSHandle<JSTaggedValue> key = GetHArg<JSTaggedValue>(argv, argc, 1); // 1: means the first parameter
|
||||
JSHandle<JSTaggedValue> value = GetHArg<JSTaggedValue>(argv, argc, 2); // 2: means the second parameter
|
||||
PropertyDescriptor desc(thread, value, true, true, true);
|
||||
bool res = JSTaggedValue::DefineOwnProperty(thread, obj, key, desc);
|
||||
return JSTaggedValue(res).GetRawData();
|
||||
}
|
||||
|
||||
DEF_RUNTIME_STUBS(AllocateInSOld)
|
||||
{
|
||||
RUNTIME_STUBS_HEADER(AllocateInSOld);
|
||||
|
@ -481,6 +481,7 @@ using FastCallAotEntryType = JSTaggedValue (*)(uintptr_t glue, uint32_t argc, co
|
||||
V(ThrowRangeError) \
|
||||
V(InitializeGeneratorFunction) \
|
||||
V(FunctionDefineOwnProperty) \
|
||||
V(DefineOwnProperty) \
|
||||
V(AOTEnableProtoChangeMarker) \
|
||||
V(HasProperty) \
|
||||
V(DumpObject) \
|
||||
|
Loading…
x
Reference in New Issue
Block a user