mirror of
https://gitee.com/openharmony/arkcompiler_ets_runtime
synced 2024-11-23 01:59:58 +00:00
Support BigInt in Sendable object
Issue: https://gitee.com/openharmony/arkcompiler_ets_runtime/issues/I98ZHH Signed-off-by: Gymee <yumeijie@huawei.com> Change-Id: Ief90140eaf019ff85eb657964b0e8a0e37d5ee68
This commit is contained in:
parent
fcf45afbee
commit
1a26c88329
@ -441,7 +441,7 @@ void BuiltinsObjectStubBuilder::LayoutInfoAssignAllEnumProperty(Variable *result
|
||||
Bind(&next);
|
||||
|
||||
GateRef key = GetKeyFromLayoutInfo(layout, *idx);
|
||||
GateRef attr = TruncInt64ToInt32(GetPropAttrFromLayoutInfo(layout, *idx));
|
||||
GateRef attr = GetPropAttrFromLayoutInfo(layout, *idx);
|
||||
Label stringKey(env);
|
||||
Branch(TaggedIsString(key), &stringKey, &loopEnd);
|
||||
Bind(&stringKey);
|
||||
|
@ -407,7 +407,7 @@ GateRef ProfilerStubBuilder::UpdateTrackTypeInPropAttr(GateRef attr, GateRef val
|
||||
|
||||
GateRef oldTrackType = GetTrackTypeInPropAttr(attr);
|
||||
DEFVARIABLE(newTrackType, VariableType::INT32(), Int32(static_cast<int32_t>(TrackType::TAGGED)));
|
||||
DEFVARIABLE(result, VariableType::INT32(), attr);
|
||||
DEFVARIABLE(result, VariableType::INT64(), attr);
|
||||
|
||||
Label exit(env);
|
||||
Label judgeValue(env);
|
||||
@ -451,8 +451,7 @@ void ProfilerStubBuilder::UpdatePropAttrIC(
|
||||
GateRef attrIndex = HandlerBaseGetAttrIndex(handler);
|
||||
GateRef hclass = LoadHClass(receiver);
|
||||
GateRef layout = GetLayoutFromHClass(hclass);
|
||||
GateRef propAttr = GetPropAttrFromLayoutInfo(layout, attrIndex);
|
||||
GateRef attr = GetInt32OfTInt(propAttr);
|
||||
GateRef attr = GetPropAttrFromLayoutInfo(layout, attrIndex);
|
||||
GateRef newAttr = UpdateTrackTypeInPropAttr(attr, value, callback);
|
||||
Branch(IsJSShared(receiver), &exit, &handleUnShared);
|
||||
Bind(&handleUnShared);
|
||||
|
@ -1390,7 +1390,7 @@ inline GateRef StubBuilder::IsWritable(GateRef attr)
|
||||
{
|
||||
return Int32NotEqual(
|
||||
Int32And(
|
||||
Int32LSR(attr, Int32(PropertyAttributes::WritableField::START_BIT)),
|
||||
TruncInt64ToInt32(Int64LSR(attr, Int64(PropertyAttributes::WritableField::START_BIT))),
|
||||
Int32((1LLU << PropertyAttributes::WritableField::SIZE) - 1)),
|
||||
Int32(0));
|
||||
}
|
||||
@ -1399,7 +1399,7 @@ inline GateRef StubBuilder::IsDefaultAttribute(GateRef attr)
|
||||
{
|
||||
return Int32NotEqual(
|
||||
Int32And(
|
||||
Int32LSR(attr, Int32(PropertyAttributes::DefaultAttributesField::START_BIT)),
|
||||
TruncInt64ToInt32(Int64LSR(attr, Int64(PropertyAttributes::DefaultAttributesField::START_BIT))),
|
||||
Int32((1LLU << PropertyAttributes::DefaultAttributesField::SIZE) - 1)),
|
||||
Int32(0));
|
||||
}
|
||||
@ -1408,7 +1408,7 @@ inline GateRef StubBuilder::IsConfigable(GateRef attr)
|
||||
{
|
||||
return Int32NotEqual(
|
||||
Int32And(
|
||||
Int32LSR(attr, Int32(PropertyAttributes::ConfigurableField::START_BIT)),
|
||||
TruncInt64ToInt32(Int64LSR(attr, Int64(PropertyAttributes::ConfigurableField::START_BIT))),
|
||||
Int32((1LLU << PropertyAttributes::ConfigurableField::SIZE) - 1)),
|
||||
Int32(0));
|
||||
}
|
||||
@ -1416,8 +1416,8 @@ inline GateRef StubBuilder::IsConfigable(GateRef attr)
|
||||
inline GateRef StubBuilder::IsAccessor(GateRef attr)
|
||||
{
|
||||
return Int32NotEqual(
|
||||
Int32And(Int32LSR(attr,
|
||||
Int32(PropertyAttributes::IsAccessorField::START_BIT)),
|
||||
Int32And(
|
||||
TruncInt64ToInt32(Int64LSR(attr, Int64(PropertyAttributes::IsAccessorField::START_BIT))),
|
||||
Int32((1LLU << PropertyAttributes::IsAccessorField::SIZE) - 1)),
|
||||
Int32(0));
|
||||
}
|
||||
@ -1425,8 +1425,8 @@ inline GateRef StubBuilder::IsAccessor(GateRef attr)
|
||||
inline GateRef StubBuilder::IsEnumerable(GateRef attr)
|
||||
{
|
||||
return Int32NotEqual(
|
||||
Int32And(Int32LSR(attr,
|
||||
Int32(PropertyAttributes::EnumerableField::START_BIT)),
|
||||
Int32And(
|
||||
TruncInt64ToInt32(Int64LSR(attr, Int64(PropertyAttributes::EnumerableField::START_BIT))),
|
||||
Int32((1LLU << PropertyAttributes::EnumerableField::SIZE) - 1)),
|
||||
Int32(0));
|
||||
}
|
||||
@ -1434,8 +1434,8 @@ inline GateRef StubBuilder::IsEnumerable(GateRef attr)
|
||||
inline GateRef StubBuilder::IsInlinedProperty(GateRef attr)
|
||||
{
|
||||
return Int32NotEqual(
|
||||
Int32And(Int32LSR(attr,
|
||||
Int32(PropertyAttributes::IsInlinedPropsField::START_BIT)),
|
||||
Int32And(
|
||||
TruncInt64ToInt32(Int64LSR(attr, Int64(PropertyAttributes::IsInlinedPropsField::START_BIT))),
|
||||
Int32((1LLU << PropertyAttributes::IsInlinedPropsField::SIZE) - 1)),
|
||||
Int32(0));
|
||||
}
|
||||
@ -1755,18 +1755,18 @@ inline GateRef StubBuilder::GetTransWithProtoHandlerInfo(GateRef obj)
|
||||
inline GateRef StubBuilder::PropAttrGetOffset(GateRef attr)
|
||||
{
|
||||
return Int32And(
|
||||
Int32LSR(attr, Int32(PropertyAttributes::OffsetField::START_BIT)),
|
||||
TruncInt64ToInt32(Int64LSR(attr, Int64(PropertyAttributes::OffsetField::START_BIT))),
|
||||
Int32((1LLU << PropertyAttributes::OffsetField::SIZE) - 1));
|
||||
}
|
||||
|
||||
// SetDictionaryOrder func in property_attribute.h
|
||||
inline GateRef StubBuilder::SetDictionaryOrderFieldInPropAttr(GateRef attr, GateRef value)
|
||||
{
|
||||
GateRef mask = Int32LSL(
|
||||
Int32((1LLU << PropertyAttributes::DictionaryOrderField::SIZE) - 1),
|
||||
Int32(PropertyAttributes::DictionaryOrderField::START_BIT));
|
||||
GateRef newVal = Int32Or(Int32And(attr, Int32Not(mask)),
|
||||
Int32LSL(value, Int32(PropertyAttributes::DictionaryOrderField::START_BIT)));
|
||||
GateRef mask = Int64LSL(
|
||||
Int64((1LLU << PropertyAttributes::DictionaryOrderField::SIZE) - 1),
|
||||
Int64(PropertyAttributes::DictionaryOrderField::START_BIT));
|
||||
GateRef newVal = Int64Or(Int64And(attr, Int64Not(mask)),
|
||||
Int64LSL(value, Int64(PropertyAttributes::DictionaryOrderField::START_BIT)));
|
||||
return newVal;
|
||||
}
|
||||
|
||||
@ -2094,8 +2094,8 @@ inline void StubBuilder::CheckUpdateSharedType(bool isDicMode, Variable *result,
|
||||
Bind(&isSharedObj);
|
||||
{
|
||||
Label typeMismatch(env);
|
||||
GateRef trackType = isDicMode ? GetDictTrackTypeInPropAttr(attr) : GetTrackTypeInPropAttr(attr);
|
||||
MatchTrackType(trackType, value, executeSetProp, &typeMismatch);
|
||||
GateRef fieldType = isDicMode ? GetDictSharedFieldTypeInPropAttr(attr) : GetSharedFieldTypeInPropAttr(attr);
|
||||
MatchFieldType(fieldType, value, executeSetProp, &typeMismatch);
|
||||
Bind(&typeMismatch);
|
||||
{
|
||||
GateRef taggedId = Int32(GET_MESSAGE_STRING_ID(SetTypeMismatchedSharedProperty));
|
||||
@ -2106,12 +2106,12 @@ inline void StubBuilder::CheckUpdateSharedType(bool isDicMode, Variable *result,
|
||||
}
|
||||
}
|
||||
|
||||
inline void StubBuilder::MatchTrackType(Variable *result, GateRef glue, GateRef trackType, GateRef value,
|
||||
inline void StubBuilder::MatchFieldType(Variable *result, GateRef glue, GateRef fieldType, GateRef value,
|
||||
Label *executeSetProp, Label *exit)
|
||||
{
|
||||
auto *env = GetEnvironment();
|
||||
Label typeMismatch(env);
|
||||
MatchTrackType(trackType, value, executeSetProp, &typeMismatch);
|
||||
MatchFieldType(fieldType, value, executeSetProp, &typeMismatch);
|
||||
Bind(&typeMismatch);
|
||||
{
|
||||
GateRef taggedId = Int32(GET_MESSAGE_STRING_ID(SetTypeMismatchedSharedProperty));
|
||||
@ -2121,11 +2121,11 @@ inline void StubBuilder::MatchTrackType(Variable *result, GateRef glue, GateRef
|
||||
}
|
||||
}
|
||||
|
||||
inline GateRef StubBuilder::GetTrackTypeFromHandler(GateRef attr)
|
||||
inline GateRef StubBuilder::GetFieldTypeFromHandler(GateRef attr)
|
||||
{
|
||||
return Int32And(Int32LSR(attr,
|
||||
Int32(HandlerBase::STrackTypeBit::START_BIT)),
|
||||
Int32((1LLU << HandlerBase::STrackTypeBit::SIZE) - 1));
|
||||
Int32(HandlerBase::SFieldTypeBit::START_BIT)),
|
||||
Int32((1LLU << HandlerBase::SFieldTypeBit::SIZE) - 1));
|
||||
}
|
||||
|
||||
inline GateRef StubBuilder::ClearSharedStoreKind(GateRef handlerInfo)
|
||||
@ -2180,13 +2180,14 @@ inline void StubBuilder::SetPropAttrToLayoutInfo(GateRef glue, GateRef layout, G
|
||||
{
|
||||
GateRef index = Int32Add(Int32LSL(entry, Int32(LayoutInfo::ELEMENTS_INDEX_LOG2)),
|
||||
Int32(LayoutInfo::ATTR_INDEX_OFFSET));
|
||||
GateRef taggedAttr = Int64ToTaggedInt(ZExtInt32ToInt64(attr));
|
||||
GateRef taggedAttr = Int64ToTaggedInt(attr);
|
||||
SetValueToTaggedArray(VariableType::JS_ANY(), glue, layout, index, taggedAttr);
|
||||
}
|
||||
|
||||
inline GateRef StubBuilder::GetPropertyMetaDataFromAttr(GateRef attr)
|
||||
{
|
||||
return Int32And(Int32LSR(attr, Int32(PropertyAttributes::PropertyMetaDataField::START_BIT)),
|
||||
return Int32And(
|
||||
TruncInt64ToInt32(Int64LSR(attr, Int64(PropertyAttributes::PropertyMetaDataField::START_BIT))),
|
||||
Int32((1LLU << PropertyAttributes::PropertyMetaDataField::SIZE) - 1));
|
||||
}
|
||||
|
||||
@ -2429,61 +2430,68 @@ inline GateRef StubBuilder::IsCallable(GateRef obj)
|
||||
inline GateRef StubBuilder::GetOffsetFieldInPropAttr(GateRef attr)
|
||||
{
|
||||
return Int32And(
|
||||
Int32LSR(attr, Int32(PropertyAttributes::OffsetField::START_BIT)),
|
||||
TruncInt64ToInt32(Int64LSR(attr, Int64(PropertyAttributes::OffsetField::START_BIT))),
|
||||
Int32((1LLU << PropertyAttributes::OffsetField::SIZE) - 1));
|
||||
}
|
||||
|
||||
// SetOffset func in property_attribute.h
|
||||
inline GateRef StubBuilder::SetOffsetFieldInPropAttr(GateRef attr, GateRef value)
|
||||
{
|
||||
GateRef mask = Int32LSL(
|
||||
Int32((1LLU << PropertyAttributes::OffsetField::SIZE) - 1),
|
||||
Int32(PropertyAttributes::OffsetField::START_BIT));
|
||||
GateRef newVal = Int32Or(Int32And(attr, Int32Not(mask)),
|
||||
Int32LSL(value, Int32(PropertyAttributes::OffsetField::START_BIT)));
|
||||
GateRef mask = Int64LSL(
|
||||
Int64((1LLU << PropertyAttributes::OffsetField::SIZE) - 1),
|
||||
Int64(PropertyAttributes::OffsetField::START_BIT));
|
||||
GateRef newVal = Int64Or(Int64And(attr, Int64Not(mask)),
|
||||
Int64LSL(ZExtInt32ToInt64(value), Int64(PropertyAttributes::OffsetField::START_BIT)));
|
||||
return newVal;
|
||||
}
|
||||
|
||||
// SetIsInlinedProps func in property_attribute.h
|
||||
inline GateRef StubBuilder::SetIsInlinePropsFieldInPropAttr(GateRef attr, GateRef value)
|
||||
{
|
||||
GateRef mask = Int32LSL(
|
||||
Int32((1LU << PropertyAttributes::IsInlinedPropsField::SIZE) - 1),
|
||||
Int32(PropertyAttributes::IsInlinedPropsField::START_BIT));
|
||||
GateRef newVal = Int32Or(Int32And(attr, Int32Not(mask)),
|
||||
Int32LSL(value, Int32(PropertyAttributes::IsInlinedPropsField::START_BIT)));
|
||||
GateRef mask = Int64LSL(
|
||||
Int64((1LU << PropertyAttributes::IsInlinedPropsField::SIZE) - 1),
|
||||
Int64(PropertyAttributes::IsInlinedPropsField::START_BIT));
|
||||
GateRef newVal = Int64Or(Int64And(attr, Int64Not(mask)),
|
||||
Int64LSL(ZExtInt32ToInt64(value), Int64(PropertyAttributes::IsInlinedPropsField::START_BIT)));
|
||||
return newVal;
|
||||
}
|
||||
|
||||
|
||||
inline GateRef StubBuilder::SetTrackTypeInPropAttr(GateRef attr, GateRef type)
|
||||
{
|
||||
GateRef mask = Int32LSL(
|
||||
Int32((1LU << PropertyAttributes::TrackTypeField::SIZE) - 1),
|
||||
Int32(PropertyAttributes::TrackTypeField::START_BIT));
|
||||
GateRef newVal = Int32Or(Int32And(attr, Int32Not(mask)),
|
||||
Int32LSL(type, Int32(PropertyAttributes::TrackTypeField::START_BIT)));
|
||||
GateRef mask = Int64LSL(
|
||||
Int64((1LU << PropertyAttributes::TrackTypeField::SIZE) - 1),
|
||||
Int64(PropertyAttributes::TrackTypeField::START_BIT));
|
||||
GateRef newVal = Int64Or(Int64And(attr, Int64Not(mask)),
|
||||
Int64LSL(ZExtInt32ToInt64(type), Int64(PropertyAttributes::TrackTypeField::START_BIT)));
|
||||
return newVal;
|
||||
}
|
||||
|
||||
inline GateRef StubBuilder::GetSharedFieldTypeInPropAttr(GateRef attr)
|
||||
{
|
||||
return Int32And(
|
||||
TruncInt64ToInt32(Int64LSR(attr, Int64(PropertyAttributes::SharedFieldTypeField::START_BIT))),
|
||||
Int32((1LLU << PropertyAttributes::SharedFieldTypeField::SIZE) - 1));
|
||||
}
|
||||
|
||||
inline GateRef StubBuilder::GetTrackTypeInPropAttr(GateRef attr)
|
||||
{
|
||||
return Int32And(
|
||||
Int32LSR(attr, Int32(PropertyAttributes::TrackTypeField::START_BIT)),
|
||||
TruncInt64ToInt32(Int64LSR(attr, Int64(PropertyAttributes::TrackTypeField::START_BIT))),
|
||||
Int32((1LLU << PropertyAttributes::TrackTypeField::SIZE) - 1));
|
||||
}
|
||||
|
||||
inline GateRef StubBuilder::GetDictTrackTypeInPropAttr(GateRef attr)
|
||||
inline GateRef StubBuilder::GetDictSharedFieldTypeInPropAttr(GateRef attr)
|
||||
{
|
||||
return Int32And(
|
||||
Int32LSR(attr, Int32(PropertyAttributes::DictTrackTypeField::START_BIT)),
|
||||
Int32((1LLU << PropertyAttributes::DictTrackTypeField::SIZE) - 1));
|
||||
TruncInt64ToInt32(Int64LSR(attr, Int64(PropertyAttributes::DictSharedFieldTypeField::START_BIT))),
|
||||
Int32((1LLU << PropertyAttributes::DictSharedFieldTypeField::SIZE) - 1));
|
||||
}
|
||||
|
||||
inline GateRef StubBuilder::GetRepInPropAttr(GateRef attr)
|
||||
{
|
||||
return Int32And(
|
||||
Int32LSR(attr, Int32(PropertyAttributes::RepresentationField::START_BIT)),
|
||||
TruncInt64ToInt32(Int64LSR(attr, Int64(PropertyAttributes::RepresentationField::START_BIT))),
|
||||
Int32((1LLU << PropertyAttributes::RepresentationField::SIZE) - 1));
|
||||
}
|
||||
|
||||
@ -2499,12 +2507,12 @@ inline GateRef StubBuilder::IsDoubleRepInPropAttr(GateRef rep)
|
||||
|
||||
inline GateRef StubBuilder::SetTaggedRepInPropAttr(GateRef attr)
|
||||
{
|
||||
GateRef mask = Int32LSL(
|
||||
Int32((1LU << PropertyAttributes::RepresentationField::SIZE) - 1),
|
||||
Int32(PropertyAttributes::RepresentationField::START_BIT));
|
||||
GateRef targetType = Int32(static_cast<int32_t>(Representation::TAGGED));
|
||||
GateRef newVal = Int32Or(Int32And(attr, Int32Not(mask)),
|
||||
Int32LSL(targetType, Int32(PropertyAttributes::RepresentationField::START_BIT)));
|
||||
GateRef mask = Int64LSL(
|
||||
Int64((1LU << PropertyAttributes::RepresentationField::SIZE) - 1),
|
||||
Int64(PropertyAttributes::RepresentationField::START_BIT));
|
||||
GateRef targetType = Int32(static_cast<uint32_t>(Representation::TAGGED));
|
||||
GateRef newVal = Int64Or(Int64And(attr, Int64Not(mask)),
|
||||
Int64LSL(ZExtInt32ToInt64(targetType), Int64(PropertyAttributes::RepresentationField::START_BIT)));
|
||||
return newVal;
|
||||
}
|
||||
|
||||
@ -3144,7 +3152,7 @@ inline GateRef StubBuilder::GetKeyIndex(GateRef index)
|
||||
inline GateRef StubBuilder::GetAttr(GateRef layoutInfo, GateRef index)
|
||||
{
|
||||
GateRef fixedIdx = GetAttrIndex(index);
|
||||
return GetInt32OfTInt(GetValueFromTaggedArray(layoutInfo, fixedIdx));
|
||||
return GetInt64OfTInt(GetValueFromTaggedArray(layoutInfo, fixedIdx));
|
||||
}
|
||||
|
||||
inline GateRef StubBuilder::GetKey(GateRef layoutInfo, GateRef index)
|
||||
|
@ -114,7 +114,7 @@ void StubBuilder::LoopEnd(Label *loopHead)
|
||||
env_->SetCurrentLabel(nullptr);
|
||||
}
|
||||
|
||||
void StubBuilder::MatchTrackType(GateRef trackType, GateRef value, Label *executeSetProp, Label *typeMismatch)
|
||||
void StubBuilder::MatchFieldType(GateRef fieldType, GateRef value, Label *executeSetProp, Label *typeMismatch)
|
||||
{
|
||||
auto *env = GetEnvironment();
|
||||
Label isNumber(env);
|
||||
@ -124,11 +124,13 @@ void StubBuilder::MatchTrackType(GateRef trackType, GateRef value, Label *execut
|
||||
Label isString(env);
|
||||
Label checkJSShared(env);
|
||||
Label isJSShared(env);
|
||||
Label checkBigInt(env);
|
||||
Label isBigInt(env);
|
||||
Label checkJSNone(env);
|
||||
Label isJSNone(env);
|
||||
Label exit(env);
|
||||
DEFVARIABLE(result, VariableType::BOOL(), False());
|
||||
Branch(Equal(trackType, Int32(static_cast<int32_t>(TrackType::NUMBER))), &isNumber, &checkBoolean);
|
||||
Branch(Equal(fieldType, Int32(static_cast<int32_t>(SharedFieldType::NUMBER))), &isNumber, &checkBoolean);
|
||||
Bind(&isNumber);
|
||||
{
|
||||
result = TaggedIsNumber(value);
|
||||
@ -136,7 +138,7 @@ void StubBuilder::MatchTrackType(GateRef trackType, GateRef value, Label *execut
|
||||
}
|
||||
Bind(&checkBoolean);
|
||||
{
|
||||
Branch(Equal(trackType, Int32(static_cast<int32_t>(TrackType::BOOLEAN))), &isBoolean, &checkString);
|
||||
Branch(Equal(fieldType, Int32(static_cast<int32_t>(SharedFieldType::BOOLEAN))), &isBoolean, &checkString);
|
||||
Bind(&isBoolean);
|
||||
{
|
||||
result = TaggedIsBoolean(value);
|
||||
@ -145,7 +147,7 @@ void StubBuilder::MatchTrackType(GateRef trackType, GateRef value, Label *execut
|
||||
}
|
||||
Bind(&checkString);
|
||||
{
|
||||
Branch(Equal(trackType, Int32(static_cast<int32_t>(TrackType::STRING))), &isString, &checkJSShared);
|
||||
Branch(Equal(fieldType, Int32(static_cast<int32_t>(SharedFieldType::STRING))), &isString, &checkJSShared);
|
||||
Bind(&isString);
|
||||
{
|
||||
result = BoolOr(TaggedIsString(value), TaggedIsNull(value));
|
||||
@ -154,16 +156,25 @@ void StubBuilder::MatchTrackType(GateRef trackType, GateRef value, Label *execut
|
||||
}
|
||||
Bind(&checkJSShared);
|
||||
{
|
||||
Branch(Equal(trackType, Int32(static_cast<int32_t>(TrackType::SENDABLE))), &isJSShared, &checkJSNone);
|
||||
Branch(Equal(fieldType, Int32(static_cast<int32_t>(SharedFieldType::SENDABLE))), &isJSShared, &checkBigInt);
|
||||
Bind(&isJSShared);
|
||||
{
|
||||
result = BoolOr(TaggedIsShared(value), TaggedIsNull(value));
|
||||
Jump(&exit);
|
||||
}
|
||||
}
|
||||
Bind(&checkBigInt);
|
||||
{
|
||||
Branch(Equal(fieldType, Int32(static_cast<int32_t>(SharedFieldType::BIG_INT))), &isBigInt, &checkJSNone);
|
||||
Bind(&isBigInt);
|
||||
{
|
||||
result = TaggedIsBigInt(value);
|
||||
Jump(&exit);
|
||||
}
|
||||
}
|
||||
Bind(&checkJSNone);
|
||||
{
|
||||
Branch(Equal(trackType, Int32(static_cast<int32_t>(TrackType::NONE))), &isJSNone, &exit);
|
||||
Branch(Equal(fieldType, Int32(static_cast<int32_t>(SharedFieldType::NONE))), &isJSNone, &exit);
|
||||
Bind(&isJSNone);
|
||||
{
|
||||
// bypass none type
|
||||
@ -399,7 +410,6 @@ GateRef StubBuilder::IsMatchInTransitionDictionary(GateRef element, GateRef key,
|
||||
return BoolAnd(Equal(element, key), Int32Equal(metaData, attr));
|
||||
}
|
||||
|
||||
// metaData is int32 type
|
||||
GateRef StubBuilder::FindEntryFromTransitionDictionary(GateRef glue, GateRef elements, GateRef key, GateRef metaData)
|
||||
{
|
||||
auto env = GetEnvironment();
|
||||
@ -477,7 +487,8 @@ GateRef StubBuilder::FindEntryFromTransitionDictionary(GateRef glue, GateRef ele
|
||||
Label notMatch(env);
|
||||
Branch(
|
||||
IsMatchInTransitionDictionary(element, key, metaData,
|
||||
GetAttributesFromDictionary<TransitionsDictionary>(elements, *entry)),
|
||||
// metaData is int32 type
|
||||
TruncInt64ToInt32(GetAttributesFromDictionary<TransitionsDictionary>(elements, *entry))),
|
||||
&isMatch, ¬Match);
|
||||
{
|
||||
Bind(&isMatch);
|
||||
@ -837,7 +848,7 @@ void StubBuilder::JSHClassAddProperty(GateRef glue, GateRef receiver, GateRef ke
|
||||
IntToTaggedInt(inlineProps) });
|
||||
CopyAllHClass(glue, newJshclass, hclass);
|
||||
CallRuntime(glue, RTSTUB_ID(UpdateLayOutAndAddTransition),
|
||||
{ hclass, newJshclass, key, IntToTaggedInt(attr) });
|
||||
{ hclass, newJshclass, key, Int64ToTaggedInt(attr) });
|
||||
#if ECMASCRIPT_ENABLE_IC
|
||||
NotifyHClassChanged(glue, hclass, newJshclass);
|
||||
#endif
|
||||
@ -889,7 +900,7 @@ GateRef StubBuilder::AddPropertyByName(GateRef glue, GateRef receiver, GateRef k
|
||||
}
|
||||
Bind(&afterCtorCon);
|
||||
// 0x111 : default attribute for property: writable, enumerable, configurable
|
||||
DEFVARIABLE(attr, VariableType::INT32(), propertyAttributes);
|
||||
DEFVARIABLE(attr, VariableType::INT64(), propertyAttributes);
|
||||
GateRef numberOfProps = GetNumberOfPropsFromHClass(hclass);
|
||||
GateRef inlinedProperties = GetInlinedPropertiesFromHClass(hclass);
|
||||
Label hasUnusedInProps(env);
|
||||
@ -909,7 +920,7 @@ GateRef StubBuilder::AddPropertyByName(GateRef glue, GateRef receiver, GateRef k
|
||||
GateRef newHclass = LoadHClass(receiver);
|
||||
GateRef newLayoutInfo = GetLayoutFromHClass(newHclass);
|
||||
GateRef offset = GetInlinedPropOffsetFromHClass(hclass, numberOfProps);
|
||||
attr = GetInt32OfTInt(GetPropAttrFromLayoutInfo(newLayoutInfo, numberOfProps));
|
||||
attr = GetPropAttrFromLayoutInfo(newLayoutInfo, numberOfProps);
|
||||
SetValueWithAttr(glue, receiver, offset, key, value, *attr);
|
||||
result = Undefined();
|
||||
Jump(&exit);
|
||||
@ -941,7 +952,7 @@ GateRef StubBuilder::AddPropertyByName(GateRef glue, GateRef receiver, GateRef k
|
||||
Bind(&isDictMode);
|
||||
{
|
||||
GateRef res = CallRuntime(glue, RTSTUB_ID(NameDictPutIfAbsent),
|
||||
{receiver, *array, key, value, IntToTaggedInt(*attr), TaggedFalse()});
|
||||
{receiver, *array, key, value, Int64ToTaggedInt(*attr), TaggedFalse()});
|
||||
SetPropertiesArray(VariableType::JS_POINTER(), glue, receiver, res);
|
||||
Jump(&exit);
|
||||
}
|
||||
@ -960,7 +971,7 @@ GateRef StubBuilder::AddPropertyByName(GateRef glue, GateRef receiver, GateRef k
|
||||
attr = SetDictionaryOrderFieldInPropAttr(*attr,
|
||||
Int32(PropertyAttributes::MAX_FAST_PROPS_CAPACITY));
|
||||
GateRef res = CallRuntime(glue, RTSTUB_ID(NameDictPutIfAbsent),
|
||||
{ receiver, *array, key, value, IntToTaggedInt(*attr), TaggedTrue() });
|
||||
{ receiver, *array, key, value, Int64ToTaggedInt(*attr), TaggedTrue() });
|
||||
SetPropertiesArray(VariableType::JS_POINTER(), glue, receiver, res);
|
||||
result = Undefined();
|
||||
Jump(&exit);
|
||||
@ -2178,8 +2189,8 @@ GateRef StubBuilder::StoreICWithHandler(GateRef glue, GateRef receiver, GateRef
|
||||
Branch(IsStoreShared(handlerInfo), &isShared, ¬Shared);
|
||||
Bind(&isShared);
|
||||
{
|
||||
GateRef trackType = GetTrackTypeFromHandler(handlerInfo);
|
||||
MatchTrackType(&result, glue, trackType, value, &prepareIntHandlerLoop, &exit);
|
||||
GateRef field = GetFieldTypeFromHandler(handlerInfo);
|
||||
MatchFieldType(&result, glue, field, value, &prepareIntHandlerLoop, &exit);
|
||||
Bind(&prepareIntHandlerLoop);
|
||||
{
|
||||
handler = IntToTaggedPtr(ClearSharedStoreKind(handlerInfo));
|
||||
@ -2459,7 +2470,7 @@ GateRef StubBuilder::GetAttributesFromDictionary(GateRef elements, GateRef entry
|
||||
GateRef attributesIndex =
|
||||
Int32Add(arrayIndex, Int32(DictionaryT::ENTRY_DETAILS_INDEX));
|
||||
auto attrValue = GetValueFromTaggedArray(elements, attributesIndex);
|
||||
return GetInt32OfTInt(attrValue);
|
||||
return GetInt64OfTInt(attrValue);
|
||||
}
|
||||
|
||||
template<typename DictionaryT>
|
||||
@ -2520,7 +2531,7 @@ inline void StubBuilder::UpdateValueAndAttributes(GateRef glue, GateRef elements
|
||||
GateRef attroffset =
|
||||
PtrMul(ZExtInt32ToPtr(attributesIndex), IntPtr(JSTaggedValue::TaggedTypeSize()));
|
||||
GateRef dataOffset = PtrAdd(attroffset, IntPtr(TaggedArray::DATA_OFFSET));
|
||||
Store(VariableType::INT64(), glue, elements, dataOffset, IntToTaggedInt(attr));
|
||||
Store(VariableType::INT64(), glue, elements, dataOffset, Int64ToTaggedInt(attr));
|
||||
}
|
||||
|
||||
template<typename DictionaryT>
|
||||
@ -2835,8 +2846,7 @@ GateRef StubBuilder::GetPropertyByName(GateRef glue, GateRef receiver, GateRef k
|
||||
Bind(&hasEntry);
|
||||
{
|
||||
// PropertyAttributes attr(layoutInfo->GetAttr(entry))
|
||||
GateRef propAttr = GetPropAttrFromLayoutInfo(layOutInfo, entryA);
|
||||
GateRef attr = GetInt32OfTInt(propAttr);
|
||||
GateRef attr = GetPropAttrFromLayoutInfo(layOutInfo, entryA);
|
||||
GateRef value = JSObjectGetProperty(*holder, hclass, attr);
|
||||
Label isAccessor(env);
|
||||
Label notAccessor(env);
|
||||
@ -2957,7 +2967,7 @@ void StubBuilder::TransitionForRepChange(GateRef glue, GateRef receiver, GateRef
|
||||
IntToTaggedInt(inlineProps) });
|
||||
CopyAllHClass(glue, newJshclass, hclass);
|
||||
CallRuntime(glue, RTSTUB_ID(CopyAndUpdateObjLayout),
|
||||
{ hclass, newJshclass, key, IntToTaggedInt(attr) });
|
||||
{ hclass, newJshclass, key, Int64ToTaggedInt(attr) });
|
||||
#if ECMASCRIPT_ENABLE_IC
|
||||
NotifyHClassChanged(glue, hclass, newJshclass);
|
||||
#endif
|
||||
@ -3045,7 +3055,7 @@ GateRef StubBuilder::AddElementInternal(GateRef glue, GateRef receiver, GateRef
|
||||
Bind(&isDicMode);
|
||||
{
|
||||
GateRef res = CallRuntime(glue, RTSTUB_ID(NumberDictionaryPut),
|
||||
{ receiver, elements, IntToTaggedInt(index), value, IntToTaggedInt(attr), TaggedFalse() });
|
||||
{ receiver, elements, IntToTaggedInt(index), value, Int64ToTaggedInt(attr), TaggedFalse() });
|
||||
SetElementsArray(VariableType::JS_POINTER(), glue, receiver, res);
|
||||
result = True();
|
||||
Jump(&exit);
|
||||
@ -3065,7 +3075,7 @@ GateRef StubBuilder::AddElementInternal(GateRef glue, GateRef receiver, GateRef
|
||||
Bind(&isTransToDict);
|
||||
{
|
||||
GateRef res = CallRuntime(glue, RTSTUB_ID(NumberDictionaryPut),
|
||||
{ receiver, elements, IntToTaggedInt(index), value, IntToTaggedInt(attr), TaggedTrue() });
|
||||
{ receiver, elements, IntToTaggedInt(index), value, Int64ToTaggedInt(attr), TaggedTrue() });
|
||||
SetElementsArray(VariableType::JS_POINTER(), glue, receiver, res);
|
||||
result = True();
|
||||
Jump(&exit);
|
||||
@ -3233,7 +3243,7 @@ GateRef StubBuilder::IsArrayLengthWritable(GateRef glue, GateRef receiver)
|
||||
}
|
||||
Bind(&isNegtiveOne);
|
||||
{
|
||||
GateRef attr1 = Int32(PropertyAttributes::GetDefaultAttributes());
|
||||
GateRef attr1 = Int64(PropertyAttributes::GetDefaultAttributes());
|
||||
result = IsWritable(attr1);
|
||||
Jump(&exit);
|
||||
}
|
||||
@ -3241,8 +3251,7 @@ GateRef StubBuilder::IsArrayLengthWritable(GateRef glue, GateRef receiver)
|
||||
Bind(¬DicMode);
|
||||
{
|
||||
GateRef layoutInfo = GetLayoutFromHClass(hclass);
|
||||
GateRef propAttr = GetPropAttrFromLayoutInfo(layoutInfo, Int32(JSArray::LENGTH_INLINE_PROPERTY_INDEX));
|
||||
GateRef attr = GetInt32OfTInt(propAttr);
|
||||
GateRef attr = GetPropAttrFromLayoutInfo(layoutInfo, Int32(JSArray::LENGTH_INLINE_PROPERTY_INDEX));
|
||||
result = IsWritable(attr);
|
||||
Jump(&exit);
|
||||
}
|
||||
@ -3276,7 +3285,7 @@ GateRef StubBuilder::FindTransitions(GateRef glue, GateRef receiver, GateRef hcl
|
||||
GateRef last = Int32Sub(propNums, Int32(1));
|
||||
GateRef layoutInfo = GetLayoutFromHClass(transitionHClass);
|
||||
GateRef cachedKey = GetKeyFromLayoutInfo(layoutInfo, last);
|
||||
GateRef cachedAttr = GetInt32OfTInt(GetPropAttrFromLayoutInfo(layoutInfo, last));
|
||||
GateRef cachedAttr = GetPropAttrFromLayoutInfo(layoutInfo, last);
|
||||
GateRef cachedMetaData = GetPropertyMetaDataFromAttr(cachedAttr);
|
||||
Label keyMatch(env);
|
||||
Label isMatch(env);
|
||||
@ -3532,7 +3541,7 @@ GateRef StubBuilder::SetPropertyByIndex(GateRef glue, GateRef receiver, GateRef
|
||||
Label success(env);
|
||||
Label failed(env);
|
||||
Branch(AddElementInternal(glue, receiver, index, value,
|
||||
Int32(PropertyAttributes::GetDefaultAttributes())), &success, &failed);
|
||||
Int64(PropertyAttributes::GetDefaultAttributes())), &success, &failed);
|
||||
Bind(&success);
|
||||
{
|
||||
returnValue = Undefined();
|
||||
@ -3658,8 +3667,7 @@ GateRef StubBuilder::SetPropertyByName(GateRef glue, GateRef receiver, GateRef k
|
||||
Bind(&hasEntry);
|
||||
{
|
||||
// PropertyAttributes attr(layoutInfo->GetAttr(entry))
|
||||
GateRef propAttr = GetPropAttrFromLayoutInfo(layOutInfo, entry);
|
||||
GateRef attr = GetInt32OfTInt(propAttr);
|
||||
GateRef attr = GetPropAttrFromLayoutInfo(layOutInfo, entry);
|
||||
Label isAccessor(env);
|
||||
Label notAccessor(env);
|
||||
Branch(IsAccessor(attr), &isAccessor, ¬Accessor);
|
||||
@ -3832,8 +3840,7 @@ GateRef StubBuilder::SetPropertyByName(GateRef glue, GateRef receiver, GateRef k
|
||||
{
|
||||
GateRef receiverHClass = LoadHClass(receiver);
|
||||
GateRef receiverLayoutInfo = GetLayoutFromHClass(receiverHClass);
|
||||
GateRef holePropAttr = GetPropAttrFromLayoutInfo(receiverLayoutInfo, *receiverHoleEntry);
|
||||
GateRef holeAttr = GetInt32OfTInt(holePropAttr);
|
||||
GateRef holeAttr = GetPropAttrFromLayoutInfo(receiverLayoutInfo, *receiverHoleEntry);
|
||||
JSObjectSetProperty(glue, receiver, receiverHClass, holeAttr, key, value);
|
||||
ProfilerStubBuilder(env).UpdatePropAttrWithValue(
|
||||
glue, jsType, receiverLayoutInfo, holeAttr, *receiverHoleEntry, value, callback);
|
||||
@ -3855,7 +3862,7 @@ GateRef StubBuilder::SetPropertyByName(GateRef glue, GateRef receiver, GateRef k
|
||||
Bind(&extensible);
|
||||
{
|
||||
result = AddPropertyByName(glue, receiver, key, value,
|
||||
Int32(PropertyAttributes::GetDefaultAttributes()), callback);
|
||||
Int64(PropertyAttributes::GetDefaultAttributes()), callback);
|
||||
Jump(&exit);
|
||||
}
|
||||
Bind(&exit);
|
||||
|
@ -476,9 +476,9 @@ public:
|
||||
GateRef GetValueFromMutantTaggedArray(GateRef elements, GateRef index);
|
||||
void CheckUpdateSharedType(bool isDicMode, Variable *result, GateRef glue, GateRef jsType, GateRef attr,
|
||||
GateRef value, Label *executeSetProp, Label *exit);
|
||||
void MatchTrackType(Variable *result, GateRef glue, GateRef trackType, GateRef value, Label *executeSetProp,
|
||||
void MatchFieldType(Variable *result, GateRef glue, GateRef fieldType, GateRef value, Label *executeSetProp,
|
||||
Label *exit);
|
||||
GateRef GetTrackTypeFromHandler(GateRef attr);
|
||||
GateRef GetFieldTypeFromHandler(GateRef attr);
|
||||
GateRef ClearSharedStoreKind(GateRef handlerInfo);
|
||||
GateRef GetTaggedValueWithElementsKind(GateRef receiver, GateRef index);
|
||||
GateRef SetValueWithElementsKind(GateRef glue, GateRef receiver, GateRef rawValue, GateRef index,
|
||||
@ -504,7 +504,7 @@ public:
|
||||
GateRef GetPropertiesAddrFromLayoutInfo(GateRef layout);
|
||||
GateRef GetPropertyMetaDataFromAttr(GateRef attr);
|
||||
GateRef GetKeyFromLayoutInfo(GateRef layout, GateRef entry);
|
||||
void MatchTrackType(GateRef trackType, GateRef value, Label *executeSetProp, Label *typeMismatch);
|
||||
void MatchFieldType(GateRef fieldType, GateRef value, Label *executeSetProp, Label *typeMismatch);
|
||||
GateRef FindElementWithCache(GateRef glue, GateRef layoutInfo, GateRef hClass,
|
||||
GateRef key, GateRef propsNum);
|
||||
GateRef FindElementFromNumberDictionary(GateRef glue, GateRef elements, GateRef index);
|
||||
@ -606,7 +606,8 @@ public:
|
||||
GateRef SetIsInlinePropsFieldInPropAttr(GateRef attr, GateRef value);
|
||||
GateRef SetTrackTypeInPropAttr(GateRef attr, GateRef type);
|
||||
GateRef GetTrackTypeInPropAttr(GateRef attr);
|
||||
GateRef GetDictTrackTypeInPropAttr(GateRef attr);
|
||||
GateRef GetSharedFieldTypeInPropAttr(GateRef attr);
|
||||
GateRef GetDictSharedFieldTypeInPropAttr(GateRef attr);
|
||||
GateRef GetRepInPropAttr(GateRef attr);
|
||||
GateRef IsIntRepInPropAttr(GateRef attr);
|
||||
GateRef IsDoubleRepInPropAttr(GateRef attr);
|
||||
|
@ -61,7 +61,7 @@ JSTaggedValue GlobalDictionary::GetValue(int entry) const
|
||||
PropertyAttributes GlobalDictionary::GetAttributes(int entry) const
|
||||
{
|
||||
int index = GetEntryIndex(entry) + ENTRY_DETAILS_INDEX;
|
||||
return PropertyAttributes(Get(index).GetInt());
|
||||
return PropertyAttributes(Get(index));
|
||||
}
|
||||
|
||||
void GlobalDictionary::SetEntry(const JSThread *thread, int entry, const JSTaggedValue &key, const JSTaggedValue &value,
|
||||
|
@ -65,7 +65,7 @@ public:
|
||||
using SWholeKindBit = KindBit;
|
||||
static_assert(SKindBit::START_BIT == SWholeKindBit::START_BIT);
|
||||
static_assert(SSharedBit::Mask() || SKindBit::Mask() == KindBit::Mask());
|
||||
using STrackTypeBit = AttrIndexBit::NextField<uint32_t, PropertyAttributes::TRACK_TYPE_NUM>;
|
||||
using SFieldTypeBit = AttrIndexBit::NextField<SharedFieldType, PropertyAttributes::FIELD_TYPE_NUM>;
|
||||
static_assert(static_cast<size_t>(StoreHandlerKind::S_TOTAL_KINDS) <= (1 << STORE_KIND_BIT_LENGTH));
|
||||
|
||||
HandlerBase() = default;
|
||||
@ -81,9 +81,9 @@ public:
|
||||
return InternalAccessorBit::Get(handler);
|
||||
}
|
||||
|
||||
static inline TrackType GetTrackType(uint32_t handler)
|
||||
static inline SharedFieldType GetFieldType(uint32_t handler)
|
||||
{
|
||||
return static_cast<TrackType>(STrackTypeBit::Get(handler));
|
||||
return static_cast<SharedFieldType>(SFieldTypeBit::Get(handler));
|
||||
}
|
||||
|
||||
static inline bool IsNonExist(uint32_t handler)
|
||||
@ -283,9 +283,9 @@ public:
|
||||
SSharedBit::Set<uint32_t>(op.GetReceiver()->IsJSShared(), &handler);
|
||||
TaggedArray *array = TaggedArray::Cast(receiver->GetProperties().GetTaggedObject());
|
||||
if (!array->IsDictionaryMode()) {
|
||||
STrackTypeBit::Set(static_cast<uint32_t>(op.GetAttr().GetTrackType()), &handler);
|
||||
SFieldTypeBit::Set(op.GetAttr().GetSharedFieldType(), &handler);
|
||||
} else {
|
||||
STrackTypeBit::Set(static_cast<uint32_t>(op.GetAttr().GetDictTrackType()), &handler);
|
||||
SFieldTypeBit::Set(op.GetAttr().GetDictSharedFieldType(), &handler);
|
||||
}
|
||||
if (op.IsElement()) {
|
||||
return StoreElement(thread, op.GetReceiver(), handler);
|
||||
|
@ -227,8 +227,8 @@ ARK_INLINE JSTaggedValue ICRuntimeStub::StoreICWithHandler(JSThread *thread, JST
|
||||
}
|
||||
bool isShared = HandlerBase::IsStoreShared(handlerInfo);
|
||||
if (isShared) {
|
||||
TrackType trackType { HandlerBase::GetTrackType(handlerInfo) };
|
||||
if (!ClassHelper::MatchTrackType(trackType, value)) {
|
||||
SharedFieldType fieldType { HandlerBase::GetFieldType(handlerInfo) };
|
||||
if (!ClassHelper::MatchFieldType(fieldType, value)) {
|
||||
THROW_TYPE_ERROR_AND_RETURN((thread), GET_MESSAGE_STRING(SetTypeMismatchedSharedProperty),
|
||||
JSTaggedValue::Exception());
|
||||
}
|
||||
|
@ -212,7 +212,7 @@ void JSArray::SetCapacity(JSThread *thread, const JSHandle<JSObject> &array, uin
|
||||
JSTaggedValue::StringToElementIndex(value, &output);
|
||||
JSTaggedValue key(static_cast<int>(output));
|
||||
int entry = dictHandle->FindEntry(key);
|
||||
uint32_t attr = dictHandle->GetAttributes(entry).GetValue();
|
||||
auto attr = dictHandle->GetAttributes(entry).GetValue();
|
||||
PropertyAttributes propAttr(attr);
|
||||
if (propAttr.IsConfigurable()) {
|
||||
JSHandle<NumberDictionary> newDict = NumberDictionary::Remove(thread, dictHandle, entry);
|
||||
|
@ -45,16 +45,16 @@ void JSHClass::AddTransitions(const JSThread *thread, const JSHandle<JSHClass> &
|
||||
auto cachedHClass = JSHClass::Cast(transitions.GetTaggedWeakRef());
|
||||
uint32_t last = cachedHClass->NumberOfProps() - 1;
|
||||
LayoutInfo *layoutInfo = LayoutInfo::Cast(cachedHClass->GetLayout().GetTaggedObject());
|
||||
auto attr = JSHandle<JSTaggedValue>(thread, JSTaggedValue(layoutInfo->GetAttr(last).GetPropertyMetaData()));
|
||||
auto metaData = JSHandle<JSTaggedValue>(thread, JSTaggedValue(layoutInfo->GetAttr(last).GetPropertyMetaData()));
|
||||
auto lastKey = JSHandle<JSTaggedValue>(thread, layoutInfo->GetKey(last));
|
||||
auto lastHClass = JSHandle<JSTaggedValue>(thread, cachedHClass);
|
||||
dict.Update(TransitionsDictionary::Create(thread));
|
||||
transitions = TransitionsDictionary::PutIfAbsent(thread, dict, lastKey, lastHClass, attr).GetTaggedValue();
|
||||
transitions = TransitionsDictionary::PutIfAbsent(thread, dict, lastKey, lastHClass, metaData).GetTaggedValue();
|
||||
}
|
||||
auto attr = JSHandle<JSTaggedValue>(thread, JSTaggedValue(attributes.GetPropertyMetaData()));
|
||||
auto metaData = JSHandle<JSTaggedValue>(thread, JSTaggedValue(attributes.GetPropertyMetaData()));
|
||||
dict.Update(transitions);
|
||||
transitions =
|
||||
TransitionsDictionary::PutIfAbsent(thread, dict, key, JSHandle<JSTaggedValue>(child), attr).GetTaggedValue();
|
||||
TransitionsDictionary::PutIfAbsent(thread, dict, key, JSHandle<JSTaggedValue>(child), metaData).GetTaggedValue();
|
||||
parent->SetTransitions(thread, transitions);
|
||||
}
|
||||
|
||||
@ -78,11 +78,11 @@ void JSHClass::AddProtoTransitions(const JSThread *thread, const JSHandle<JSHCla
|
||||
auto cachedHClass = JSHClass::Cast(transitions.GetTaggedWeakRef());
|
||||
uint32_t last = cachedHClass->NumberOfProps() - 1;
|
||||
LayoutInfo *layoutInfo = LayoutInfo::Cast(cachedHClass->GetLayout().GetTaggedObject());
|
||||
auto attr = JSHandle<JSTaggedValue>(thread, JSTaggedValue(layoutInfo->GetAttr(last).GetPropertyMetaData()));
|
||||
auto metaData = JSHandle<JSTaggedValue>(thread, JSTaggedValue(layoutInfo->GetAttr(last).GetPropertyMetaData()));
|
||||
auto lastKey = JSHandle<JSTaggedValue>(thread, layoutInfo->GetKey(last));
|
||||
auto lastHClass = JSHandle<JSTaggedValue>(thread, cachedHClass);
|
||||
dict.Update(TransitionsDictionary::Create(thread));
|
||||
transitions = TransitionsDictionary::PutIfAbsent(thread, dict, lastKey, lastHClass, attr).GetTaggedValue();
|
||||
transitions = TransitionsDictionary::PutIfAbsent(thread, dict, lastKey, lastHClass, metaData).GetTaggedValue();
|
||||
}
|
||||
|
||||
dict.Update(transitions);
|
||||
@ -91,7 +91,7 @@ void JSHClass::AddProtoTransitions(const JSThread *thread, const JSHandle<JSHCla
|
||||
parent->SetTransitions(thread, transitions);
|
||||
}
|
||||
|
||||
inline JSHClass *JSHClass::FindTransitions(const JSTaggedValue &key, const JSTaggedValue &attributes)
|
||||
inline JSHClass *JSHClass::FindTransitions(const JSTaggedValue &key, const JSTaggedValue &metaData)
|
||||
{
|
||||
DISALLOW_GARBAGE_COLLECTION;
|
||||
JSTaggedValue transitions = GetTransitions();
|
||||
@ -102,9 +102,9 @@ inline JSHClass *JSHClass::FindTransitions(const JSTaggedValue &key, const JSTag
|
||||
auto cachedHClass = JSHClass::Cast(transitions.GetTaggedWeakRef());
|
||||
int last = static_cast<int>(cachedHClass->NumberOfProps()) - 1;
|
||||
LayoutInfo *layoutInfo = LayoutInfo::Cast(cachedHClass->GetLayout().GetTaggedObject());
|
||||
auto attr = layoutInfo->GetAttr(last).GetPropertyMetaData();
|
||||
auto cachedKey = layoutInfo->GetKey(last);
|
||||
if (attr == attributes.GetInt() && key == cachedKey) {
|
||||
auto lastMetaData = layoutInfo->GetAttr(last).GetPropertyMetaData();
|
||||
auto lastKey = layoutInfo->GetKey(last);
|
||||
if (lastMetaData == metaData.GetInt() && key == lastKey) {
|
||||
return cachedHClass;
|
||||
}
|
||||
return nullptr;
|
||||
@ -112,7 +112,7 @@ inline JSHClass *JSHClass::FindTransitions(const JSTaggedValue &key, const JSTag
|
||||
|
||||
ASSERT(transitions.IsTaggedArray());
|
||||
TransitionsDictionary *dict = TransitionsDictionary::Cast(transitions.GetTaggedObject());
|
||||
auto entry = dict->FindEntry(key, attributes);
|
||||
auto entry = dict->FindEntry(key, metaData);
|
||||
if (entry == -1) {
|
||||
return nullptr;
|
||||
}
|
||||
|
@ -1850,7 +1850,7 @@ public:
|
||||
return GetProto();
|
||||
}
|
||||
|
||||
inline JSHClass *FindTransitions(const JSTaggedValue &key, const JSTaggedValue &attributes);
|
||||
inline JSHClass *FindTransitions(const JSTaggedValue &key, const JSTaggedValue &metaData);
|
||||
|
||||
DECL_DUMP()
|
||||
|
||||
|
@ -874,7 +874,7 @@ bool JSObject::SetPropertyForDataDescriptor(ObjectOperator *op, const JSHandle<J
|
||||
return false;
|
||||
}
|
||||
if (op->IsFound() && receiver->IsJSShared()) {
|
||||
if (!ClassHelper::MatchTrackType(op->GetTrackType(), value.GetTaggedValue())) {
|
||||
if (!ClassHelper::MatchFieldType(op->GetSharedFieldType(), value.GetTaggedValue())) {
|
||||
if (mayThrow) {
|
||||
THROW_TYPE_ERROR_AND_RETURN(thread, GET_MESSAGE_STRING(SetTypeMismatchedSharedProperty), false);
|
||||
}
|
||||
@ -907,7 +907,7 @@ bool JSObject::SetPropertyForDataDescriptor(ObjectOperator *op, const JSHandle<J
|
||||
return false;
|
||||
}
|
||||
if (hasReceiver && receiver->IsJSShared() &&
|
||||
!ClassHelper::MatchTrackType(op->GetTrackType(), value.GetTaggedValue())) {
|
||||
!ClassHelper::MatchFieldType(op->GetSharedFieldType(), value.GetTaggedValue())) {
|
||||
if (mayThrow) {
|
||||
THROW_TYPE_ERROR_AND_RETURN(thread, GET_MESSAGE_STRING(SetTypeMismatchedSharedProperty), false);
|
||||
}
|
||||
@ -1250,7 +1250,7 @@ bool JSObject::ValidateDataDescriptorWhenConfigurable(ObjectOperator *op, const
|
||||
if (!desc.HasValue()) {
|
||||
THROW_TYPE_ERROR_AND_RETURN(op->GetThread(), GET_MESSAGE_STRING(UpdateSendableAttributes), false);
|
||||
}
|
||||
if (!ClassHelper::MatchTrackType(current.GetTrackType(), desc.GetValue().GetTaggedValue())) {
|
||||
if (!ClassHelper::MatchFieldType(current.GetSharedFieldType(), desc.GetValue().GetTaggedValue())) {
|
||||
THROW_TYPE_ERROR_AND_RETURN(op->GetThread(), GET_MESSAGE_STRING(SetTypeMismatchedSharedProperty), false);
|
||||
}
|
||||
}
|
||||
|
@ -109,14 +109,14 @@ public:
|
||||
key_ = key;
|
||||
}
|
||||
|
||||
inline void SetTrackType(TrackType trackType)
|
||||
inline void SetSharedFieldType(SharedFieldType fieldType)
|
||||
{
|
||||
trackType_ = trackType;
|
||||
fieldType_ = fieldType;
|
||||
}
|
||||
|
||||
inline TrackType GetTrackType() const
|
||||
inline SharedFieldType GetSharedFieldType() const
|
||||
{
|
||||
return trackType_;
|
||||
return fieldType_;
|
||||
}
|
||||
|
||||
inline bool IsWritable() const
|
||||
@ -243,7 +243,7 @@ private:
|
||||
bool hasWritable_ {false};
|
||||
bool hasEnumerable_ {false};
|
||||
bool hasConfigurable_ {false};
|
||||
TrackType trackType_ {TrackType::NONE};
|
||||
SharedFieldType fieldType_ {SharedFieldType::NONE};
|
||||
|
||||
JSHandle<JSTaggedValue> value_ {};
|
||||
JSHandle<JSTaggedValue> getter_ {};
|
||||
|
@ -699,6 +699,18 @@ private:
|
||||
const JSHandle<JSTaggedValue> &key,
|
||||
const JSHandle<JSTaggedValue> &value);
|
||||
static JSHandle<EcmaString> NativePointerToString(JSThread *thread, const JSHandle<JSTaggedValue> &tagged);
|
||||
|
||||
static ARK_INLINE JSTaggedValue WrapUint64(uint64_t v)
|
||||
{
|
||||
return JSTaggedValue(static_cast<JSTaggedType>(v) | TAG_INT);
|
||||
}
|
||||
static ARK_INLINE uint64_t UnwrapToUint64(JSTaggedValue v)
|
||||
{
|
||||
ASSERT_PRINT(v.IsInt(), "can not convert JSTaggedValue to Int :" << std::hex << v.GetRawData());
|
||||
return static_cast<uint64_t>(v.GetRawData() & (~TAG_INT));
|
||||
}
|
||||
|
||||
friend class PropertyAttributes;
|
||||
};
|
||||
STATIC_ASSERT_EQ_ARCH(sizeof(JSTaggedValue), JSTaggedValue::SizeArch32, JSTaggedValue::SizeArch64);
|
||||
} // namespace panda::ecmascript
|
||||
|
@ -622,39 +622,34 @@ JSHandle<NameDictionary> ClassHelper::BuildDictionaryProperties(JSThread *thread
|
||||
return dict;
|
||||
}
|
||||
|
||||
bool ClassHelper::MatchTrackType(TrackType trackType, JSTaggedValue value)
|
||||
bool ClassHelper::MatchFieldType(SharedFieldType fieldType, JSTaggedValue value)
|
||||
{
|
||||
bool checkRet = false;
|
||||
switch (trackType) {
|
||||
case TrackType::NUMBER: {
|
||||
switch (fieldType) {
|
||||
case SharedFieldType::NUMBER: {
|
||||
checkRet = value.IsNumber();
|
||||
break;
|
||||
}
|
||||
case TrackType::INT: {
|
||||
checkRet = value.IsInt();
|
||||
break;
|
||||
}
|
||||
case TrackType::DOUBLE: {
|
||||
checkRet = value.IsDouble();
|
||||
break;
|
||||
}
|
||||
case TrackType::BOOLEAN: {
|
||||
case SharedFieldType::BOOLEAN: {
|
||||
checkRet = value.IsBoolean();
|
||||
break;
|
||||
}
|
||||
case TrackType::STRING: {
|
||||
case SharedFieldType::STRING: {
|
||||
checkRet = value.IsString() || value.IsNull();
|
||||
break;
|
||||
}
|
||||
case TrackType::SENDABLE: {
|
||||
case SharedFieldType::BIG_INT: {
|
||||
checkRet = value.IsBigInt();
|
||||
break;
|
||||
}
|
||||
case SharedFieldType::SENDABLE: {
|
||||
checkRet = value.IsJSShared() || value.IsNull();
|
||||
break;
|
||||
}
|
||||
case TrackType::NONE: {
|
||||
case SharedFieldType::NONE: {
|
||||
checkRet = true;
|
||||
break;
|
||||
}
|
||||
case TrackType::TAGGED:
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@ -871,16 +866,16 @@ void SendableClassDefiner::AddFieldTypeToHClass(JSThread *thread, const JSHandle
|
||||
PropertyAttributes attributes = PropertyAttributes::Default(true, true, false);
|
||||
key.Update(fieldTypeArray->Get(i));
|
||||
ASSERT(key->IsString());
|
||||
TrackType type = FromFieldType(FieldType(fieldTypeArray->Get(i + 1).GetInt()));
|
||||
SharedFieldType type = FromFieldType(FieldType(fieldTypeArray->Get(i + 1).GetInt()));
|
||||
int entry = layout->FindElementWithCache(thread, *hclass, key.GetTaggedValue(), index);
|
||||
if (entry != -1) {
|
||||
attributes = layout->GetAttr(entry);
|
||||
attributes.SetTrackType(type);
|
||||
attributes.SetSharedFieldType(type);
|
||||
layout->SetNormalAttr(thread, entry, attributes);
|
||||
} else {
|
||||
attributes.SetIsInlinedProps(true);
|
||||
attributes.SetRepresentation(Representation::TAGGED);
|
||||
attributes.SetTrackType(type);
|
||||
attributes.SetSharedFieldType(type);
|
||||
attributes.SetOffset(index);
|
||||
layout->AddKey(thread, index++, key.GetTaggedValue(), attributes);
|
||||
}
|
||||
@ -905,8 +900,8 @@ void SendableClassDefiner::AddFieldTypeToDict(JSThread *thread, const JSHandle<T
|
||||
for (uint32_t i = 0; i < length; i += 2) { // 2: key-value pair;
|
||||
key.Update(fieldTypeArray->Get(i));
|
||||
ASSERT(key->IsString());
|
||||
TrackType type = FromFieldType(FieldType(fieldTypeArray->Get(i + 1).GetInt()));
|
||||
attributes.SetTrackType(type);
|
||||
SharedFieldType type = FromFieldType(FieldType(fieldTypeArray->Get(i + 1).GetInt()));
|
||||
attributes.SetSharedFieldType(type);
|
||||
attributes.SetBoxType(PropertyBoxType::UNDEFINED);
|
||||
JSHandle<NameDictionary> newDict = NameDictionary::Put(thread, dict, key, value, attributes);
|
||||
dict.Update(newDict);
|
||||
|
@ -33,6 +33,7 @@ enum class FieldType {
|
||||
STRING = (1 << 1),
|
||||
BOOLEAN = (1 << 2),
|
||||
TS_TYPE_REF = (1 << 3),
|
||||
BIG_INT = (1 << 4),
|
||||
};
|
||||
class ClassInfoExtractor : public TaggedObject {
|
||||
public:
|
||||
@ -114,7 +115,7 @@ public:
|
||||
const JSHandle<JSTaggedValue> &ihclass,
|
||||
const JSHandle<JSHClass> &constructorHClass);
|
||||
|
||||
static bool PUBLIC_API MatchTrackType(TrackType trackType, JSTaggedValue value);
|
||||
static bool PUBLIC_API MatchFieldType(SharedFieldType fieldType, JSTaggedValue value);
|
||||
private:
|
||||
static JSHandle<NameDictionary> BuildDictionaryProperties(JSThread *thread, const JSHandle<JSObject> &object,
|
||||
JSHandle<TaggedArray> &keys,
|
||||
@ -141,20 +142,23 @@ public:
|
||||
const JSHandle<TaggedArray> &properties);
|
||||
|
||||
private:
|
||||
static TrackType FromFieldType(FieldType type)
|
||||
static SharedFieldType FromFieldType(FieldType type)
|
||||
{
|
||||
switch (type) {
|
||||
case FieldType::NONE:
|
||||
return TrackType::NONE;
|
||||
return SharedFieldType::NONE;
|
||||
case FieldType::NUMBER:
|
||||
return TrackType::NUMBER;
|
||||
return SharedFieldType::NUMBER;
|
||||
case FieldType::STRING:
|
||||
return TrackType::STRING;
|
||||
return SharedFieldType::STRING;
|
||||
case FieldType::BOOLEAN:
|
||||
return TrackType::BOOLEAN;
|
||||
return SharedFieldType::BOOLEAN;
|
||||
case FieldType::TS_TYPE_REF:
|
||||
return TrackType::SENDABLE;
|
||||
return SharedFieldType::SENDABLE;
|
||||
case FieldType::BIG_INT:
|
||||
return SharedFieldType::BIG_INT;
|
||||
default:
|
||||
LOG_ECMA(FATAL) << "Unsupport fieldType in shared object with type: " << static_cast<uint32_t>(type);
|
||||
UNREACHABLE();
|
||||
}
|
||||
}
|
||||
|
@ -4835,7 +4835,7 @@ JSHandle<JSTaggedValue> ObjectFactory::CreateDictionaryJSObjectWithNamedProperti
|
||||
|
||||
void ObjectFactory::FillFreeMemoryRange(uintptr_t start, uintptr_t end)
|
||||
{
|
||||
ASSERT(start < end);
|
||||
ASSERT(start <= end);
|
||||
ASSERT(start % static_cast<uint8_t>(MemAlignment::MEM_ALIGN_OBJECT) == 0);
|
||||
ASSERT(end % static_cast<uint8_t>(MemAlignment::MEM_ALIGN_OBJECT) == 0);
|
||||
while (start < end) {
|
||||
|
@ -241,7 +241,7 @@ JSTaggedValue ObjectFastOperator::SetPropertyByName(JSThread *thread, JSTaggedVa
|
||||
break;
|
||||
}
|
||||
if (holder.IsJSShared() && (sCheckMode == SCheckMode::CHECK)) {
|
||||
if (!ClassHelper::MatchTrackType(attr.GetTrackType(), value)) {
|
||||
if (!ClassHelper::MatchFieldType(attr.GetSharedFieldType(), value)) {
|
||||
THROW_TYPE_ERROR_AND_RETURN((thread), GET_MESSAGE_STRING(SetTypeMismatchedSharedProperty),
|
||||
JSTaggedValue::Exception());
|
||||
}
|
||||
@ -271,7 +271,7 @@ JSTaggedValue ObjectFastOperator::SetPropertyByName(JSThread *thread, JSTaggedVa
|
||||
break;
|
||||
}
|
||||
if ((sCheckMode == SCheckMode::CHECK) && holder.IsJSShared()) {
|
||||
if (!ClassHelper::MatchTrackType(attr.GetDictTrackType(), value)) {
|
||||
if (!ClassHelper::MatchFieldType(attr.GetDictSharedFieldType(), value)) {
|
||||
THROW_TYPE_ERROR_AND_RETURN((thread), GET_MESSAGE_STRING(SetTypeMismatchedSharedProperty),
|
||||
JSTaggedValue::Exception());
|
||||
}
|
||||
|
@ -398,11 +398,11 @@ bool ObjectOperator::IsDetectorName(JSHandle<GlobalEnv> env, JSTaggedValue key)
|
||||
return (start <= addr) && (addr <= end);
|
||||
}
|
||||
|
||||
TrackType ObjectOperator::GetTrackType() const
|
||||
SharedFieldType ObjectOperator::GetSharedFieldType() const
|
||||
{
|
||||
return JSObject::Cast(holder_->GetTaggedObject())->GetJSHClass()->IsDictionaryMode()
|
||||
? attributes_.GetDictTrackType()
|
||||
: attributes_.GetTrackType();
|
||||
? attributes_.GetDictSharedFieldType()
|
||||
: attributes_.GetSharedFieldType();
|
||||
}
|
||||
|
||||
void ObjectOperator::ToPropertyDescriptor(PropertyDescriptor &desc) const
|
||||
@ -416,7 +416,7 @@ void ObjectOperator::ToPropertyDescriptor(PropertyDescriptor &desc) const
|
||||
desc.SetWritable(IsWritable());
|
||||
JSTaggedValue val = GetValue();
|
||||
desc.SetValue(JSHandle<JSTaggedValue>(thread_, val));
|
||||
desc.SetTrackType(GetTrackType());
|
||||
desc.SetSharedFieldType(GetSharedFieldType());
|
||||
} else {
|
||||
auto result = GetValue();
|
||||
bool isPropertyBox = result.IsPropertyBox();
|
||||
@ -505,7 +505,7 @@ void ObjectOperator::LookupGlobal(const JSHandle<JSObject> &obj)
|
||||
return;
|
||||
}
|
||||
JSTaggedValue value(dict->GetBox(entry));
|
||||
uint32_t attr = dict->GetAttributes(entry).GetValue();
|
||||
auto attr = dict->GetAttributes(entry).GetValue();
|
||||
SetFound(entry, value, attr, true);
|
||||
}
|
||||
|
||||
@ -534,7 +534,7 @@ void ObjectOperator::LookupPropertyInlinedProps(const JSHandle<JSObject> &obj)
|
||||
}
|
||||
|
||||
JSTaggedValue value(dict->GetBox(entry));
|
||||
uint32_t attr = dict->GetAttributes(entry).GetValue();
|
||||
auto attr = dict->GetAttributes(entry).GetValue();
|
||||
SetFound(entry, value, attr, true);
|
||||
return;
|
||||
}
|
||||
@ -575,7 +575,7 @@ void ObjectOperator::LookupPropertyInlinedProps(const JSHandle<JSObject> &obj)
|
||||
}
|
||||
|
||||
JSTaggedValue value = dict->GetValue(entry);
|
||||
uint32_t attr = dict->GetAttributes(entry).GetValue();
|
||||
auto attr = dict->GetAttributes(entry).GetValue();
|
||||
SetFound(entry, value, attr, false);
|
||||
}
|
||||
|
||||
@ -605,7 +605,7 @@ void ObjectOperator::TransitionForAttributeChanged(const JSHandle<JSObject> &rec
|
||||
JSHandle<NameDictionary> dict(JSObject::TransitionToDictionary(thread_, receiver));
|
||||
index = static_cast<uint32_t>(dict->FindEntry(key_.GetTaggedValue()));
|
||||
PropertyAttributes origin = dict->GetAttributes(index);
|
||||
attr.SetDictTrackType(attr.GetTrackType());
|
||||
attr.SetDictSharedFieldType(attr.GetSharedFieldType());
|
||||
attr.SetDictionaryOrder(origin.GetDictionaryOrder());
|
||||
dict->SetAttributes(thread_, index, attr);
|
||||
} else {
|
||||
@ -885,7 +885,7 @@ void ObjectOperator::DeleteElementInHolder() const
|
||||
}
|
||||
}
|
||||
|
||||
void ObjectOperator::SetFound(uint32_t index, JSTaggedValue value, uint32_t attr, bool mode, bool transition)
|
||||
void ObjectOperator::SetFound(uint32_t index, JSTaggedValue value, uint64_t attr, bool mode, bool transition)
|
||||
{
|
||||
SetIndex(index);
|
||||
SetValue(value);
|
||||
@ -894,7 +894,7 @@ void ObjectOperator::SetFound(uint32_t index, JSTaggedValue value, uint32_t attr
|
||||
SetAttr(attr);
|
||||
}
|
||||
|
||||
void ObjectOperator::UpdateFound(uint32_t index, uint32_t attr, bool mode, bool transition)
|
||||
void ObjectOperator::UpdateFound(uint32_t index, uint64_t attr, bool mode, bool transition)
|
||||
{
|
||||
SetIndex(index);
|
||||
SetFastMode(mode);
|
||||
@ -967,7 +967,7 @@ void ObjectOperator::LookupElementInlinedProps(const JSHandle<JSObject> &obj)
|
||||
return;
|
||||
}
|
||||
|
||||
uint32_t attr = dictionary->GetAttributes(entry).GetValue();
|
||||
auto attr = dictionary->GetAttributes(entry).GetValue();
|
||||
SetFound(entry, dictionary->GetValue(entry), attr, false);
|
||||
}
|
||||
}
|
||||
|
@ -159,14 +159,14 @@ public:
|
||||
return attributes_;
|
||||
}
|
||||
|
||||
inline void SetAttr(uint32_t attr)
|
||||
inline void SetAttr(uint64_t attr)
|
||||
{
|
||||
attributes_ = PropertyAttributes(attr);
|
||||
}
|
||||
|
||||
inline void SetAttr(const PropertyAttributes &attr)
|
||||
{
|
||||
attributes_ = PropertyAttributes(attr);
|
||||
attributes_ = attr;
|
||||
}
|
||||
|
||||
inline bool IsPrimitiveAttr() const
|
||||
@ -275,7 +275,7 @@ public:
|
||||
}
|
||||
|
||||
void ToPropertyDescriptor(PropertyDescriptor &desc) const;
|
||||
TrackType GetTrackType() const;
|
||||
SharedFieldType GetSharedFieldType() const;
|
||||
void LookupProperty();
|
||||
void GlobalLookupProperty();
|
||||
inline void ReLookupPropertyInReceiver()
|
||||
@ -324,8 +324,8 @@ private:
|
||||
void StartGlobalLookUp(OperatorType type);
|
||||
void HandleKey(const JSHandle<JSTaggedValue> &key);
|
||||
uint32_t ComputeElementCapacity(uint32_t oldCapacity);
|
||||
void SetFound(uint32_t index, JSTaggedValue value, uint32_t attr, bool mode, bool transition = false);
|
||||
void UpdateFound(uint32_t index, uint32_t attr, bool mode, bool transition);
|
||||
void SetFound(uint32_t index, JSTaggedValue value, uint64_t attr, bool mode, bool transition = false);
|
||||
void UpdateFound(uint32_t index, uint64_t attr, bool mode, bool transition);
|
||||
void ResetState();
|
||||
void ResetStateForAddProperty();
|
||||
inline void LookupPropertyInHolder()
|
||||
|
@ -35,10 +35,16 @@ enum class TrackType : uint8_t {
|
||||
INT = 0x1ULL,
|
||||
DOUBLE = 0x1ULL << 1,
|
||||
NUMBER = INT | DOUBLE,
|
||||
TAGGED = 0x1ULL << 2,
|
||||
BOOLEAN = 5,
|
||||
STRING = 6,
|
||||
SENDABLE = 7
|
||||
TAGGED = 0x1ULL << 2
|
||||
};
|
||||
|
||||
enum class SharedFieldType : uint8_t {
|
||||
NONE = 0,
|
||||
NUMBER = 1,
|
||||
STRING = 2,
|
||||
BOOLEAN = 3,
|
||||
SENDABLE = 4,
|
||||
BIG_INT = 5,
|
||||
};
|
||||
|
||||
enum class PropertyBoxType {
|
||||
@ -64,13 +70,14 @@ enum class PropertyBoxType {
|
||||
* --------------------------------
|
||||
* Fast | OffsetField(bit 8...17)
|
||||
* | TrackTypeField(bit 18...20)
|
||||
* | SortedIndexField(bit 21...30)
|
||||
* | IsConstPropsField(bit 31)
|
||||
* | IsNotHoleField(bit 32)
|
||||
* | SharedFieldTypeField(bit 21...23)
|
||||
* | SortedIndexField(bit 24...33)
|
||||
* | IsConstPropsField(bit 34)
|
||||
* | IsNotHoleField(bit 35)
|
||||
* -----------------------------
|
||||
* Slow | PropertyBoxTypeField(bit 8...9)
|
||||
* | DictionaryOrderField(bit 10...29)
|
||||
* | TrackTypeField(bit 30...32)
|
||||
* | SharedFieldTypeField(bit 30...32)
|
||||
*/
|
||||
class PropertyAttributes {
|
||||
public:
|
||||
@ -80,21 +87,24 @@ public:
|
||||
DEFAULT_NOEXCEPT_MOVE_SEMANTIC(PropertyAttributes);
|
||||
DEFAULT_COPY_SEMANTIC(PropertyAttributes);
|
||||
|
||||
explicit PropertyAttributes(uint32_t v) : value_(v) {}
|
||||
explicit PropertyAttributes(int32_t v) : value_(static_cast<uint32_t>(v)) {}
|
||||
explicit PropertyAttributes(JSTaggedValue v) : value_(v.GetInt()) {}
|
||||
explicit PropertyAttributes(uint64_t v) : value_(v) {}
|
||||
explicit PropertyAttributes(JSTaggedValue v) : value_(JSTaggedValue::UnwrapToUint64(v)) {}
|
||||
explicit PropertyAttributes(const PropertyDescriptor &desc);
|
||||
|
||||
static constexpr uint32_t DICTIONARY_ORDER_NUM = 20;
|
||||
static constexpr uint32_t OFFSET_BITFIELD_NUM = 10;
|
||||
static constexpr uint32_t REPRESENTATION_NUM = 2;
|
||||
static constexpr uint32_t TRACK_TYPE_NUM = 3;
|
||||
static constexpr uint32_t FIELD_TYPE_NUM = 3;
|
||||
static constexpr uint32_t MAX_FAST_PROPS_CAPACITY = (1U << OFFSET_BITFIELD_NUM) - 1;
|
||||
static constexpr unsigned BITS_PER_BYTE = 8;
|
||||
|
||||
using PropertyMetaDataField = BitField<int, 0, 4>; // 4: property metaData field occupies 4 bits
|
||||
using AttributesField = BitField<int, 0, 4>; // 4: attributes field occupies 4 bits
|
||||
using DefaultAttributesField = BitField<int, 0, 3>; // 3: default attributes field occupies 3 bits
|
||||
static constexpr uint32_t MAX_BIT_SIZE = 48;
|
||||
static constexpr int INITIAL_PROPERTY_INDEX = 0;
|
||||
|
||||
using PropertyMetaDataField = BitField<int32_t, 0, 4>; // 4: property metaData field occupies 4 bits
|
||||
using AttributesField = BitField<int32_t, 0, 4>; // 4: attributes field occupies 4 bits
|
||||
using DefaultAttributesField = BitField<int32_t, 0, 3>; // 3: default attributes field occupies 3 bits
|
||||
using WritableField = BitField<bool, 0, 1>; // 1: writable field occupies 1 bits
|
||||
using EnumerableField = WritableField::NextFlag;
|
||||
using ConfigurableField = EnumerableField::NextFlag;
|
||||
@ -113,14 +123,16 @@ public:
|
||||
using OffsetField = FastModeStartField::NextField<uint32_t, OFFSET_BITFIELD_NUM>; // 17
|
||||
using TrackTypeField = OffsetField::NextField<TrackType, TRACK_TYPE_NUM>; // 20: 3 bits
|
||||
|
||||
static constexpr uint32_t NORMAL_ATTR_BITS = 20;
|
||||
using NormalAttrField = BitField<int, 0, NORMAL_ATTR_BITS>;
|
||||
using SortedIndexField = TrackTypeField::NextField<uint32_t, OFFSET_BITFIELD_NUM>; // 30
|
||||
using IsConstPropsField = SortedIndexField::NextFlag; // 31
|
||||
using IsNotHoleField = IsConstPropsField::NextFlag; // 32
|
||||
// normal attr should include SharedFieldTypeField when set to layout
|
||||
static constexpr uint32_t NORMAL_ATTR_BITS = 23;
|
||||
using NormalAttrField = BitField<uint32_t, 0, NORMAL_ATTR_BITS>;
|
||||
using SharedFieldTypeField = TrackTypeField::NextField<SharedFieldType, FIELD_TYPE_NUM>; // 23: 3 bits
|
||||
using SortedIndexField = SharedFieldTypeField::NextField<uint32_t, OFFSET_BITFIELD_NUM>; // 33: 10 bits
|
||||
using IsConstPropsField = SortedIndexField::NextFlag; // 34
|
||||
using IsNotHoleField = IsConstPropsField::NextFlag; // 35
|
||||
using FastModeLastField = IsNotHoleField;
|
||||
static_assert(
|
||||
FastModeLastField::START_BIT + FastModeLastField::SIZE <= sizeof(uint32_t) * BITS_PER_BYTE, "Invalid");
|
||||
FastModeLastField::START_BIT + FastModeLastField::SIZE <= MAX_BIT_SIZE, "Invalid");
|
||||
|
||||
// ---------------------------------------------------------------------------------------------
|
||||
// only for dictionary mode, include global
|
||||
@ -129,15 +141,13 @@ public:
|
||||
static_assert(DictModeStartField::SIZE == CommonLastBitField::SIZE);
|
||||
using PropertyBoxTypeField = DictModeStartField::NextField<PropertyBoxType, 2>; // 2: 2 bits, 8-9
|
||||
using DictionaryOrderField = PropertyBoxTypeField::NextField<uint32_t, DICTIONARY_ORDER_NUM>; // 29
|
||||
using DictTrackTypeField = DictionaryOrderField::NextField<TrackType, TRACK_TYPE_NUM>;
|
||||
using DictModeLastField = DictTrackTypeField;
|
||||
using DictSharedFieldTypeField = DictionaryOrderField::NextField<SharedFieldType, FIELD_TYPE_NUM>;
|
||||
using DictModeLastField = DictSharedFieldTypeField;
|
||||
|
||||
static_assert(
|
||||
DictModeLastField::START_BIT + DictModeLastField::SIZE <= sizeof(uint32_t) * BITS_PER_BYTE, "Invalid");
|
||||
DictModeLastField::START_BIT + DictModeLastField::SIZE <= MAX_BIT_SIZE, "Invalid");
|
||||
|
||||
static constexpr uint32_t BIT_SIZE = 28;
|
||||
static constexpr int INITIAL_PROPERTY_INDEX = 0;
|
||||
|
||||
inline int GetPropertyMetaData() const
|
||||
inline int32_t GetPropertyMetaData() const
|
||||
{
|
||||
return PropertyMetaDataField::Get(value_);
|
||||
}
|
||||
@ -149,24 +159,24 @@ public:
|
||||
|
||||
static PropertyAttributes Default(bool w, bool e, bool c, bool isAccessor = false)
|
||||
{
|
||||
uint32_t value = WritableField::Encode(w) | EnumerableField::Encode(e) | ConfigurableField::Encode(c) |
|
||||
uint64_t value = WritableField::Encode(w) | EnumerableField::Encode(e) | ConfigurableField::Encode(c) |
|
||||
IsAccessorField::Encode(isAccessor);
|
||||
return PropertyAttributes(value);
|
||||
}
|
||||
|
||||
static PropertyAttributes DefaultAccessor(bool w, bool e, bool c)
|
||||
{
|
||||
uint32_t value = WritableField::Encode(w) | EnumerableField::Encode(e) | ConfigurableField::Encode(c) |
|
||||
uint64_t value = WritableField::Encode(w) | EnumerableField::Encode(e) | ConfigurableField::Encode(c) |
|
||||
IsAccessorField::Encode(true);
|
||||
return PropertyAttributes(value);
|
||||
}
|
||||
|
||||
inline void SetDefaultAttributes()
|
||||
{
|
||||
AttributesField::Set<uint32_t>(DefaultAttributesField::Mask(), &value_);
|
||||
AttributesField::Set<uint64_t>(DefaultAttributesField::Mask(), &value_);
|
||||
}
|
||||
|
||||
static inline int GetDefaultAttributes()
|
||||
static inline int32_t GetDefaultAttributes()
|
||||
{
|
||||
return DefaultAttributesField::Mask();
|
||||
}
|
||||
@ -194,12 +204,12 @@ public:
|
||||
|
||||
inline bool IsDefaultAttributes() const
|
||||
{
|
||||
return AttributesField::Get(value_) == static_cast<int>(DefaultAttributesField::Mask());
|
||||
return AttributesField::Get(value_) == static_cast<int32_t>(DefaultAttributesField::Mask());
|
||||
}
|
||||
|
||||
inline void SetNoneAttributes()
|
||||
{
|
||||
AttributesField::Set<uint32_t>(0U, &value_);
|
||||
AttributesField::Set<uint64_t>(0U, &value_);
|
||||
}
|
||||
|
||||
inline bool IsNoneAttributes() const
|
||||
@ -209,7 +219,7 @@ public:
|
||||
|
||||
inline void SetWritable(bool flag)
|
||||
{
|
||||
WritableField::Set<uint32_t>(flag, &value_);
|
||||
WritableField::Set<uint64_t>(flag, &value_);
|
||||
}
|
||||
inline bool IsWritable() const
|
||||
{
|
||||
@ -217,7 +227,7 @@ public:
|
||||
}
|
||||
inline void SetEnumerable(bool flag)
|
||||
{
|
||||
EnumerableField::Set<uint32_t>(flag, &value_);
|
||||
EnumerableField::Set<uint64_t>(flag, &value_);
|
||||
}
|
||||
inline bool IsEnumerable() const
|
||||
{
|
||||
@ -225,7 +235,7 @@ public:
|
||||
}
|
||||
inline void SetConfigurable(bool flag)
|
||||
{
|
||||
ConfigurableField::Set<uint32_t>(flag, &value_);
|
||||
ConfigurableField::Set<uint64_t>(flag, &value_);
|
||||
}
|
||||
inline bool IsConfigurable() const
|
||||
{
|
||||
@ -234,7 +244,7 @@ public:
|
||||
|
||||
inline void SetIsAccessor(bool flag)
|
||||
{
|
||||
IsAccessorField::Set<uint32_t>(flag, &value_);
|
||||
IsAccessorField::Set<uint64_t>(flag, &value_);
|
||||
}
|
||||
|
||||
inline bool IsAccessor() const
|
||||
@ -244,7 +254,7 @@ public:
|
||||
|
||||
inline void SetIsInlinedProps(bool flag)
|
||||
{
|
||||
IsInlinedPropsField::Set<uint32_t>(flag, &value_);
|
||||
IsInlinedPropsField::Set<uint64_t>(flag, &value_);
|
||||
}
|
||||
|
||||
inline bool IsInlinedProps() const
|
||||
@ -254,7 +264,7 @@ public:
|
||||
|
||||
inline void SetIsConstProps(bool flag)
|
||||
{
|
||||
IsConstPropsField::Set<uint32_t>(flag, &value_);
|
||||
IsConstPropsField::Set<uint64_t>(flag, &value_);
|
||||
}
|
||||
|
||||
inline bool IsConstProps() const
|
||||
@ -264,7 +274,7 @@ public:
|
||||
|
||||
inline void SetIsNotHole(bool flag)
|
||||
{
|
||||
IsNotHoleField::Set<uint32_t>(flag, &value_);
|
||||
IsNotHoleField::Set<uint64_t>(flag, &value_);
|
||||
}
|
||||
|
||||
inline bool IsNotHole() const
|
||||
@ -291,7 +301,7 @@ public:
|
||||
|
||||
inline void SetRepresentation(Representation representation)
|
||||
{
|
||||
RepresentationField::Set<uint32_t>(representation, &value_);
|
||||
RepresentationField::Set<uint64_t>(representation, &value_);
|
||||
}
|
||||
|
||||
inline Representation GetRepresentation() const
|
||||
@ -306,22 +316,32 @@ public:
|
||||
|
||||
inline void SetTrackType(TrackType type)
|
||||
{
|
||||
TrackTypeField::Set(type, &value_);
|
||||
TrackTypeField::Set<uint64_t>(type, &value_);
|
||||
}
|
||||
|
||||
inline void SetDictTrackType(TrackType type)
|
||||
inline SharedFieldType GetSharedFieldType() const
|
||||
{
|
||||
DictTrackTypeField::Set(type, &value_);
|
||||
return SharedFieldTypeField::Get(value_);
|
||||
}
|
||||
|
||||
inline TrackType GetDictTrackType() const
|
||||
inline void SetSharedFieldType(SharedFieldType fieldType)
|
||||
{
|
||||
return DictTrackTypeField::Get(value_);
|
||||
SharedFieldTypeField::Set<uint64_t>(fieldType, &value_);
|
||||
}
|
||||
|
||||
inline void SetDictSharedFieldType(SharedFieldType fieldType)
|
||||
{
|
||||
DictSharedFieldTypeField::Set<uint64_t>(fieldType, &value_);
|
||||
}
|
||||
|
||||
inline SharedFieldType GetDictSharedFieldType() const
|
||||
{
|
||||
return DictSharedFieldTypeField::Get(value_);
|
||||
}
|
||||
|
||||
inline void SetDictionaryOrder(uint32_t order)
|
||||
{
|
||||
DictionaryOrderField::Set<uint32_t>(order, &value_);
|
||||
DictionaryOrderField::Set<uint64_t>(order, &value_);
|
||||
}
|
||||
inline uint32_t GetDictionaryOrder() const
|
||||
{
|
||||
@ -330,8 +350,9 @@ public:
|
||||
|
||||
inline void SetOffset(uint32_t offset)
|
||||
{
|
||||
OffsetField::Set<uint32_t>(offset, &value_);
|
||||
OffsetField::Set<uint64_t>(offset, &value_);
|
||||
}
|
||||
|
||||
inline uint32_t GetOffset() const
|
||||
{
|
||||
return OffsetField::Get(value_);
|
||||
@ -339,7 +360,7 @@ public:
|
||||
|
||||
inline void SetSortedIndex(uint32_t sortedIndex)
|
||||
{
|
||||
SortedIndexField::Set<uint32_t>(sortedIndex, &value_);
|
||||
SortedIndexField::Set<uint64_t>(sortedIndex, &value_);
|
||||
}
|
||||
inline uint32_t GetSortedIndex() const
|
||||
{
|
||||
@ -348,7 +369,7 @@ public:
|
||||
|
||||
inline void SetNormalAttr(uint32_t normalAttr)
|
||||
{
|
||||
NormalAttrField::Set<uint32_t>(normalAttr, &value_);
|
||||
NormalAttrField::Set<uint64_t>(normalAttr, &value_);
|
||||
}
|
||||
|
||||
inline uint32_t GetNormalAttr() const
|
||||
@ -358,17 +379,17 @@ public:
|
||||
|
||||
inline JSTaggedValue GetNormalTagged() const
|
||||
{
|
||||
return JSTaggedValue(static_cast<int>(GetNormalAttr()));
|
||||
return JSTaggedValue::WrapUint64(GetNormalAttr());
|
||||
}
|
||||
|
||||
inline uint32_t GetValue() const
|
||||
inline uint64_t GetValue() const
|
||||
{
|
||||
return value_;
|
||||
}
|
||||
|
||||
inline void SetBoxType(PropertyBoxType cellType)
|
||||
{
|
||||
PropertyBoxTypeField::Set<uint32_t>(cellType, &value_);
|
||||
PropertyBoxTypeField::Set<uint64_t>(cellType, &value_);
|
||||
}
|
||||
|
||||
inline PropertyBoxType GetBoxType() const
|
||||
@ -383,11 +404,11 @@ public:
|
||||
|
||||
inline JSTaggedValue GetTaggedValue() const
|
||||
{
|
||||
return JSTaggedValue(static_cast<int>(value_));
|
||||
return JSTaggedValue::WrapUint64(value_);
|
||||
}
|
||||
|
||||
private:
|
||||
uint32_t value_{0};
|
||||
uint64_t value_{0};
|
||||
};
|
||||
} // namespace panda::ecmascript
|
||||
#endif // ECMASCRIPT_PROPERTY_ATTRIBUTES_H
|
||||
|
@ -112,9 +112,9 @@ DEF_RUNTIME_STUBS(AddElementInternal)
|
||||
JSHandle<JSObject> receiver = GetHArg<JSObject>(argv, argc, 0); // 0: means the zeroth parameter
|
||||
JSTaggedValue argIndex = GetArg(argv, argc, 1); // 1: means the first parameter
|
||||
JSHandle<JSTaggedValue> value = GetHArg<JSTaggedValue>(argv, argc, 2); // 2: means the second parameter
|
||||
JSTaggedValue argAttr = GetArg(argv, argc, 3); // 3: means the third parameter
|
||||
auto attr = static_cast<PropertyAttributes>(argAttr.GetInt());
|
||||
auto result = JSObject::AddElementInternal(thread, receiver, argIndex.GetInt(), value, attr);
|
||||
JSTaggedValue attr = GetArg(argv, argc, 3); // 3: means the third parameter
|
||||
PropertyAttributes attrValue(attr);
|
||||
auto result = JSObject::AddElementInternal(thread, receiver, argIndex.GetInt(), value, attrValue);
|
||||
return JSTaggedValue(result).GetRawData();
|
||||
}
|
||||
|
||||
@ -317,7 +317,7 @@ DEF_RUNTIME_STUBS(NameDictPutIfAbsent)
|
||||
JSTaggedValue attr = GetArg(argv, argc, 4); // 4: means the fourth parameter
|
||||
JSTaggedValue needTransToDict = GetArg(argv, argc, 5); // 5: means the fifth parameter
|
||||
|
||||
PropertyAttributes propAttr(attr.GetInt());
|
||||
PropertyAttributes propAttr(attr);
|
||||
if (needTransToDict.IsTrue()) {
|
||||
JSHandle<JSObject> objHandle(thread, JSTaggedValue(reinterpret_cast<TaggedObject *>(receiver)));
|
||||
JSHandle<NameDictionary> dictHandle(JSObject::TransitionToDictionary(thread, objHandle));
|
||||
@ -341,7 +341,7 @@ DEF_RUNTIME_STUBS(NumberDictionaryPut)
|
||||
JSTaggedValue needTransToDict = GetArg(argv, argc, 5); // 5: means the fifth parameter
|
||||
|
||||
JSHandle<JSTaggedValue> keyHandle(thread, key);
|
||||
PropertyAttributes propAttr(attr.GetInt());
|
||||
PropertyAttributes propAttr(attr);
|
||||
JSHandle<JSObject> objHandle(thread, JSTaggedValue(reinterpret_cast<TaggedObject *>(receiver)));
|
||||
if (needTransToDict.IsTrue()) {
|
||||
JSObject::ElementsToDictionary(thread, objHandle);
|
||||
@ -481,7 +481,7 @@ DEF_RUNTIME_STUBS(UpdateLayOutAndAddTransition)
|
||||
JSHandle<JSTaggedValue> keyHandle = GetHArg<JSTaggedValue>(argv, argc, 2); // 2: means the second parameter
|
||||
JSTaggedValue attr = GetArg(argv, argc, 3); // 3: means the third parameter
|
||||
|
||||
PropertyAttributes attrValue(attr.GetInt());
|
||||
PropertyAttributes attrValue(attr);
|
||||
|
||||
JSHClass::AddPropertyToNewHClass(thread, oldHClassHandle, newHClassHandle, keyHandle, attrValue);
|
||||
|
||||
@ -499,7 +499,7 @@ DEF_RUNTIME_STUBS(CopyAndUpdateObjLayout)
|
||||
JSTaggedValue attr = GetArg(argv, argc, 3); // 3: means the third parameter
|
||||
|
||||
auto factory = thread->GetEcmaVM()->GetFactory();
|
||||
PropertyAttributes attrValue(attr.GetInt());
|
||||
PropertyAttributes attrValue(attr);
|
||||
|
||||
// 1. Copy
|
||||
JSHandle<LayoutInfo> oldLayout(thread, newHClassHandle->GetLayout());
|
||||
|
@ -201,7 +201,7 @@ JSHandle<NameDictionary> NameDictionary::CreateInSharedHeap(const JSThread *thre
|
||||
PropertyAttributes NameDictionary::GetAttributes(int entry) const
|
||||
{
|
||||
int index = GetEntryIndex(entry) + ENTRY_DETAILS_INDEX;
|
||||
return PropertyAttributes(Get(index).GetInt());
|
||||
return PropertyAttributes(Get(index));
|
||||
}
|
||||
|
||||
void NameDictionary::SetAttributes(const JSThread *thread, int entry, const PropertyAttributes &metaData)
|
||||
@ -377,7 +377,7 @@ JSHandle<NumberDictionary> NumberDictionary::Create(const JSThread *thread, int
|
||||
PropertyAttributes NumberDictionary::GetAttributes(int entry) const
|
||||
{
|
||||
int index = GetEntryIndex(entry) + ENTRY_DETAILS_INDEX;
|
||||
return PropertyAttributes(Get(index).GetInt());
|
||||
return PropertyAttributes(Get(index));
|
||||
}
|
||||
|
||||
void NumberDictionary::SetAttributes(const JSThread *thread, int entry, const PropertyAttributes &metaData)
|
||||
|
@ -450,7 +450,7 @@ public:
|
||||
PropertyAttributes attr(metaData);
|
||||
attr.SetDictionaryOrder(enumIndex);
|
||||
attr.SetRepresentation(Representation::TAGGED);
|
||||
attr.SetDictTrackType(metaData.GetTrackType());
|
||||
attr.SetDictSharedFieldType(metaData.GetSharedFieldType());
|
||||
int entry = table->FindEntry(key.GetTaggedValue());
|
||||
if (entry != -1) {
|
||||
table->SetEntry(thread, entry, key.GetTaggedValue(), value.GetTaggedValue(), attr);
|
||||
|
@ -17,12 +17,16 @@ Start testUpdateInstancePropsToNull
|
||||
Success update propString to null with stobjbyname
|
||||
Success update subClassPropSendable to null with stobjbyname
|
||||
Fail to update propNumber to null with stobjbyname. err: TypeError: Cannot set sendable property with mismatched type
|
||||
Fail to update propNumber to null with stobjbyname. err: TypeError: Cannot set sendable property with mismatched type
|
||||
Fail to update propBool to null with stobjbyname. err: TypeError: Cannot set sendable property with mismatched type
|
||||
Fail to update propBigInt1 to null with stobjbyname. err: TypeError: Cannot set sendable property with mismatched type
|
||||
Fail to update propBigInt2 to null with stobjbyname. err: TypeError: Cannot set sendable property with mismatched type
|
||||
Start testUpdateInstancePropsToUndefined
|
||||
Fail to update propString to undefined with stobjbyname. err: TypeError: Cannot set sendable property with mismatched type
|
||||
Fail to update subClassPropSendable to undefined with stobjbyname. err: TypeError: Cannot set sendable property with mismatched type
|
||||
Fail to update propNumber to undefined with stobjbyname. err: TypeError: Cannot set sendable property with mismatched type
|
||||
Fail to update propNumber to undefined with stobjbyname. err: TypeError: Cannot set sendable property with mismatched type
|
||||
Fail to update propBool to undefined with stobjbyname. err: TypeError: Cannot set sendable property with mismatched type
|
||||
Fail to update propBigInt1 to undefined with stobjbyname. err: TypeError: Cannot set sendable property with mismatched type
|
||||
Fail to update propBigInt2 to undefined with stobjbyname. err: TypeError: Cannot set sendable property with mismatched type
|
||||
Success update subClassPropString with defineProperties
|
||||
Success update propNumber with defineProperty
|
||||
Fail to update subClassPropString with stobjbyname. err: TypeError: Cannot set sendable property with mismatched type
|
||||
@ -68,6 +72,8 @@ isExtensible: false
|
||||
Success to call Object.preventExtensions in preventExtensions state.
|
||||
Start testUpdateWithType
|
||||
Fail to update string to int with stobjbynamme. err: TypeError: Cannot set sendable property with mismatched type
|
||||
Fail to update bigInt to int with stobjbynamme. err: TypeError: Cannot set sendable property with mismatched type
|
||||
Success update bigInt to bigInt with stobjbynamme.
|
||||
Fail to update subClassPropSendable to number with defineProperty. err: TypeError: Cannot set sendable property with mismatched type
|
||||
I'm constructor for SimpleNumberSendable
|
||||
Success update subClassPropSendable to numberSendable with defineProperty.
|
||||
|
@ -66,6 +66,8 @@ class SuperClass {
|
||||
propString: string = "I'm propString"
|
||||
propNumber: number = 5
|
||||
propBool: boolean = false
|
||||
propBigInt1: bigint = BigInt(12345678910)
|
||||
propBigInt2: BigInt = BigInt(987654321)
|
||||
static staticPropString: string = "I'm staticPropString";
|
||||
publicPropString: string = "I'm privatePropString";
|
||||
|
||||
@ -223,9 +225,23 @@ function testUpdateInstancePropsToNull(testObj: SubClass) {
|
||||
|
||||
try {
|
||||
testObj.propBool = null
|
||||
print("Success update propNumber to null with stobjbyname")
|
||||
print("Success update propBool to null with stobjbyname")
|
||||
} catch (error) {
|
||||
print("Fail to update propNumber to null with stobjbyname. err: " + error)
|
||||
print("Fail to update propBool to null with stobjbyname. err: " + error)
|
||||
}
|
||||
|
||||
try {
|
||||
testObj.propBigInt1 = null
|
||||
print("Success update propBigInt1 to null with stobjbyname")
|
||||
} catch (error) {
|
||||
print("Fail to update propBigInt1 to null with stobjbyname. err: " + error)
|
||||
}
|
||||
|
||||
try {
|
||||
testObj.propBigInt2 = null
|
||||
print("Success update propBigInt2 to null with stobjbyname")
|
||||
} catch (error) {
|
||||
print("Fail to update propBigInt2 to null with stobjbyname. err: " + error)
|
||||
}
|
||||
}
|
||||
|
||||
@ -254,9 +270,23 @@ function testUpdateInstancePropsToUndefined(testObj: SubClass) {
|
||||
|
||||
try {
|
||||
testObj.propBool = undefined
|
||||
print("Success update propNumber to undefined with stobjbyname")
|
||||
print("Success update propBool to undefined with stobjbyname")
|
||||
} catch (error) {
|
||||
print("Fail to update propNumber to undefined with stobjbyname. err: " + error)
|
||||
print("Fail to update propBool to undefined with stobjbyname. err: " + error)
|
||||
}
|
||||
|
||||
try {
|
||||
testObj.propBigInt1 = undefined
|
||||
print("Success update propBigInt1 to undefined with stobjbyname")
|
||||
} catch (error) {
|
||||
print("Fail to update propBigInt1 to undefined with stobjbyname. err: " + error)
|
||||
}
|
||||
|
||||
try {
|
||||
testObj.propBigInt2 = undefined
|
||||
print("Success update propBigInt2 to undefined with stobjbyname")
|
||||
} catch (error) {
|
||||
print("Fail to update propBigInt2 to undefined with stobjbyname. err: " + error)
|
||||
}
|
||||
}
|
||||
|
||||
@ -444,6 +474,20 @@ function testUpdateWithType(testObj: SubClass) {
|
||||
print("Fail to update string to int with stobjbynamme. err: " + error);
|
||||
}
|
||||
|
||||
try {
|
||||
testObj.propBigInt1 = 1;
|
||||
print("Success update bigInt to int with stobjbynamme.")
|
||||
} catch (error) {
|
||||
print("Fail to update bigInt to int with stobjbynamme. err: " + error);
|
||||
}
|
||||
|
||||
try {
|
||||
testObj.propBigInt2 = BigInt(123456789);
|
||||
print("Success update bigInt to bigInt with stobjbynamme.")
|
||||
} catch (error) {
|
||||
print("Fail to update bigInt to int with stobjbynamme. err: " + error);
|
||||
}
|
||||
|
||||
try {
|
||||
Object.defineProperty(testObj, "subClassPropSendable", { value: 123, writable: true });
|
||||
print("Success update subClassPropSendable to number with defineProperty.")
|
||||
|
Loading…
Reference in New Issue
Block a user