mirror of
https://gitee.com/openharmony/arkcompiler_ets_runtime
synced 2024-11-26 19:50:55 +00:00
Tidy AOT code
Issue: https://gitee.com/openharmony/arkcompiler_ets_runtime/issues/IB398K Signed-off-by: xwcai98 <caixinwei5@huawei.com> Change-Id: I520437b0707e7bc02334d4eba9b02971893dafba
This commit is contained in:
parent
e38204de36
commit
4c5b4a1e77
@ -122,8 +122,8 @@ JSTaggedValue BuiltinsArkTools::IsTSHClass(EcmaRuntimeCallInfo *info)
|
||||
ASSERT(info->GetArgsNumber() == 1);
|
||||
JSHandle<JSTaggedValue> object = GetCallArg(info, 0);
|
||||
JSHClass *hclass = object->GetTaggedObject()->GetClass();
|
||||
bool isTSHClass = hclass->IsTS();
|
||||
return GetTaggedBoolean(isTSHClass);
|
||||
bool isAOTHClass = hclass->IsAOT();
|
||||
return GetTaggedBoolean(isAOTHClass);
|
||||
}
|
||||
|
||||
JSTaggedValue BuiltinsArkTools::GetHClass(EcmaRuntimeCallInfo *info)
|
||||
|
@ -177,7 +177,7 @@ public:
|
||||
|
||||
static JSTaggedValue DumpHClass(EcmaRuntimeCallInfo *info);
|
||||
|
||||
// return whether the hclass used for object is created by static ts type
|
||||
// return whether the hclass used for object is created by AOT
|
||||
static JSTaggedValue IsTSHClass(EcmaRuntimeCallInfo *info);
|
||||
|
||||
static JSTaggedValue GetHClass(EcmaRuntimeCallInfo *info);
|
||||
|
@ -760,7 +760,7 @@ void BuiltinsObjectStubBuilder::HasOwnProperty(Variable *result, Label *exit, La
|
||||
}
|
||||
}
|
||||
|
||||
GateRef BuiltinsObjectStubBuilder::GetNumKeysFromLayoutInfo(GateRef object, GateRef end, GateRef layoutInfo)
|
||||
GateRef BuiltinsObjectStubBuilder::GetNumKeysFromLayoutInfo(GateRef end, GateRef layoutInfo)
|
||||
{
|
||||
auto env = GetEnvironment();
|
||||
Label entry(env);
|
||||
@ -773,7 +773,6 @@ GateRef BuiltinsObjectStubBuilder::GetNumKeysFromLayoutInfo(GateRef object, Gate
|
||||
Label loopEnd(env);
|
||||
Label iLessEnd(env);
|
||||
Label isString(env);
|
||||
Label initializedProp(env);
|
||||
Label isEnumerable(env);
|
||||
Jump(&loopHead);
|
||||
LoopBegin(&loopHead);
|
||||
@ -784,8 +783,6 @@ GateRef BuiltinsObjectStubBuilder::GetNumKeysFromLayoutInfo(GateRef object, Gate
|
||||
GateRef key = GetKey(layoutInfo, *i);
|
||||
BRANCH(TaggedIsString(key), &isString, &loopEnd);
|
||||
Bind(&isString);
|
||||
BRANCH(IsUninitializedProperty(object, *i, layoutInfo), &loopEnd, &initializedProp);
|
||||
Bind(&initializedProp);
|
||||
BRANCH(IsEnumerable(GetAttr(layoutInfo, *i)), &isEnumerable, &loopEnd);
|
||||
Bind(&isEnumerable);
|
||||
result = Int32Add(*result, Int32(1));
|
||||
@ -801,52 +798,6 @@ GateRef BuiltinsObjectStubBuilder::GetNumKeysFromLayoutInfo(GateRef object, Gate
|
||||
return ret;
|
||||
}
|
||||
|
||||
GateRef BuiltinsObjectStubBuilder::IsUninitializedProperty(GateRef object, GateRef index, GateRef layoutInfo)
|
||||
{
|
||||
auto env = GetEnvironment();
|
||||
Label entry(env);
|
||||
env->SubCfgEntry(&entry);
|
||||
Label exit(env);
|
||||
DEFVARIABLE(value, VariableType::JS_ANY(), Undefined());
|
||||
DEFVARIABLE(result, VariableType::BOOL(), False());
|
||||
|
||||
Label inlinedProp(env);
|
||||
GateRef attr = GetAttr(layoutInfo, index);
|
||||
GateRef rep = GetRepInPropAttr(attr);
|
||||
GateRef hclass = LoadHClass(object);
|
||||
BRANCH(IsInlinedProperty(attr), &inlinedProp, &exit);
|
||||
Bind(&inlinedProp);
|
||||
{
|
||||
value = GetPropertyInlinedProps(object, hclass, index);
|
||||
result = TaggedIsHole(*value);
|
||||
Label nonDoubleToTagged(env);
|
||||
Label doubleToTagged(env);
|
||||
BRANCH(IsDoubleRepInPropAttr(rep), &doubleToTagged, &nonDoubleToTagged);
|
||||
Bind(&doubleToTagged);
|
||||
{
|
||||
value = TaggedPtrToTaggedDoublePtr(*value);
|
||||
result = TaggedIsHole(*value);
|
||||
Jump(&exit);
|
||||
}
|
||||
Bind(&nonDoubleToTagged);
|
||||
{
|
||||
Label intToTagged(env);
|
||||
BRANCH(IsIntRepInPropAttr(rep), &intToTagged, &exit);
|
||||
Bind(&intToTagged);
|
||||
{
|
||||
value = TaggedPtrToTaggedIntPtr(*value);
|
||||
result = TaggedIsHole(*value);
|
||||
Jump(&exit);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Bind(&exit);
|
||||
auto ret = *result;
|
||||
env->SubCfgExit();
|
||||
return ret;
|
||||
}
|
||||
|
||||
GateRef BuiltinsObjectStubBuilder::GetNumKeysFromDictionary(GateRef array)
|
||||
{
|
||||
auto env = GetEnvironment();
|
||||
@ -864,7 +815,6 @@ GateRef BuiltinsObjectStubBuilder::GetNumKeysFromDictionary(GateRef array)
|
||||
Label afterLoop(env);
|
||||
Label iLessSize(env);
|
||||
Label isString(env);
|
||||
Label initializedProp(env);
|
||||
Label isEnumerable(env);
|
||||
|
||||
Jump(&loopHead);
|
||||
@ -895,8 +845,7 @@ GateRef BuiltinsObjectStubBuilder::GetNumKeysFromDictionary(GateRef array)
|
||||
return ret;
|
||||
}
|
||||
|
||||
void BuiltinsObjectStubBuilder::LayoutInfoGetAllEnumKeys(GateRef end, GateRef offset,
|
||||
GateRef array, GateRef object, GateRef layoutInfo)
|
||||
void BuiltinsObjectStubBuilder::LayoutInfoGetAllEnumKeys(GateRef end, GateRef offset, GateRef array, GateRef layoutInfo)
|
||||
{
|
||||
auto env = GetEnvironment();
|
||||
Label entry(env);
|
||||
@ -909,7 +858,6 @@ void BuiltinsObjectStubBuilder::LayoutInfoGetAllEnumKeys(GateRef end, GateRef of
|
||||
Label afterLoop(env);
|
||||
Label iLessEnd(env);
|
||||
Label isEnumerable(env);
|
||||
Label initializedProp(env);
|
||||
Jump(&loopHead);
|
||||
LoopBegin(&loopHead);
|
||||
{
|
||||
@ -921,8 +869,6 @@ void BuiltinsObjectStubBuilder::LayoutInfoGetAllEnumKeys(GateRef end, GateRef of
|
||||
BRANCH(LogicAndBuilder(env).And(TaggedIsString(key)).And(IsEnumerable(GetAttr(layoutInfo, iVal))).Done(),
|
||||
&isEnumerable, &loopEnd);
|
||||
Bind(&isEnumerable);
|
||||
BRANCH(IsUninitializedProperty(object, *i, layoutInfo), &loopEnd, &initializedProp);
|
||||
Bind(&initializedProp);
|
||||
SetValueToTaggedArray(VariableType::JS_ANY(), glue_, array, Int32Add(*enumKeys, offset), key);
|
||||
enumKeys = Int32Add(*enumKeys, Int32(1));
|
||||
Jump(&loopEnd);
|
||||
@ -1036,7 +982,7 @@ GateRef BuiltinsObjectStubBuilder::GetAllEnumKeys(GateRef glue, GateRef obj)
|
||||
Label isOnlyOwnKeys(env);
|
||||
Label notOnlyOwnKeys(env);
|
||||
GateRef layout = GetLayoutFromHClass(hclass);
|
||||
GateRef numOfKeys = GetNumKeysFromLayoutInfo(obj, num, layout);
|
||||
GateRef numOfKeys = GetNumKeysFromLayoutInfo(num, layout);
|
||||
// JSObject::GetAllEnumKeys
|
||||
GateRef enumCache = GetEnumCacheFromHClass(hclass);
|
||||
GateRef kind = GetEnumCacheKind(glue, enumCache);
|
||||
@ -1057,7 +1003,7 @@ GateRef BuiltinsObjectStubBuilder::GetAllEnumKeys(GateRef glue, GateRef obj)
|
||||
NewObjectStubBuilder newBuilder(this);
|
||||
GateRef keyArray = newBuilder.NewTaggedArray(glue,
|
||||
Int32Add(numOfKeys, Int32(static_cast<int32_t>(EnumCache::ENUM_CACHE_HEADER_SIZE))));
|
||||
LayoutInfoGetAllEnumKeys(num, Int32(EnumCache::ENUM_CACHE_HEADER_SIZE), keyArray, obj, layout);
|
||||
LayoutInfoGetAllEnumKeys(num, Int32(EnumCache::ENUM_CACHE_HEADER_SIZE), keyArray, layout);
|
||||
SetValueToTaggedArray(VariableType::JS_ANY(), glue, keyArray,
|
||||
Int32(EnumCache::ENUM_CACHE_KIND_OFFSET),
|
||||
IntToTaggedInt(Int32(static_cast<int32_t>(EnumCacheKind::ONLY_OWN_KEYS))));
|
||||
@ -1814,15 +1760,10 @@ GateRef BuiltinsObjectStubBuilder::GetAllPropertyKeys(GateRef glue, GateRef obj,
|
||||
BRANCH(Int32UnsignedLessThan(*i, number), &next, &loopExit);
|
||||
Bind(&next);
|
||||
{
|
||||
Label checkString(env);
|
||||
Label checkSymbol(env);
|
||||
Label setValue(env);
|
||||
GateRef key = GetKey(layout, *i);
|
||||
BRANCH(TaggedIsString(key), &checkString, &checkSymbol);
|
||||
Bind(&checkString);
|
||||
{
|
||||
BRANCH(IsUninitializedProperty(obj, *i, layout), &checkSymbol, &setValue);
|
||||
}
|
||||
BRANCH(TaggedIsString(key), &setValue, &checkSymbol);
|
||||
Bind(&checkSymbol);
|
||||
{
|
||||
BRANCH(TaggedIsSymbol(key), &setValue, &loopEnd);
|
||||
|
@ -42,8 +42,7 @@ BUILTINS_WITH_OBJECT_STUB_BUILDER(DECLARE_BUILTINS_OBJECT_STUB_BUILDER)
|
||||
GateRef hir = Circuit::NullGate());
|
||||
|
||||
private:
|
||||
GateRef GetNumKeysFromLayoutInfo(GateRef object, GateRef end, GateRef layoutInfo);
|
||||
GateRef IsUninitializedProperty(GateRef object, GateRef index, GateRef layoutInfo);
|
||||
GateRef GetNumKeysFromLayoutInfo(GateRef end, GateRef layoutInfo);
|
||||
GateRef GetNumKeysFromDictionary(GateRef array);
|
||||
GateRef CopyFromEnumCache(GateRef glue, GateRef elements);
|
||||
GateRef GetAllEnumKeys(GateRef glue, GateRef obj);
|
||||
@ -55,7 +54,7 @@ private:
|
||||
GateRef TestIntegrityLevel(GateRef glue, GateRef obj, GateRef level, Label *slowPath);
|
||||
GateRef ObjectSetPrototype(GateRef glue, GateRef obj, GateRef proto);
|
||||
GateRef IsNotSlowObjectKey(GateRef obj);
|
||||
void LayoutInfoGetAllEnumKeys(GateRef end, GateRef offset, GateRef array, GateRef object, GateRef layoutInfo);
|
||||
void LayoutInfoGetAllEnumKeys(GateRef end, GateRef offset, GateRef array, GateRef layoutInfo);
|
||||
void AssignEnumElementProperty(Variable *res, Label *funcExit, GateRef toAssign, GateRef source);
|
||||
void LayoutInfoAssignAllEnumProperty(Variable *res, Label *funcExit, GateRef toAssign, GateRef source);
|
||||
void NameDictionaryAssignAllEnumProperty(Variable *res, Label *funcExit, GateRef toAssign, GateRef source,
|
||||
|
@ -705,7 +705,7 @@ public:
|
||||
inline GateRef TaggedIsWeak(GateRef x);
|
||||
inline GateRef TaggedIsPrototypeHandler(GateRef x);
|
||||
inline GateRef TaggedIsTransitionHandler(GateRef x);
|
||||
inline GateRef TaggedIsStoreTSHandler(GateRef x);
|
||||
inline GateRef TaggedIsStoreAOTHandler(GateRef x);
|
||||
inline GateRef TaggedIsTransWithProtoHandler(GateRef x);
|
||||
inline GateRef TaggedIsUndefinedOrNull(GateRef x);
|
||||
inline GateRef TaggedIsUndefinedOrNullOrHole(GateRef x);
|
||||
|
@ -437,7 +437,7 @@ GateRef CircuitBuilder::TaggedIsTransitionHandler(GateRef x)
|
||||
return LogicAndBuilder(env_).And(TaggedIsHeapObject(x)).And(IsJsType(x, JSType::TRANSITION_HANDLER)).Done();
|
||||
}
|
||||
|
||||
GateRef CircuitBuilder::TaggedIsStoreTSHandler(GateRef x)
|
||||
GateRef CircuitBuilder::TaggedIsStoreAOTHandler(GateRef x)
|
||||
{
|
||||
return LogicAndBuilder(env_).And(TaggedIsHeapObject(x)).And(IsJsType(x, JSType::STORE_TS_HANDLER)).Done();
|
||||
}
|
||||
|
@ -431,10 +431,10 @@ void NewObjectStubBuilder::NewJSObject(Variable *result, Label *exit, GateRef hc
|
||||
{
|
||||
StoreHClass(glue_, result->ReadVariable(), hclass);
|
||||
DEFVARIABLE(initValue, VariableType::JS_ANY(), Undefined());
|
||||
Label isTS(env);
|
||||
Label isAOT(env);
|
||||
Label initialize(env);
|
||||
BRANCH(IsTSHClass(hclass), &isTS, &initialize);
|
||||
Bind(&isTS);
|
||||
BRANCH(IsAOTHClass(hclass), &isAOT, &initialize);
|
||||
Bind(&isAOT);
|
||||
{
|
||||
// The object which created by AOT speculative hclass, should be initialized as hole, means does not exist,
|
||||
// to follow ECMA spec.
|
||||
@ -474,10 +474,10 @@ void NewObjectStubBuilder::NewSObject(Variable *result, Label *exit, GateRef hcl
|
||||
{
|
||||
StoreHClass(glue_, result->ReadVariable(), hclass);
|
||||
DEFVARIABLE(initValue, VariableType::JS_ANY(), Undefined());
|
||||
Label isTS(env);
|
||||
Label isAOT(env);
|
||||
Label initialize(env);
|
||||
BRANCH(IsTSHClass(hclass), &isTS, &initialize);
|
||||
Bind(&isTS);
|
||||
BRANCH(IsAOTHClass(hclass), &isAOT, &initialize);
|
||||
Bind(&isAOT);
|
||||
{
|
||||
// The object which created by AOT speculative hclass, should be initialized as hole, means does not exist,
|
||||
// to follow ECMA spec.
|
||||
|
@ -785,9 +785,9 @@ inline GateRef StubBuilder::TaggedIsPrototypeHandler(GateRef x)
|
||||
return env_->GetBuilder()->TaggedIsPrototypeHandler(x);
|
||||
}
|
||||
|
||||
inline GateRef StubBuilder::TaggedIsStoreTSHandler(GateRef x)
|
||||
inline GateRef StubBuilder::TaggedIsStoreAOTHandler(GateRef x)
|
||||
{
|
||||
return env_->GetBuilder()->TaggedIsStoreTSHandler(x);
|
||||
return env_->GetBuilder()->TaggedIsStoreAOTHandler(x);
|
||||
}
|
||||
|
||||
inline GateRef StubBuilder::TaggedIsTransWithProtoHandler(GateRef x)
|
||||
@ -1735,15 +1735,15 @@ inline GateRef StubBuilder::GetPrototypeHandlerHandlerInfo(GateRef object)
|
||||
return Load(VariableType::JS_ANY(), object, handlerInfoOffset);
|
||||
}
|
||||
|
||||
inline GateRef StubBuilder::GetStoreTSHandlerHolder(GateRef object)
|
||||
inline GateRef StubBuilder::GetStoreAOTHandlerHolder(GateRef object)
|
||||
{
|
||||
GateRef holderOffset = IntPtr(StoreTSHandler::HOLDER_OFFSET);
|
||||
GateRef holderOffset = IntPtr(StoreAOTHandler::HOLDER_OFFSET);
|
||||
return Load(VariableType::JS_ANY(), object, holderOffset);
|
||||
}
|
||||
|
||||
inline GateRef StubBuilder::GetStoreTSHandlerHandlerInfo(GateRef object)
|
||||
inline GateRef StubBuilder::GetStoreAOTHandlerHandlerInfo(GateRef object)
|
||||
{
|
||||
GateRef handlerInfoOffset = IntPtr(StoreTSHandler::HANDLER_INFO_OFFSET);
|
||||
GateRef handlerInfoOffset = IntPtr(StoreAOTHandler::HANDLER_INFO_OFFSET);
|
||||
return Load(VariableType::JS_ANY(), object, handlerInfoOffset);
|
||||
}
|
||||
|
||||
@ -2173,15 +2173,15 @@ inline void StubBuilder::SetIsProtoTypeToHClass(GateRef glue, GateRef hClass, Ga
|
||||
SetBitFieldToHClass(glue, hClass, newVal);
|
||||
}
|
||||
|
||||
inline void StubBuilder::SetIsTS(GateRef glue, GateRef hClass, GateRef value)
|
||||
inline void StubBuilder::SetIsAOT(GateRef glue, GateRef hClass, GateRef value)
|
||||
{
|
||||
GateRef oldValue = ZExtInt1ToInt32(value);
|
||||
GateRef bitfield = GetBitFieldFromHClass(hClass);
|
||||
GateRef mask = Int32LSL(
|
||||
Int32((1LU << JSHClass::IsTSBit::SIZE) - 1),
|
||||
Int32(JSHClass::IsTSBit::START_BIT));
|
||||
Int32((1LU << JSHClass::IsAOTBit::SIZE) - 1),
|
||||
Int32(JSHClass::IsAOTBit::START_BIT));
|
||||
GateRef newVal = Int32Or(Int32And(bitfield, Int32Not(mask)),
|
||||
Int32LSL(oldValue, Int32(JSHClass::IsTSBit::START_BIT)));
|
||||
Int32LSL(oldValue, Int32(JSHClass::IsAOTBit::START_BIT)));
|
||||
SetBitFieldToHClass(glue, hClass, newVal);
|
||||
}
|
||||
|
||||
@ -2246,12 +2246,12 @@ inline GateRef StubBuilder::HasDeleteProperty(GateRef hClass)
|
||||
return env_->GetBuilder()->HasDeleteProperty(hClass);
|
||||
}
|
||||
|
||||
inline GateRef StubBuilder::IsTSHClass(GateRef hClass)
|
||||
inline GateRef StubBuilder::IsAOTHClass(GateRef hClass)
|
||||
{
|
||||
GateRef bitfield = Load(VariableType::INT32(), hClass, IntPtr(JSHClass::BIT_FIELD_OFFSET));
|
||||
return Int32NotEqual(Int32And(Int32LSR(bitfield,
|
||||
Int32(JSHClass::IsTSBit::START_BIT)),
|
||||
Int32((1LU << JSHClass::IsTSBit::SIZE) - 1)),
|
||||
Int32(JSHClass::IsAOTBit::START_BIT)),
|
||||
Int32((1LU << JSHClass::IsAOTBit::SIZE) - 1)),
|
||||
Int32(0));
|
||||
}
|
||||
|
||||
|
@ -1331,10 +1331,10 @@ void StubBuilder::JSHClassAddProperty(GateRef glue, GateRef receiver, GateRef ke
|
||||
BRANCH(Equal(newClass, Undefined()), ¬FindHClass, &findHClass);
|
||||
Bind(&findHClass);
|
||||
{
|
||||
GateRef isTSHClass = IsTSHClass(newClass);
|
||||
GateRef isAOTHClass = IsAOTHClass(newClass);
|
||||
Label setPrototype(env);
|
||||
Label endSetPrototypeCheck(env);
|
||||
Branch(isTSHClass, &setPrototype, &endSetPrototypeCheck);
|
||||
Branch(isAOTHClass, &setPrototype, &endSetPrototypeCheck);
|
||||
Bind(&setPrototype);
|
||||
{
|
||||
GateRef prototype = GetPrototypeFromHClass(hclass);
|
||||
@ -1349,7 +1349,7 @@ void StubBuilder::JSHClassAddProperty(GateRef glue, GateRef receiver, GateRef ke
|
||||
Label needUpdateAOTHClass(env);
|
||||
Label normalNotify(env);
|
||||
Label endUpdate(env);
|
||||
GateRef updateCondition = LogicAndBuilder(env).And(isTSHClass).And(IsProtoTypeHClass(newClass)).Done();
|
||||
GateRef updateCondition = LogicAndBuilder(env).And(isAOTHClass).And(IsProtoTypeHClass(newClass)).Done();
|
||||
Branch(updateCondition, &needUpdateAOTHClass, &normalNotify);
|
||||
Bind(&needUpdateAOTHClass);
|
||||
{
|
||||
@ -2878,8 +2878,8 @@ GateRef StubBuilder::StoreICWithHandler(GateRef glue, GateRef receiver, GateRef
|
||||
Label handlerNotPrototypeHandler(env);
|
||||
Label handlerIsPropertyBox(env);
|
||||
Label handlerNotPropertyBox(env);
|
||||
Label handlerIsStoreTSHandler(env);
|
||||
Label handlerNotStoreTSHandler(env);
|
||||
Label handlerIsStoreAOTHandler(env);
|
||||
Label handlerNotStoreAOTHandler(env);
|
||||
Label aotHandlerInfoIsField(env);
|
||||
Label aotHandlerInfoNotField(env);
|
||||
Label cellHasChanged(env);
|
||||
@ -2983,15 +2983,15 @@ GateRef StubBuilder::StoreICWithHandler(GateRef glue, GateRef receiver, GateRef
|
||||
}
|
||||
Bind(&handlerNotPropertyBox);
|
||||
{
|
||||
BRANCH(TaggedIsStoreTSHandler(*handler), &handlerIsStoreTSHandler, &handlerNotStoreTSHandler);
|
||||
Bind(&handlerIsStoreTSHandler);
|
||||
BRANCH(TaggedIsStoreAOTHandler(*handler), &handlerIsStoreAOTHandler, &handlerNotStoreAOTHandler);
|
||||
Bind(&handlerIsStoreAOTHandler);
|
||||
{
|
||||
GateRef cellValue = GetProtoCell(*handler);
|
||||
BRANCH(GetHasChanged(cellValue), &cellHasChanged, &aotCellNotChanged);
|
||||
Bind(&aotCellNotChanged);
|
||||
{
|
||||
holder = GetStoreTSHandlerHolder(*handler);
|
||||
handler = GetStoreTSHandlerHandlerInfo(*handler);
|
||||
holder = GetStoreAOTHandlerHolder(*handler);
|
||||
handler = GetStoreAOTHandlerHandlerInfo(*handler);
|
||||
GateRef handlerInfo = GetInt64OfTInt(*handler);
|
||||
BRANCH(IsField(handlerInfo), &aotHandlerInfoIsField, &aotHandlerInfoNotField);
|
||||
Bind(&aotHandlerInfoIsField);
|
||||
@ -3007,7 +3007,7 @@ GateRef StubBuilder::StoreICWithHandler(GateRef glue, GateRef receiver, GateRef
|
||||
}
|
||||
}
|
||||
}
|
||||
Bind(&handlerNotStoreTSHandler);
|
||||
Bind(&handlerNotStoreAOTHandler);
|
||||
Jump(&exit);
|
||||
}
|
||||
Bind(&cellHasChanged);
|
||||
@ -3701,8 +3701,8 @@ void StubBuilder::CopyAllHClass(GateRef glue, GateRef dstHClass, GateRef srcHCla
|
||||
{
|
||||
auto env = GetEnvironment();
|
||||
Label entry(env);
|
||||
Label isTS(env);
|
||||
Label isNotTS(env);
|
||||
Label isAOT(env);
|
||||
Label isNotAOT(env);
|
||||
env->SubCfgEntry(&entry);
|
||||
auto proto = GetPrototypeFromHClass(srcHClass);
|
||||
SetPrototypeToHClass(VariableType::JS_POINTER(), glue, dstHClass, proto);
|
||||
@ -3718,13 +3718,13 @@ void StubBuilder::CopyAllHClass(GateRef glue, GateRef dstHClass, GateRef srcHCla
|
||||
dstHClass,
|
||||
GetLayoutFromHClass(srcHClass),
|
||||
MemoryAttribute::NeedBarrierAndAtomic());
|
||||
BRANCH(IsTSHClass(srcHClass), &isTS, &isNotTS);
|
||||
Bind(&isTS);
|
||||
BRANCH(IsAOTHClass(srcHClass), &isAOT, &isNotAOT);
|
||||
Bind(&isAOT);
|
||||
{
|
||||
SetIsTS(glue, dstHClass, False());
|
||||
Jump(&isNotTS);
|
||||
SetIsAOT(glue, dstHClass, False());
|
||||
Jump(&isNotAOT);
|
||||
}
|
||||
Bind(&isNotTS);
|
||||
Bind(&isNotAOT);
|
||||
env->SubCfgExit();
|
||||
return;
|
||||
}
|
||||
@ -4081,10 +4081,10 @@ GateRef StubBuilder::CheckHClassForRep(GateRef hclass, GateRef value)
|
||||
Label subEntry(env);
|
||||
env->SubCfgEntry(&subEntry);
|
||||
Label exit(env);
|
||||
Label isTSHClass(env);
|
||||
Label isAOTHClass(env);
|
||||
DEFVARIABLE(result, VariableType::BOOL(), Boolean(true));
|
||||
Branch(IsTSHClass(hclass), &isTSHClass, &exit);
|
||||
Bind(&isTSHClass);
|
||||
Branch(IsAOTHClass(hclass), &isAOTHClass, &exit);
|
||||
Bind(&isAOTHClass);
|
||||
{
|
||||
GateRef propNums = GetNumberOfPropsFromHClass(hclass);
|
||||
GateRef last = Int32Sub(propNums, Int32(1));
|
||||
@ -4710,14 +4710,14 @@ GateRef StubBuilder::SetPropertyByName(GateRef glue, GateRef receiver, GateRef k
|
||||
}
|
||||
Bind(&writable);
|
||||
{
|
||||
Label isTS(env);
|
||||
Label notTS(env);
|
||||
BRANCH(IsTSHClass(hclass), &isTS, ¬TS);
|
||||
Bind(&isTS);
|
||||
Label isAOT(env);
|
||||
Label notAOT(env);
|
||||
BRANCH(IsAOTHClass(hclass), &isAOT, ¬AOT);
|
||||
Bind(&isAOT);
|
||||
{
|
||||
GateRef attrVal = JSObjectGetProperty(*holder, hclass, attr);
|
||||
Label attrValIsHole(env);
|
||||
BRANCH(TaggedIsHole(attrVal), &attrValIsHole, ¬TS);
|
||||
BRANCH(TaggedIsHole(attrVal), &attrValIsHole, ¬AOT);
|
||||
Bind(&attrValIsHole);
|
||||
{
|
||||
Label storeReceiverHoleEntry(env);
|
||||
@ -4739,7 +4739,7 @@ GateRef StubBuilder::SetPropertyByName(GateRef glue, GateRef receiver, GateRef k
|
||||
}
|
||||
}
|
||||
}
|
||||
Bind(¬TS);
|
||||
Bind(¬AOT);
|
||||
Label holdEqualsRecv(env);
|
||||
if (useOwn || defineSemantics) {
|
||||
BRANCH(Equal(*holder, receiver), &holdEqualsRecv, &ifEnd);
|
||||
@ -4990,14 +4990,14 @@ GateRef StubBuilder::DefinePropertyByName(GateRef glue, GateRef receiver, GateRe
|
||||
Jump(&exit);
|
||||
Bind(&writable);
|
||||
{
|
||||
Label isTS(env);
|
||||
Label notTS(env);
|
||||
BRANCH(IsTSHClass(hclass), &isTS, ¬TS);
|
||||
Bind(&isTS);
|
||||
Label isAOT(env);
|
||||
Label notAOT(env);
|
||||
BRANCH(IsAOTHClass(hclass), &isAOT, ¬AOT);
|
||||
Bind(&isAOT);
|
||||
{
|
||||
GateRef attrVal = JSObjectGetProperty(*holder, hclass, attr);
|
||||
Label attrValIsHole(env);
|
||||
BRANCH(TaggedIsHole(attrVal), &attrValIsHole, ¬TS);
|
||||
BRANCH(TaggedIsHole(attrVal), &attrValIsHole, ¬AOT);
|
||||
Bind(&attrValIsHole);
|
||||
{
|
||||
Label storeReceiverHoleEntry(env);
|
||||
@ -5013,7 +5013,7 @@ GateRef StubBuilder::DefinePropertyByName(GateRef glue, GateRef receiver, GateRe
|
||||
}
|
||||
}
|
||||
}
|
||||
Bind(¬TS);
|
||||
Bind(¬AOT);
|
||||
Label holdEqualsRecv(env);
|
||||
BRANCH(Equal(*holder, receiver), &holdEqualsRecv, &ifEnd);
|
||||
Bind(&holdEqualsRecv);
|
||||
|
@ -286,7 +286,7 @@ public:
|
||||
GateRef TaggedIsJSGlobalObject(GateRef x);
|
||||
GateRef TaggedIsWeak(GateRef x);
|
||||
GateRef TaggedIsPrototypeHandler(GateRef x);
|
||||
GateRef TaggedIsStoreTSHandler(GateRef x);
|
||||
GateRef TaggedIsStoreAOTHandler(GateRef x);
|
||||
GateRef TaggedIsTransWithProtoHandler(GateRef x);
|
||||
GateRef TaggedIsTransitionHandler(GateRef x);
|
||||
GateRef TaggedIsString(GateRef obj);
|
||||
@ -491,8 +491,8 @@ public:
|
||||
GateRef GetProtoCell(GateRef object);
|
||||
GateRef GetPrototypeHandlerHolder(GateRef object);
|
||||
GateRef GetPrototypeHandlerHandlerInfo(GateRef object);
|
||||
GateRef GetStoreTSHandlerHolder(GateRef object);
|
||||
GateRef GetStoreTSHandlerHandlerInfo(GateRef object);
|
||||
GateRef GetStoreAOTHandlerHolder(GateRef object);
|
||||
GateRef GetStoreAOTHandlerHandlerInfo(GateRef object);
|
||||
inline GateRef GetLengthOfJSArray(GateRef array);
|
||||
inline GateRef GetPrototype(GateRef glue, GateRef object);
|
||||
GateRef GetHasChanged(GateRef object);
|
||||
@ -550,7 +550,7 @@ public:
|
||||
void SetTransitionsToHClass(VariableType type, GateRef glue, GateRef hClass, GateRef transition);
|
||||
void SetParentToHClass(VariableType type, GateRef glue, GateRef hClass, GateRef parent);
|
||||
void SetIsProtoTypeToHClass(GateRef glue, GateRef hClass, GateRef value);
|
||||
inline void SetIsTS(GateRef glue, GateRef hClass, GateRef value);
|
||||
inline void SetIsAOT(GateRef glue, GateRef hClass, GateRef value);
|
||||
GateRef IsProtoTypeHClass(GateRef hClass);
|
||||
void SetPropertyInlinedProps(GateRef glue, GateRef obj, GateRef hClass,
|
||||
GateRef value, GateRef attrOffset, VariableType type = VariableType::JS_ANY(),
|
||||
@ -562,7 +562,7 @@ public:
|
||||
void IncNumberOfProps(GateRef glue, GateRef hClass);
|
||||
GateRef GetNumberOfPropsFromHClass(GateRef hClass);
|
||||
GateRef HasDeleteProperty(GateRef hClass);
|
||||
GateRef IsTSHClass(GateRef hClass);
|
||||
GateRef IsAOTHClass(GateRef hClass);
|
||||
void SetNumberOfPropsToHClass(GateRef glue, GateRef hClass, GateRef value);
|
||||
void SetElementsKindToTrackInfo(GateRef glue, GateRef trackInfo, GateRef elementsKind);
|
||||
void SetSpaceFlagToTrackInfo(GateRef glue, GateRef trackInfo, GateRef spaceFlag);
|
||||
|
@ -571,7 +571,7 @@ CString *HeapSnapshot::GenerateNodeName(TaggedObject *entry)
|
||||
case JSType::TRANS_WITH_PROTO_HANDLER:
|
||||
return GetString("TransWithProtoHandler");
|
||||
case JSType::STORE_TS_HANDLER:
|
||||
return GetString("StoreTSHandler");
|
||||
return GetString("StoreAOTHandler");
|
||||
case JSType::PROTO_CHANGE_MARKER:
|
||||
return GetString("ProtoChangeMarker");
|
||||
case JSType::MARKER_CELL:
|
||||
|
@ -991,10 +991,10 @@ public:
|
||||
SourceTextModule::SIZE - SourceTextModule::SOURCE_TEXT_MODULE_OFFSET}},
|
||||
{JSType::STAR_EXPORTENTRY_RECORD, {StarExportEntry::STAR_EXPORT_ENTRY_OFFSET,
|
||||
StarExportEntry::SIZE - StarExportEntry::STAR_EXPORT_ENTRY_OFFSET}},
|
||||
{JSType::STORE_TS_HANDLER, {StoreTSHandler::HANDLER_INFO_OFFSET,
|
||||
StoreTSHandler::PROTO_CELL_OFFSET,
|
||||
StoreTSHandler::HOLDER_OFFSET,
|
||||
StoreTSHandler::SIZE - StoreTSHandler::HANDLER_INFO_OFFSET}},
|
||||
{JSType::STORE_TS_HANDLER, {StoreAOTHandler::HANDLER_INFO_OFFSET,
|
||||
StoreAOTHandler::PROTO_CELL_OFFSET,
|
||||
StoreAOTHandler::HOLDER_OFFSET,
|
||||
StoreAOTHandler::SIZE - StoreAOTHandler::HANDLER_INFO_OFFSET}},
|
||||
{JSType::SYMBOL, {JSSymbol::DESCRIPTION_OFFSET,
|
||||
JSSymbol::SIZE - JSSymbol::DESCRIPTION_OFFSET}},
|
||||
{JSType::TAGGED_ARRAY, {TaggedArray::LENGTH_OFFSET, TaggedArray::DATA_OFFSET,
|
||||
@ -1718,9 +1718,9 @@ public:
|
||||
SourceTextModule::SENDABLE_ENV_OFFSET - SourceTextModule::ASYNC_PARENT_MODULES_OFFSET,
|
||||
SourceTextModule::EVALUATION_ERROR_OFFSET - SourceTextModule::SENDABLE_ENV_OFFSET}},
|
||||
{JSType::STAR_EXPORTENTRY_RECORD, {StarExportEntry::SIZE - StarExportEntry::STAR_EXPORT_ENTRY_OFFSET}},
|
||||
{JSType::STORE_TS_HANDLER, {StoreTSHandler::PROTO_CELL_OFFSET - StoreTSHandler::HANDLER_INFO_OFFSET,
|
||||
StoreTSHandler::HOLDER_OFFSET - StoreTSHandler::PROTO_CELL_OFFSET,
|
||||
StoreTSHandler::SIZE - StoreTSHandler::HOLDER_OFFSET}},
|
||||
{JSType::STORE_TS_HANDLER, {StoreAOTHandler::PROTO_CELL_OFFSET - StoreAOTHandler::HANDLER_INFO_OFFSET,
|
||||
StoreAOTHandler::HOLDER_OFFSET - StoreAOTHandler::PROTO_CELL_OFFSET,
|
||||
StoreAOTHandler::SIZE - StoreAOTHandler::HOLDER_OFFSET}},
|
||||
{JSType::SYMBOL, {JSSymbol::HASHFIELD_OFFSET - JSSymbol::DESCRIPTION_OFFSET}},
|
||||
{JSType::TAGGED_ARRAY, {
|
||||
TaggedArray::EXTRA_LENGTH_OFFSET - TaggedArray::LENGTH_OFFSET, TaggedArray::LENGTH_OFFSET}},
|
||||
@ -4357,7 +4357,7 @@ HWTEST_F_L0(JSMetadataTest, TestStarExportentryRecordMetadata)
|
||||
ASSERT_TRUE(tester.Test(JSType::STAR_EXPORTENTRY_RECORD, metadata));
|
||||
}
|
||||
|
||||
HWTEST_F_L0(JSMetadataTest, TestStoreTsHandlerMetadata)
|
||||
HWTEST_F_L0(JSMetadataTest, TestStoreAOTHandlerMetadata)
|
||||
{
|
||||
JSMetadataTestHelper tester {};
|
||||
std::string metadataFilePath = METADATA_SOURCE_FILE_DIR"store_ts_handler.json";
|
||||
|
@ -662,7 +662,7 @@ static void DumpHClass(const JSHClass *jshclass, std::ostream &os, bool withDeta
|
||||
os << "| ElementsKind :" << Elements::GetString(jshclass->GetElementsKind());
|
||||
os << "| NumberOfProps :" << std::dec << jshclass->NumberOfProps();
|
||||
os << "| InlinedProperties :" << std::dec << jshclass->GetInlinedProperties();
|
||||
os << "| IsTS :" << std::boolalpha << jshclass->IsTS();
|
||||
os << "| IsAOT :" << std::boolalpha << jshclass->IsAOT();
|
||||
os << "| Level :" << std::dec << static_cast<int>(jshclass->GetLevel());
|
||||
os << "\n";
|
||||
}
|
||||
@ -1002,7 +1002,7 @@ static void DumpObject(TaggedObject *obj, std::ostream &os)
|
||||
TransWithProtoHandler::Cast(obj)->Dump(os);
|
||||
break;
|
||||
case JSType::STORE_TS_HANDLER:
|
||||
StoreTSHandler::Cast(obj)->Dump(os);
|
||||
StoreAOTHandler::Cast(obj)->Dump(os);
|
||||
break;
|
||||
case JSType::PROPERTY_BOX:
|
||||
PropertyBox::Cast(obj)->Dump(os);
|
||||
@ -3227,7 +3227,7 @@ void TransWithProtoHandler::Dump(std::ostream &os) const
|
||||
os << "\n";
|
||||
}
|
||||
|
||||
void StoreTSHandler::Dump(std::ostream &os) const
|
||||
void StoreAOTHandler::Dump(std::ostream &os) const
|
||||
{
|
||||
os << " - HandlerInfo: ";
|
||||
GetHandlerInfo().Dump(os);
|
||||
@ -4460,7 +4460,7 @@ static void DumpObject(TaggedObject *obj, std::vector<Reference> &vec, bool isVm
|
||||
TransWithProtoHandler::Cast(obj)->DumpForSnapshot(vec);
|
||||
break;
|
||||
case JSType::STORE_TS_HANDLER:
|
||||
StoreTSHandler::Cast(obj)->DumpForSnapshot(vec);
|
||||
StoreAOTHandler::Cast(obj)->DumpForSnapshot(vec);
|
||||
break;
|
||||
case JSType::PROTOTYPE_HANDLER:
|
||||
PrototypeHandler::Cast(obj)->DumpForSnapshot(vec);
|
||||
@ -5626,7 +5626,7 @@ void TransWithProtoHandler::DumpForSnapshot(std::vector<Reference> &vec) const
|
||||
vec.emplace_back(CString("ProtoCell"), GetProtoCell());
|
||||
}
|
||||
|
||||
void StoreTSHandler::DumpForSnapshot(std::vector<Reference> &vec) const
|
||||
void StoreAOTHandler::DumpForSnapshot(std::vector<Reference> &vec) const
|
||||
{
|
||||
vec.emplace_back(CString("HandlerInfo"), GetHandlerInfo());
|
||||
vec.emplace_back(CString("ProtoCell"), GetProtoCell());
|
||||
|
@ -199,7 +199,7 @@ void GlobalEnvConstants::InitSharedRootsClasses(ObjectFactory *factory)
|
||||
SetConstant(ConstantIndex::TRANS_WITH_PROTO_HANDLER_CLASS_INDEX,
|
||||
factory->NewSEcmaReadOnlyHClass(hClass, TransWithProtoHandler::SIZE, JSType::TRANS_WITH_PROTO_HANDLER));
|
||||
SetConstant(ConstantIndex::STORE_TS_HANDLER_CLASS_INDEX,
|
||||
factory->NewSEcmaReadOnlyHClass(hClass, StoreTSHandler::SIZE, JSType::STORE_TS_HANDLER));
|
||||
factory->NewSEcmaReadOnlyHClass(hClass, StoreAOTHandler::SIZE, JSType::STORE_TS_HANDLER));
|
||||
SetConstant(ConstantIndex::PROPERTY_BOX_CLASS_INDEX,
|
||||
factory->NewSEcmaReadOnlyHClass(hClass, PropertyBox::SIZE, JSType::PROPERTY_BOX));
|
||||
SetConstant(ConstantIndex::PROGRAM_CLASS_INDEX,
|
||||
|
@ -74,7 +74,7 @@ class ObjectFactory;
|
||||
V(JSTaggedValue, PrototypeHandlerClass, PROTOTYPE_HANDLER_CLASS_INDEX, ecma_roots_class) \
|
||||
V(JSTaggedValue, TransitionHandlerClass, TRANSITION_HANDLER_CLASS_INDEX, ecma_roots_class) \
|
||||
V(JSTaggedValue, TransWithProtoHandlerClass, TRANS_WITH_PROTO_HANDLER_CLASS_INDEX, ecma_roots_class) \
|
||||
V(JSTaggedValue, StoreTSHandlerClass, STORE_TS_HANDLER_CLASS_INDEX, ecma_roots_class) \
|
||||
V(JSTaggedValue, StoreAOTHandlerClass, STORE_TS_HANDLER_CLASS_INDEX, ecma_roots_class) \
|
||||
V(JSTaggedValue, PropertyBoxClass, PROPERTY_BOX_CLASS_INDEX, ecma_roots_class) \
|
||||
V(JSTaggedValue, ProgramClass, PROGRAM_CLASS_INDEX, ecma_roots_class) \
|
||||
V(JSTaggedValue, ImportEntryClass, IMPORT_ENTRY_CLASS_INDEX, ecma_roots_class) \
|
||||
|
@ -497,19 +497,19 @@ public:
|
||||
DECL_DUMP()
|
||||
};
|
||||
|
||||
class StoreTSHandler : public TaggedObject {
|
||||
class StoreAOTHandler : public TaggedObject {
|
||||
public:
|
||||
static StoreTSHandler *Cast(TaggedObject *object)
|
||||
static StoreAOTHandler *Cast(TaggedObject *object)
|
||||
{
|
||||
ASSERT(JSTaggedValue(object).IsStoreTSHandler());
|
||||
return static_cast<StoreTSHandler *>(object);
|
||||
ASSERT(JSTaggedValue(object).IsStoreAOTHandler());
|
||||
return static_cast<StoreAOTHandler *>(object);
|
||||
}
|
||||
|
||||
static inline JSHandle<JSTaggedValue> StoreAOT(const JSThread *thread, const ObjectOperator &op,
|
||||
const JSHandle<JSHClass> &hclass)
|
||||
{
|
||||
ObjectFactory *factory = thread->GetEcmaVM()->GetFactory();
|
||||
JSHandle<StoreTSHandler> handler = factory->NewStoreTSHandler();
|
||||
JSHandle<StoreAOTHandler> handler = factory->NewStoreAOTHandler();
|
||||
JSHandle<JSTaggedValue> handlerInfo = StoreHandler::StoreProperty(thread, op);
|
||||
handler->SetHandlerInfo(thread, handlerInfo);
|
||||
handler->SetHolder(thread, op.GetHolder());
|
||||
|
@ -45,7 +45,7 @@ void ICRuntime::UpdateLoadHandler(const ObjectOperator &op, JSHandle<JSTaggedVal
|
||||
// When a transition occurs without the shadow property, AOT does not trigger the
|
||||
// notifyprototypechange behavior, so for the case where the property does not
|
||||
// exist and the Hclass is AOT, IC needs to be abandoned.
|
||||
if (hclass->IsTS() && !op.IsFound()) {
|
||||
if (hclass->IsAOT() && !op.IsFound()) {
|
||||
return;
|
||||
}
|
||||
if (op.IsElement()) {
|
||||
|
@ -256,7 +256,7 @@ ARK_INLINE JSTaggedValue ICRuntimeStub::StoreICWithHandler(JSThread *thread, JST
|
||||
if (handler.IsPropertyBox()) {
|
||||
return StoreGlobal(thread, value, handler);
|
||||
}
|
||||
if (handler.IsStoreTSHandler()) {
|
||||
if (handler.IsStoreAOTHandler()) {
|
||||
return StoreWithTS(thread, receiver, value, handler);
|
||||
}
|
||||
return JSTaggedValue::Undefined();
|
||||
@ -288,16 +288,16 @@ JSTaggedValue ICRuntimeStub::StoreWithTS(JSThread *thread, JSTaggedValue receive
|
||||
JSTaggedValue value, JSTaggedValue handler)
|
||||
{
|
||||
INTERPRETER_TRACE(thread, StoreWithAOT);
|
||||
ASSERT(handler.IsStoreTSHandler());
|
||||
StoreTSHandler *storeTSHandler = StoreTSHandler::Cast(handler.GetTaggedObject());
|
||||
auto cellValue = storeTSHandler->GetProtoCell();
|
||||
ASSERT(handler.IsStoreAOTHandler());
|
||||
StoreAOTHandler *storeAOTHandler = StoreAOTHandler::Cast(handler.GetTaggedObject());
|
||||
auto cellValue = storeAOTHandler->GetProtoCell();
|
||||
ASSERT(cellValue.IsProtoChangeMarker());
|
||||
ProtoChangeMarker *cell = ProtoChangeMarker::Cast(cellValue.GetTaggedObject());
|
||||
if (cell->GetHasChanged()) {
|
||||
return JSTaggedValue::Hole();
|
||||
}
|
||||
auto holder = storeTSHandler->GetHolder();
|
||||
JSTaggedValue handlerInfo = storeTSHandler->GetHandlerInfo();
|
||||
auto holder = storeAOTHandler->GetHolder();
|
||||
JSTaggedValue handlerInfo = storeAOTHandler->GetHandlerInfo();
|
||||
auto handlerInfoInt = JSTaggedValue::UnwrapToUint64(handlerInfo);
|
||||
if (HandlerBase::IsField(handlerInfoInt)) {
|
||||
StoreField(thread, JSObject::Cast(receiver.GetTaggedObject()), value, handlerInfoInt);
|
||||
|
@ -544,8 +544,8 @@ void JITProfiler::HandleOtherTypes(ApEntityId &abcId, int32_t &bcOffset,
|
||||
HandleOtherTypesPrototypeHandler(abcId, bcOffset, hclass, secondValue, slotId);
|
||||
} else if (secondValue.IsPropertyBox()) {
|
||||
// StoreGlobal
|
||||
} else if (secondValue.IsStoreTSHandler()) {
|
||||
HandleStoreTSHandler(abcId, bcOffset, hclass, secondValue);
|
||||
} else if (secondValue.IsStoreAOTHandler()) {
|
||||
HandleStoreAOTHandler(abcId, bcOffset, hclass, secondValue);
|
||||
}
|
||||
}
|
||||
|
||||
@ -604,17 +604,17 @@ void JITProfiler::HandleOtherTypesPrototypeHandler(ApEntityId &abcId, int32_t &b
|
||||
AddObjectInfo(abcId, bcOffset, hclass, holderHClass, holderHClass, accessorMethodId);
|
||||
}
|
||||
|
||||
void JITProfiler::HandleStoreTSHandler(ApEntityId &abcId, int32_t &bcOffset,
|
||||
JSHClass *hclass, JSTaggedValue &secondValue)
|
||||
void JITProfiler::HandleStoreAOTHandler(ApEntityId &abcId, int32_t &bcOffset,
|
||||
JSHClass *hclass, JSTaggedValue &secondValue)
|
||||
{
|
||||
StoreTSHandler *storeTSHandler = StoreTSHandler::Cast(secondValue.GetTaggedObject());
|
||||
auto cellValue = storeTSHandler->GetProtoCell();
|
||||
StoreAOTHandler *storeAOTHandler = StoreAOTHandler::Cast(secondValue.GetTaggedObject());
|
||||
auto cellValue = storeAOTHandler->GetProtoCell();
|
||||
ASSERT(cellValue.IsProtoChangeMarker());
|
||||
ProtoChangeMarker *cell = ProtoChangeMarker::Cast(cellValue.GetTaggedObject());
|
||||
if (cell->GetHasChanged()) {
|
||||
return;
|
||||
}
|
||||
auto holder = storeTSHandler->GetHolder();
|
||||
auto holder = storeAOTHandler->GetHolder();
|
||||
auto holderHClass = holder.GetTaggedObject()->GetClass();
|
||||
AddObjectInfo(abcId, bcOffset, hclass, holderHClass, holderHClass);
|
||||
}
|
||||
|
@ -111,7 +111,7 @@ private:
|
||||
JSHClass *hclass, JSTaggedValue &secondValue);
|
||||
void HandleOtherTypesPrototypeHandler(ApEntityId &abcId, int32_t &bcOffset,
|
||||
JSHClass *hclass, JSTaggedValue &secondValue, uint32_t slotId);
|
||||
void HandleStoreTSHandler(ApEntityId &abcId, int32_t &bcOffset,
|
||||
void HandleStoreAOTHandler(ApEntityId &abcId, int32_t &bcOffset,
|
||||
JSHClass *hclass, JSTaggedValue &secondValue);
|
||||
void ConvertICByNameWithPoly(ApEntityId abcId, int32_t bcOffset, JSTaggedValue cacheValue, BCType type,
|
||||
uint32_t slotId);
|
||||
|
@ -183,7 +183,7 @@ bool JSFunction::PrototypeSetter(JSThread *thread, const JSHandle<JSObject> &sel
|
||||
JSHandle<JSHClass> newClass = JSHClass::SetPrototypeWithNotification(thread, hclass, value);
|
||||
func->SetProtoOrHClass(thread, newClass);
|
||||
// Forbide to profile for changing the function prototype after an instance of the function has been created
|
||||
if (!hclass->IsTS() && thread->GetEcmaVM()->IsEnablePGOProfiler()) {
|
||||
if (!hclass->IsAOT() && thread->GetEcmaVM()->IsEnablePGOProfiler()) {
|
||||
EntityId ctorMethodId = Method::Cast(func->GetMethod().GetTaggedObject())->GetMethodId();
|
||||
thread->GetEcmaVM()->GetPGOProfiler()->InsertSkipCtorMethodIdSafe(ctorMethodId);
|
||||
}
|
||||
|
@ -180,7 +180,7 @@ inline void JSHClass::RestoreElementsKindToGeneric(JSHClass *newJsHClass)
|
||||
|
||||
inline JSHClass *JSHClass::CheckHClassForRep(JSHClass *hclass, const Representation &rep)
|
||||
{
|
||||
if (!hclass->IsTS()) {
|
||||
if (!hclass->IsAOT()) {
|
||||
return hclass;
|
||||
}
|
||||
if (rep == Representation::NONE) {
|
||||
|
@ -229,8 +229,8 @@ JSHandle<JSHClass> JSHClass::Clone(const JSThread *thread, const JSHandle<JSHCla
|
||||
// reuse Attributes first.
|
||||
newJsHClass->SetLayout(thread, jshclass->GetLayout());
|
||||
|
||||
if (jshclass->IsTS()) {
|
||||
newJsHClass->SetTS(false);
|
||||
if (jshclass->IsAOT()) {
|
||||
newJsHClass->SetAOT(false);
|
||||
}
|
||||
|
||||
return newJsHClass;
|
||||
@ -285,7 +285,7 @@ void JSHClass::AddProperty(const JSThread *thread, const JSHandle<JSObject> &obj
|
||||
JSHClass *newClass = jshclass->FindTransitions(key.GetTaggedValue(), metadata, rep);
|
||||
if (newClass != nullptr) {
|
||||
// The transition hclass from AOT, which does not have a prototype, needs to be reset here.
|
||||
if (newClass->IsTS()) {
|
||||
if (newClass->IsAOT()) {
|
||||
newClass->SetPrototype(thread, jshclass->GetPrototype());
|
||||
}
|
||||
// Because we currently only supports Fast ElementsKind
|
||||
@ -294,7 +294,7 @@ void JSHClass::AddProperty(const JSThread *thread, const JSHandle<JSObject> &obj
|
||||
#if ECMASCRIPT_ENABLE_IC
|
||||
// The transition hclass from AOT, which does not have protochangemarker, needs to be reset here
|
||||
JSHandle<JSHClass> newHClass = JSHandle<JSHClass>(thread, newClass);
|
||||
if (newClass->IsTS() && newClass->IsPrototype()) {
|
||||
if (newClass->IsAOT() && newClass->IsPrototype()) {
|
||||
if (JSHClass::IsNeedNotifyHclassChangedForAotTransition(thread, jshclass, key.GetTaggedValue())) {
|
||||
JSHClass::EnableProtoChangeMarker(thread, newHClass);
|
||||
JSHClass::NotifyHclassChanged(thread, jshclass, newHClass, key.GetTaggedValue());
|
||||
@ -390,7 +390,7 @@ JSHClass *JSHClass::FindTransitionProtoForAOT(const JSThread *thread, const JSHa
|
||||
return nullptr;
|
||||
}
|
||||
JSHandle<JSHClass> baseIhc(thread, proto->GetTaggedObject()->GetClass());
|
||||
if (!jshclass->IsTS() || !baseIhc->IsTS()) {
|
||||
if (!jshclass->IsAOT() || !baseIhc->IsAOT()) {
|
||||
return nullptr;
|
||||
}
|
||||
auto transitionTable = thread->GetCurrentEcmaContext()->GetFunctionProtoTransitionTable();
|
||||
@ -512,7 +512,7 @@ void JSHClass::OptimizePrototypeForIC(const JSThread *thread, const JSHandle<JST
|
||||
// Situations for clone proto hclass:
|
||||
// 1: unshared non-ts hclass
|
||||
// 2: no matter whether hclass is ts or not when set function prototype
|
||||
if ((!hclass->IsTS() && !hclass->IsJSShared()) || isChangeProto) {
|
||||
if ((!hclass->IsAOT() && !hclass->IsJSShared()) || isChangeProto) {
|
||||
// The local IC and on-proto IC are different, because the former don't need to notify the whole
|
||||
// prototype-chain or listen the changes of prototype chain, but the latter do. Therefore, when
|
||||
// an object becomes a prototype object at the first time, we need to copy its hidden class in
|
||||
@ -929,7 +929,7 @@ void JSHClass::NotifyHclassChanged(const JSThread *thread, JSHandle<JSHClass> ol
|
||||
// it will not have IsPrototype bit set as true.
|
||||
//
|
||||
// Good neww is our AOT hclass can not be shared, hence we can set newHclass IsPrototype as true at here.
|
||||
if (newHclass->IsTS() && !newHclass->IsPrototype()) {
|
||||
if (newHclass->IsAOT() && !newHclass->IsPrototype()) {
|
||||
newHclass->SetIsPrototype(true);
|
||||
}
|
||||
JSHClass::NoticeThroughChain(thread, oldHclass, addedKey);
|
||||
@ -1113,7 +1113,7 @@ void JSHClass::RefreshUsers(const JSThread *thread, const JSHandle<JSHClass> &ol
|
||||
PropertyLookupResult JSHClass::LookupPropertyInAotHClass(const JSThread *thread, JSHClass *hclass, JSTaggedValue key)
|
||||
{
|
||||
DISALLOW_GARBAGE_COLLECTION;
|
||||
ASSERT(hclass->IsTS());
|
||||
ASSERT(hclass->IsAOT());
|
||||
|
||||
PropertyLookupResult result;
|
||||
if (hclass->IsDictionaryMode()) {
|
||||
@ -1287,7 +1287,7 @@ JSHandle<JSHClass> JSHClass::CreateRootHClassFromPGO(const JSThread* thread,
|
||||
});
|
||||
hclass->SetLayout(thread, layout);
|
||||
hclass->SetNumberOfProps(numOfProps);
|
||||
hclass->SetTS(true);
|
||||
hclass->SetAOT(true);
|
||||
return hclass;
|
||||
}
|
||||
|
||||
@ -1304,7 +1304,7 @@ JSHandle<JSHClass> JSHClass::CreateRootHClassWithCached(const JSThread* thread,
|
||||
JSHandle<LayoutInfo> layout = factory->CreateLayoutInfo(maxNum, MemSpaceType::SEMI_SPACE, GrowMode::KEEP);
|
||||
hclass->SetPrototype(thread, JSTaggedValue::Null());
|
||||
hclass->SetLayout(thread, layout);
|
||||
hclass->SetTS(true);
|
||||
hclass->SetAOT(true);
|
||||
rootDesc->IterateProps([thread, factory, &index, &hclass](const pgo::PropertyDesc& propDesc) {
|
||||
auto& cstring = propDesc.first;
|
||||
auto& handler = propDesc.second;
|
||||
@ -1320,7 +1320,7 @@ JSHandle<JSHClass> JSHClass::CreateRootHClassWithCached(const JSThread* thread,
|
||||
JSHandle<JSHClass> child = SetPropertyOfObjHClass(thread, hclass, key, attributes, rep);
|
||||
child->SetParent(thread, hclass);
|
||||
child->SetPrototype(thread, JSTaggedValue::Null());
|
||||
child->SetTS(true);
|
||||
child->SetAOT(true);
|
||||
hclass = child;
|
||||
});
|
||||
return hclass;
|
||||
@ -1337,7 +1337,7 @@ JSHandle<JSHClass> JSHClass::CreateChildHClassFromPGO(const JSThread* thread,
|
||||
uint32_t numOfProps = parent->NumberOfProps();
|
||||
|
||||
JSHandle<JSHClass> newJsHClass = JSHClass::Clone(thread, parent);
|
||||
newJsHClass->SetTS(true);
|
||||
newJsHClass->SetAOT(true);
|
||||
ASSERT(newJsHClass->GetInlinedProperties() >= (numOfProps + 1));
|
||||
uint32_t offset = numOfProps;
|
||||
{
|
||||
|
@ -394,8 +394,8 @@ public:
|
||||
using HasConstructorBits = IsStableElementsBit::NextFlag; // 21
|
||||
using IsClassConstructorOrPrototypeBit = HasConstructorBits::NextFlag; // 22
|
||||
using IsNativeBindingObjectBit = IsClassConstructorOrPrototypeBit::NextFlag; // 23
|
||||
using IsTSBit = IsNativeBindingObjectBit::NextFlag; // 24
|
||||
using LevelBit = IsTSBit::NextField<uint32_t, LEVEL_BTTFIELD_NUM>; // 25-29
|
||||
using IsAOTBit = IsNativeBindingObjectBit::NextFlag; // 24
|
||||
using LevelBit = IsAOTBit::NextField<uint32_t, LEVEL_BTTFIELD_NUM>; // 25-29
|
||||
using IsJSFunctionBit = LevelBit::NextFlag; // 30
|
||||
using IsOnHeap = IsJSFunctionBit::NextFlag; // 31
|
||||
using IsJSSharedBit = IsOnHeap::NextFlag; // 32
|
||||
@ -587,9 +587,9 @@ public:
|
||||
IsDictionaryBit::Set<uint32_t>(flag, GetBitFieldAddr());
|
||||
}
|
||||
|
||||
inline void SetTS(bool flag) const
|
||||
inline void SetAOT(bool flag) const
|
||||
{
|
||||
IsTSBit::Set<uint32_t>(flag, GetBitFieldAddr());
|
||||
IsAOTBit::Set<uint32_t>(flag, GetBitFieldAddr());
|
||||
}
|
||||
|
||||
inline void SetIsJSFunction(bool flag) const
|
||||
@ -1419,7 +1419,7 @@ public:
|
||||
return GetObjectType() == JSType::TRANS_WITH_PROTO_HANDLER;
|
||||
}
|
||||
|
||||
inline bool IsStoreTSHandler() const
|
||||
inline bool IsStoreAOTHandler() const
|
||||
{
|
||||
return GetObjectType() == JSType::STORE_TS_HANDLER;
|
||||
}
|
||||
@ -1511,11 +1511,11 @@ public:
|
||||
return IsDictionaryBit::Decode(bits);
|
||||
}
|
||||
|
||||
// created from TypeScript Types
|
||||
inline bool IsTS() const
|
||||
// created from AOT
|
||||
inline bool IsAOT() const
|
||||
{
|
||||
uint32_t bits = GetBitField();
|
||||
return IsTSBit::Decode(bits);
|
||||
return IsAOTBit::Decode(bits);
|
||||
}
|
||||
|
||||
inline bool IsJSFunctionFromBitField() const
|
||||
|
@ -487,7 +487,7 @@ void JSObject::GetAllKeys(const JSThread *thread, const JSHandle<JSObject> &obj,
|
||||
int end = static_cast<int>(obj->GetJSHClass()->NumberOfProps());
|
||||
if (end > 0) {
|
||||
LayoutInfo::Cast(obj->GetJSHClass()->GetLayout().GetTaggedObject())
|
||||
->GetAllKeys(thread, end, offset, *keyArray, obj);
|
||||
->GetAllKeys(thread, end, offset, *keyArray);
|
||||
}
|
||||
return;
|
||||
}
|
||||
@ -511,7 +511,7 @@ void JSObject::GetAllKeysByFilter(const JSThread *thread, const JSHandle<JSObjec
|
||||
uint32_t numberOfProps = obj->GetJSHClass()->NumberOfProps();
|
||||
if (numberOfProps > 0) {
|
||||
LayoutInfo::Cast(obj->GetJSHClass()->GetLayout().GetTaggedObject())->
|
||||
GetAllKeysByFilter(thread, numberOfProps, keyArrayEffectivelength, *keyArray, obj, filter);
|
||||
GetAllKeysByFilter(thread, numberOfProps, keyArrayEffectivelength, *keyArray, filter);
|
||||
}
|
||||
return;
|
||||
}
|
||||
@ -569,7 +569,7 @@ JSHandle<TaggedArray> JSObject::GetAllEnumKeys(JSThread *thread, const JSHandle<
|
||||
int end = static_cast<int>(jsHclass->NumberOfProps());
|
||||
JSHandle<TaggedArray> keyArray = factory->NewTaggedArray(numOfKeys + EnumCache::ENUM_CACHE_HEADER_SIZE);
|
||||
LayoutInfo::Cast(jsHclass->GetLayout().GetTaggedObject())
|
||||
->GetAllEnumKeys(thread, end, EnumCache::ENUM_CACHE_HEADER_SIZE, keyArray, keys, obj);
|
||||
->GetAllEnumKeys(thread, end, EnumCache::ENUM_CACHE_HEADER_SIZE, keyArray, keys);
|
||||
JSObject::SetEnumCacheKind(thread, *keyArray, EnumCacheKind::ONLY_OWN_KEYS);
|
||||
if (!JSTaggedValue(jsHclass).IsInSharedHeap()) {
|
||||
jsHclass->SetEnumCache(thread, keyArray.GetTaggedValue());
|
||||
@ -596,7 +596,7 @@ uint32_t JSObject::GetAllEnumKeys(JSThread *thread, const JSHandle<JSObject> &ob
|
||||
int end = static_cast<int>(jsHclass->NumberOfProps());
|
||||
if (end > 0) {
|
||||
LayoutInfo::Cast(jsHclass->GetLayout().GetTaggedObject())
|
||||
->GetAllEnumKeys(thread, end, offset, keyArray, &keys, obj);
|
||||
->GetAllEnumKeys(thread, end, offset, keyArray, &keys);
|
||||
}
|
||||
return keys;
|
||||
}
|
||||
@ -779,7 +779,7 @@ std::pair<uint32_t, uint32_t> JSObject::GetNumberOfEnumKeys() const
|
||||
int end = static_cast<int>(GetJSHClass()->NumberOfProps());
|
||||
if (end > 0) {
|
||||
LayoutInfo *layout = LayoutInfo::Cast(GetJSHClass()->GetLayout().GetTaggedObject());
|
||||
return layout->GetNumOfEnumKeys(end, this);
|
||||
return layout->GetNumOfEnumKeys(end);
|
||||
}
|
||||
return std::make_pair(0, 0);
|
||||
}
|
||||
@ -1710,7 +1710,7 @@ void JSObject::CollectEnumKeysAlongProtoChain(JSThread *thread, const JSHandle<J
|
||||
int end = static_cast<int>(jsHclass->NumberOfProps());
|
||||
if (end > 0) {
|
||||
LayoutInfo::Cast(jsHclass->GetLayout().GetTaggedObject())
|
||||
->GetAllEnumKeys(thread, end, *keys, keyArray, keys, shadowQueue, obj, lastLength);
|
||||
->GetAllEnumKeys(thread, end, *keys, keyArray, keys, shadowQueue, lastLength);
|
||||
}
|
||||
return;
|
||||
}
|
||||
@ -2766,7 +2766,7 @@ JSHandle<JSObject> JSObject::CreateObjectFromProperties(const JSThread *thread,
|
||||
hclass = factory->GetObjectLiteralHClass(properties, propsLen);
|
||||
isLiteral = true;
|
||||
}
|
||||
if (hclass->IsTS()) {
|
||||
if (hclass->IsAOT()) {
|
||||
if (CheckPropertiesForRep(properties, propsLen, hclass)) {
|
||||
return CreateObjectFromPropertiesByIHClass(thread, properties, propsLen, hclass);
|
||||
} else if (!isLiteral) {
|
||||
|
@ -978,9 +978,9 @@ inline bool JSTaggedValue::IsTransWithProtoHandler() const
|
||||
return IsHeapObject() && GetTaggedObject()->GetClass()->IsTransWithProtoHandler();
|
||||
}
|
||||
|
||||
inline bool JSTaggedValue::IsStoreTSHandler() const
|
||||
inline bool JSTaggedValue::IsStoreAOTHandler() const
|
||||
{
|
||||
return IsHeapObject() && GetTaggedObject()->GetClass()->IsStoreTSHandler();
|
||||
return IsHeapObject() && GetTaggedObject()->GetClass()->IsStoreAOTHandler();
|
||||
}
|
||||
|
||||
inline bool JSTaggedValue::IsPropertyBox() const
|
||||
|
@ -662,7 +662,7 @@ public:
|
||||
bool IsPrototypeHandler() const;
|
||||
bool IsTransitionHandler() const;
|
||||
bool IsTransWithProtoHandler() const;
|
||||
bool IsStoreTSHandler() const;
|
||||
bool IsStoreAOTHandler() const;
|
||||
bool IsPropertyBox() const;
|
||||
bool IsProtoChangeMarker() const;
|
||||
bool IsProtoChangeDetails() const;
|
||||
|
@ -172,7 +172,7 @@ void ConstantPool::MergeObjectLiteralHClassCache(EcmaVM *vm, const JSHandle<JSTa
|
||||
}
|
||||
auto curValue = curCachedArray->Get(i);
|
||||
// If already merged, stop to merge.
|
||||
if (curValue.IsJSHClass() && JSHClass::Cast(curValue.GetTaggedObject())->IsTS()) {
|
||||
if (curValue.IsJSHClass() && JSHClass::Cast(curValue.GetTaggedObject())->IsAOT()) {
|
||||
break;
|
||||
}
|
||||
JSHClass::Cast(newValue.GetTaggedObject())->SetPrototype(thread, prototype);
|
||||
|
@ -28,8 +28,7 @@ void LayoutInfo::Initialize(const JSThread *thread, int num)
|
||||
}
|
||||
}
|
||||
|
||||
void LayoutInfo::GetAllKeys(const JSThread *thread, int end, int offset, TaggedArray *keyArray,
|
||||
const JSHandle<JSObject> object)
|
||||
void LayoutInfo::GetAllKeys(const JSThread *thread, int end, int offset, TaggedArray *keyArray)
|
||||
{
|
||||
ASSERT(end <= NumberOfElements());
|
||||
ASSERT_PRINT(offset + end <= static_cast<int>(keyArray->GetLength()),
|
||||
@ -40,9 +39,6 @@ void LayoutInfo::GetAllKeys(const JSThread *thread, int end, int offset, TaggedA
|
||||
for (int i = 0; i < end; i++) {
|
||||
JSTaggedValue key = GetKey(i);
|
||||
if (key.IsString()) {
|
||||
if (IsUninitializedProperty(*object, i)) {
|
||||
continue;
|
||||
}
|
||||
keyArray->Set(thread, enumKeys + offset, key);
|
||||
enumKeys++;
|
||||
}
|
||||
@ -59,7 +55,7 @@ void LayoutInfo::GetAllKeys(const JSThread *thread, int end, int offset, TaggedA
|
||||
}
|
||||
}
|
||||
void LayoutInfo::GetAllKeysByFilter(const JSThread *thread, uint32_t numberOfProps, uint32_t &keyArrayEffectivelength,
|
||||
TaggedArray *keyArray, const JSHandle<JSObject> object, uint32_t filter)
|
||||
TaggedArray *keyArray, uint32_t filter)
|
||||
{
|
||||
ASSERT(numberOfProps <= static_cast<uint32_t>(NumberOfElements()));
|
||||
ASSERT_PRINT(keyArrayEffectivelength + numberOfProps <= keyArray->GetLength(),
|
||||
@ -70,9 +66,6 @@ void LayoutInfo::GetAllKeysByFilter(const JSThread *thread, uint32_t numberOfPro
|
||||
for (uint32_t i = 0; i < numberOfProps; i++) {
|
||||
JSTaggedValue key = GetKey(static_cast<int>(i));
|
||||
if (key.IsString() && !(filter & NATIVE_KEY_SKIP_STRINGS)) {
|
||||
if (IsUninitializedProperty(*object, i)) {
|
||||
continue;
|
||||
}
|
||||
PropertyAttributes attr = GetAttr(static_cast<int>(i));
|
||||
bool bIgnore = FilterHelper::IgnoreKeyByFilter<PropertyAttributes>(attr, filter);
|
||||
if (bIgnore) {
|
||||
@ -111,7 +104,7 @@ void LayoutInfo::GetAllKeysForSerialization(int end, std::vector<JSTaggedValue>
|
||||
}
|
||||
}
|
||||
|
||||
std::pair<uint32_t, uint32_t> LayoutInfo::GetNumOfEnumKeys(int end, const JSObject *object) const
|
||||
std::pair<uint32_t, uint32_t> LayoutInfo::GetNumOfEnumKeys(int end) const
|
||||
{
|
||||
ASSERT(end <= NumberOfElements());
|
||||
uint32_t enumKeys = 0;
|
||||
@ -121,9 +114,6 @@ std::pair<uint32_t, uint32_t> LayoutInfo::GetNumOfEnumKeys(int end, const JSObje
|
||||
if (!key.IsString()) {
|
||||
continue;
|
||||
}
|
||||
if (IsUninitializedProperty(object, i)) {
|
||||
continue;
|
||||
}
|
||||
if (GetAttr(i).IsEnumerable()) {
|
||||
enumKeys++;
|
||||
} else {
|
||||
@ -134,8 +124,7 @@ std::pair<uint32_t, uint32_t> LayoutInfo::GetNumOfEnumKeys(int end, const JSObje
|
||||
}
|
||||
|
||||
void LayoutInfo::GetAllEnumKeys(JSThread *thread, int end, int offset, JSHandle<TaggedArray> keyArray,
|
||||
uint32_t *keys, JSHandle<TaggedQueue> shadowQueue, const JSHandle<JSObject> object,
|
||||
int32_t lastLength)
|
||||
uint32_t *keys, JSHandle<TaggedQueue> shadowQueue, int32_t lastLength)
|
||||
{
|
||||
ASSERT(end <= NumberOfElements());
|
||||
ASSERT_PRINT(offset <= static_cast<int>(keyArray->GetLength()),
|
||||
@ -147,9 +136,6 @@ void LayoutInfo::GetAllEnumKeys(JSThread *thread, int end, int offset, JSHandle<
|
||||
if (!keyHandle->IsString()) {
|
||||
continue;
|
||||
}
|
||||
if (IsUninitializedProperty(*object, i)) {
|
||||
continue;
|
||||
}
|
||||
if (GetAttr(i).IsEnumerable()) {
|
||||
bool isDuplicated = JSObject::IsDepulicateKeys(thread, keyArray, lastLength, shadowQueue, keyHandle);
|
||||
if (isDuplicated) {
|
||||
@ -164,8 +150,7 @@ void LayoutInfo::GetAllEnumKeys(JSThread *thread, int end, int offset, JSHandle<
|
||||
*keys += enumKeys;
|
||||
}
|
||||
|
||||
void LayoutInfo::GetAllEnumKeys(JSThread *thread, int end, int offset, JSHandle<TaggedArray> keyArray,
|
||||
uint32_t *keys, const JSHandle<JSObject> object)
|
||||
void LayoutInfo::GetAllEnumKeys(JSThread *thread, int end, int offset, JSHandle<TaggedArray> keyArray, uint32_t *keys)
|
||||
{
|
||||
ASSERT(end <= NumberOfElements());
|
||||
ASSERT_PRINT(offset <= static_cast<int>(keyArray->GetLength()),
|
||||
@ -175,9 +160,6 @@ void LayoutInfo::GetAllEnumKeys(JSThread *thread, int end, int offset, JSHandle<
|
||||
for (int i = 0; i < end; i++) {
|
||||
keyHandle.Update(GetKey(i));
|
||||
if (keyHandle->IsString() && GetAttr(i).IsEnumerable()) {
|
||||
if (IsUninitializedProperty(*object, i)) {
|
||||
continue;
|
||||
}
|
||||
keyArray->Set(thread, enumKeys + offset, keyHandle);
|
||||
enumKeys++;
|
||||
}
|
||||
@ -185,17 +167,6 @@ void LayoutInfo::GetAllEnumKeys(JSThread *thread, int end, int offset, JSHandle<
|
||||
*keys += enumKeys;
|
||||
}
|
||||
|
||||
bool LayoutInfo::IsUninitializedProperty(const JSObject *object, uint32_t index) const
|
||||
{
|
||||
PropertyAttributes attr = GetAttr(index);
|
||||
if (!attr.IsInlinedProps()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
JSTaggedValue val = object->GetPropertyInlinedPropsWithRep(attr.GetOffset(), attr);
|
||||
return val.IsHole();
|
||||
}
|
||||
|
||||
CString LayoutInfo::GetSymbolKeyString(JSTaggedValue key)
|
||||
{
|
||||
auto symbol = JSSymbol::Cast(key);
|
||||
@ -214,7 +185,7 @@ CString LayoutInfo::GetSymbolKeyString(JSTaggedValue key)
|
||||
if (str != "method") {
|
||||
return "";
|
||||
}
|
||||
return str + '_' + ToCString(id);
|
||||
return str.append("_").append(ToCString(id));
|
||||
}
|
||||
|
||||
void LayoutInfo::DumpFieldIndexByPGO(int index, pgo::HClassLayoutDesc* desc)
|
||||
|
@ -94,25 +94,19 @@ public:
|
||||
|
||||
int FindElementWithCache(const JSThread *thread, JSHClass *cls, JSTaggedValue key, int propertiesNumber);
|
||||
int BinarySearch(JSTaggedValue key, int propertiesNumber);
|
||||
void GetAllKeys(const JSThread *thread, int end, int offset, TaggedArray *keyArray,
|
||||
const JSHandle<JSObject> object);
|
||||
void GetAllKeys(const JSThread *thread, int end, int offset, TaggedArray *keyArray);
|
||||
void GetAllKeysForSerialization(int end, std::vector<JSTaggedValue> &keyVector);
|
||||
void GetAllKeysByFilter(const JSThread *thread, uint32_t numberOfProps, uint32_t &keyArrayEffectivelength,
|
||||
TaggedArray *keyArray, const JSHandle<JSObject> object, uint32_t filter);
|
||||
std::pair<uint32_t, uint32_t> GetNumOfEnumKeys(int end, const JSObject *object) const;
|
||||
TaggedArray *keyArray, uint32_t filter);
|
||||
std::pair<uint32_t, uint32_t> GetNumOfEnumKeys(int end) const;
|
||||
void GetAllEnumKeys(JSThread *thread, int end, int offset, JSHandle<TaggedArray> keyArray, uint32_t *keys,
|
||||
JSHandle<TaggedQueue> shadowQueue, const JSHandle<JSObject> object,
|
||||
int32_t lastLength);
|
||||
void GetAllEnumKeys(JSThread *thread, int end, int offset, JSHandle<TaggedArray> keyArray, uint32_t *keys,
|
||||
const JSHandle<JSObject> object);
|
||||
JSHandle<TaggedQueue> shadowQueue, int32_t lastLength);
|
||||
void GetAllEnumKeys(JSThread *thread, int end, int offset, JSHandle<TaggedArray> keyArray, uint32_t *keys);
|
||||
|
||||
void DumpFieldIndexByPGO(int index, pgo::HClassLayoutDesc* desc);
|
||||
bool UpdateFieldIndexByPGO(int index, pgo::HClassLayoutDesc* desc);
|
||||
CString GetSymbolKeyString(JSTaggedValue key);
|
||||
DECL_DUMP()
|
||||
|
||||
private:
|
||||
bool IsUninitializedProperty(const JSObject* object, uint32_t index) const;
|
||||
};
|
||||
} // namespace panda::ecmascript
|
||||
|
||||
|
@ -498,7 +498,7 @@ public:
|
||||
TransWithProtoHandler::Cast(object)->VisitRangeSlot<visitType>(visitor);
|
||||
break;
|
||||
case JSType::STORE_TS_HANDLER:
|
||||
StoreTSHandler::Cast(object)->VisitRangeSlot<visitType>(visitor);
|
||||
StoreAOTHandler::Cast(object)->VisitRangeSlot<visitType>(visitor);
|
||||
break;
|
||||
case JSType::PROPERTY_BOX:
|
||||
PropertyBox::Cast(object)->VisitRangeSlot<visitType>(visitor);
|
||||
|
@ -1734,7 +1734,7 @@ void ObjectFactory::InitializeExtraProperties(const JSHandle<JSHClass> &hclass,
|
||||
auto paddr = reinterpret_cast<uintptr_t>(obj) + hclass->GetObjectSize();
|
||||
// The object which created by AOT speculative hclass, should be initialized as hole, means does not exist,
|
||||
// to follow ECMA spec.
|
||||
JSTaggedType initVal = hclass->IsTS() ? JSTaggedValue::VALUE_HOLE : JSTaggedValue::VALUE_UNDEFINED;
|
||||
JSTaggedType initVal = hclass->IsAOT() ? JSTaggedValue::VALUE_HOLE : JSTaggedValue::VALUE_UNDEFINED;
|
||||
for (uint32_t i = 0; i < inobjPropCount; ++i) {
|
||||
paddr -= JSTaggedValue::TaggedTypeSize();
|
||||
*reinterpret_cast<JSTaggedType *>(paddr) = initVal;
|
||||
@ -3810,9 +3810,8 @@ EcmaString *ObjectFactory::InternString(const JSHandle<JSTaggedValue> &key)
|
||||
JSHandle<TransitionHandler> ObjectFactory::NewTransitionHandler()
|
||||
{
|
||||
NewObjectHook();
|
||||
TransitionHandler *handler =
|
||||
TransitionHandler::Cast(heap_->AllocateYoungOrHugeObject(
|
||||
JSHClass::Cast(thread_->GlobalConstants()->GetTransitionHandlerClass().GetTaggedObject())));
|
||||
TransitionHandler *handler = TransitionHandler::Cast(heap_->AllocateYoungOrHugeObject(
|
||||
JSHClass::Cast(thread_->GlobalConstants()->GetTransitionHandlerClass().GetTaggedObject())));
|
||||
handler->SetHandlerInfo(thread_, JSTaggedValue::Undefined());
|
||||
handler->SetTransitionHClass(thread_, JSTaggedValue::Undefined());
|
||||
return JSHandle<TransitionHandler>(thread_, handler);
|
||||
@ -3846,13 +3845,13 @@ JSHandle<TransWithProtoHandler> ObjectFactory::NewTransWithProtoHandler()
|
||||
return handler;
|
||||
}
|
||||
|
||||
JSHandle<StoreTSHandler> ObjectFactory::NewStoreTSHandler()
|
||||
JSHandle<StoreAOTHandler> ObjectFactory::NewStoreAOTHandler()
|
||||
{
|
||||
NewObjectHook();
|
||||
StoreTSHandler *header =
|
||||
StoreTSHandler::Cast(heap_->AllocateYoungOrHugeObject(
|
||||
JSHClass::Cast(thread_->GlobalConstants()->GetStoreTSHandlerClass().GetTaggedObject())));
|
||||
JSHandle<StoreTSHandler> handler(thread_, header);
|
||||
StoreAOTHandler *header =
|
||||
StoreAOTHandler::Cast(heap_->AllocateYoungOrHugeObject(
|
||||
JSHClass::Cast(thread_->GlobalConstants()->GetStoreAOTHandlerClass().GetTaggedObject())));
|
||||
JSHandle<StoreAOTHandler> handler(thread_, header);
|
||||
handler->SetHandlerInfo(thread_, JSTaggedValue::Undefined());
|
||||
handler->SetProtoCell(thread_, JSTaggedValue::Undefined());
|
||||
handler->SetHolder(thread_, JSTaggedValue::Undefined());
|
||||
|
@ -168,7 +168,7 @@ class PendingJob;
|
||||
class TransitionHandler;
|
||||
class PrototypeHandler;
|
||||
class TransWithProtoHandler;
|
||||
class StoreTSHandler;
|
||||
class StoreAOTHandler;
|
||||
class PropertyBox;
|
||||
class ProtoChangeMarker;
|
||||
class ProtoChangeDetails;
|
||||
@ -225,7 +225,7 @@ public:
|
||||
|
||||
JSHandle<TransWithProtoHandler> NewTransWithProtoHandler();
|
||||
|
||||
JSHandle<StoreTSHandler> NewStoreTSHandler();
|
||||
JSHandle<StoreAOTHandler> NewStoreAOTHandler();
|
||||
|
||||
JSHandle<JSObject> NewEmptyJSObject(uint32_t inlinedProps = JSHClass::DEFAULT_CAPACITY_OF_IN_OBJECTS);
|
||||
|
||||
|
@ -372,7 +372,7 @@ JSTaggedValue ObjectFastOperator::TrySetPropertyByNameThroughCacheAtLocal(JSThre
|
||||
THROW_TYPE_ERROR_AND_RETURN(thread, GET_MESSAGE_STRING(SetReadOnlyProperty),
|
||||
JSTaggedValue::Exception());
|
||||
}
|
||||
if (hclass->IsTS()) {
|
||||
if (hclass->IsAOT()) {
|
||||
auto attrVal = JSObject::Cast(receiver)->GetProperty(hclass, attr);
|
||||
if (attrVal.IsHole()) {
|
||||
return JSTaggedValue::Hole();
|
||||
@ -455,7 +455,7 @@ JSTaggedValue ObjectFastOperator::SetPropertyByName(JSThread *thread, JSTaggedVa
|
||||
THROW_TYPE_ERROR_AND_RETURN(thread, GET_MESSAGE_STRING(SetReadOnlyProperty),
|
||||
JSTaggedValue::Exception());
|
||||
}
|
||||
if (hclass->IsTS()) {
|
||||
if (hclass->IsAOT()) {
|
||||
auto attrVal = JSObject::Cast(holder)->GetProperty(hclass, attr);
|
||||
if (attrVal.IsHole()) {
|
||||
if (receiverHoleEntry == -1 && holder == receiver) {
|
||||
|
@ -94,18 +94,6 @@ void ObjectOperator::UpdateHolder()
|
||||
}
|
||||
}
|
||||
|
||||
void ObjectOperator::UpdateIsTSHClass()
|
||||
{
|
||||
if (!holder_->IsECMAObject()) {
|
||||
SetIsTSHClass(false);
|
||||
return;
|
||||
}
|
||||
auto hclass = JSHandle<JSObject>::Cast(holder_)->GetClass();
|
||||
if (hclass->IsTS()) {
|
||||
SetIsTSHClass(true);
|
||||
}
|
||||
}
|
||||
|
||||
void ObjectOperator::StartLookUp(OperatorType type)
|
||||
{
|
||||
UpdateHolder();
|
||||
@ -487,7 +475,6 @@ void ObjectOperator::LookupProperty()
|
||||
if (holder_->IsJSProxy()) {
|
||||
return;
|
||||
}
|
||||
UpdateIsTSHClass();
|
||||
LookupPropertyInHolder();
|
||||
if (IsFound()) {
|
||||
return;
|
||||
@ -966,7 +953,6 @@ void ObjectOperator::ResetState()
|
||||
SetAttr(0);
|
||||
SetIsOnPrototype(false);
|
||||
SetHasReceiver(false);
|
||||
SetIsTSHClass(false);
|
||||
}
|
||||
|
||||
void ObjectOperator::ResetStateForAddProperty()
|
||||
@ -1076,7 +1062,6 @@ void ObjectOperator::AddPropertyInternal(const JSHandle<JSTaggedValue> &value)
|
||||
}
|
||||
uint32_t index = attr.IsInlinedProps() ? attr.GetOffset() :
|
||||
attr.GetOffset() - obj->GetJSHClass()->GetInlinedProperties();
|
||||
SetIsTSHClass(true);
|
||||
SetIsOnPrototype(false);
|
||||
SetFound(index, value.GetTaggedValue(), attr.GetValue(), true);
|
||||
return;
|
||||
|
@ -157,16 +157,6 @@ public:
|
||||
IsTransitionField::Set(flag, &metaData_);
|
||||
}
|
||||
|
||||
inline bool IsTSHClass() const
|
||||
{
|
||||
return IsTSHClassField::Get(metaData_);
|
||||
}
|
||||
|
||||
inline void SetIsTSHClass(bool flag)
|
||||
{
|
||||
IsTSHClassField::Set(flag, &metaData_);
|
||||
}
|
||||
|
||||
inline PropertyAttributes GetAttr() const
|
||||
{
|
||||
return attributes_;
|
||||
@ -332,19 +322,14 @@ public:
|
||||
void DefineGetter(const JSHandle<JSTaggedValue> &value);
|
||||
|
||||
private:
|
||||
static constexpr uint64_t ATTR_LENGTH = 5;
|
||||
static constexpr uint64_t INDEX_LENGTH = 32;
|
||||
|
||||
using IsFastModeField = BitField<bool, 0, 1>;
|
||||
using IsOnPrototypeField = IsFastModeField::NextFlag; // 1: on prototype
|
||||
using HasReceiverField = IsOnPrototypeField::NextFlag;
|
||||
using IsTransitionField = HasReceiverField::NextFlag;
|
||||
using IsTSHClassField = IsTransitionField::NextFlag;
|
||||
// found dictionary obj between receriver and holder
|
||||
using IsFoundDictField = IsTSHClassField::NextFlag;
|
||||
using IsFoundDictField = IsTransitionField::NextFlag;
|
||||
|
||||
void UpdateHolder();
|
||||
void UpdateIsTSHClass();
|
||||
void StartLookUp(OperatorType type);
|
||||
void StartGlobalLookUp(OperatorType type);
|
||||
void HandleKey(const JSHandle<JSTaggedValue> &key);
|
||||
|
@ -1105,13 +1105,13 @@ bool PGOProfiler::DumpICByNameWithHandler(ApEntityId abcId, const CString &recor
|
||||
auto accessorMethodId = prototypeHandler->GetAccessorMethodId();
|
||||
return AddObjectInfo(
|
||||
abcId, recordName, methodId, bcOffset, hclass, holderHClass, holderHClass, accessorMethodId);
|
||||
} else if (secondValue.IsStoreTSHandler()) {
|
||||
StoreTSHandler *storeTSHandler = StoreTSHandler::Cast(secondValue.GetTaggedObject());
|
||||
auto cellValue = storeTSHandler->GetProtoCell();
|
||||
} else if (secondValue.IsStoreAOTHandler()) {
|
||||
StoreAOTHandler *storeAOTHandler = StoreAOTHandler::Cast(secondValue.GetTaggedObject());
|
||||
auto cellValue = storeAOTHandler->GetProtoCell();
|
||||
if (CheckProtoChangeMarker(cellValue)) {
|
||||
return false;
|
||||
}
|
||||
auto holder = storeTSHandler->GetHolder();
|
||||
auto holder = storeAOTHandler->GetHolder();
|
||||
auto holderHClass = holder.GetTaggedObject()->GetClass();
|
||||
return AddObjectInfo(abcId, recordName, methodId, bcOffset, hclass, holderHClass, holderHClass);
|
||||
}
|
||||
|
@ -1142,7 +1142,7 @@ JSTaggedValue RuntimeStubs::RuntimeSetClassInheritanceRelationship(JSThread *thr
|
||||
|
||||
// ctor -> hclass -> EnableProtoChangeMarker
|
||||
auto constructor = JSFunction::Cast(ctor.GetTaggedValue().GetTaggedObject());
|
||||
if (constructor->GetClass()->IsTS()) {
|
||||
if (constructor->GetClass()->IsAOT()) {
|
||||
JSHClass::EnableProtoChangeMarker(thread, JSHandle<JSHClass>(thread, constructor->GetClass()));
|
||||
// prototype -> hclass -> EnableProtoChangeMarker
|
||||
JSHClass::EnableProtoChangeMarker(thread,
|
||||
@ -1155,13 +1155,13 @@ JSTaggedValue RuntimeStubs::RuntimeSetClassInheritanceRelationship(JSThread *thr
|
||||
JSTaggedValue protoOrHClass = JSHandle<JSFunction>(ctor)->GetProtoOrHClass();
|
||||
if (protoOrHClass.IsJSHClass()) {
|
||||
JSHClass *ihc = JSHClass::Cast(protoOrHClass.GetTaggedObject());
|
||||
if (ihc->IsTS()) {
|
||||
if (ihc->IsAOT()) {
|
||||
JSHandle<JSHClass> ihcHandle(thread, ihc);
|
||||
JSHClass::EnableProtoChangeMarker(thread, ihcHandle);
|
||||
}
|
||||
} else {
|
||||
JSHandle<JSObject> protoHandle(thread, protoOrHClass);
|
||||
if (protoHandle->GetJSHClass()->IsTS()) {
|
||||
if (protoHandle->GetJSHClass()->IsAOT()) {
|
||||
JSHClass::EnablePHCProtoChangeMarker(thread, JSHandle<JSHClass>(thread, protoHandle->GetJSHClass()));
|
||||
}
|
||||
}
|
||||
@ -2563,7 +2563,7 @@ JSTaggedValue RuntimeStubs::RuntimeDefineGetterSetterByValue(JSThread *thread, c
|
||||
JSObject::DefineOwnProperty(thread, obj, propKey, desc);
|
||||
auto holderTraHClass = obj->GetJSHClass();
|
||||
if (receiverHClass != holderTraHClass) {
|
||||
if (holderTraHClass->IsTS()) {
|
||||
if (holderTraHClass->IsAOT()) {
|
||||
JSHandle<JSHClass> phcHandle(thread, holderTraHClass);
|
||||
JSHClass::EnablePHCProtoChangeMarker(thread, phcHandle);
|
||||
}
|
||||
|
@ -1081,9 +1081,9 @@ HWTEST_F_L0(EcmaDumpTest, HeapProfileDump)
|
||||
break;
|
||||
}
|
||||
case JSType::STORE_TS_HANDLER: {
|
||||
CHECK_DUMP_FIELDS(TaggedObject::TaggedObjectSize(), StoreTSHandler::SIZE, 3U);
|
||||
JSHandle<StoreTSHandler> storeTSHandler = factory->NewStoreTSHandler();
|
||||
DUMP_FOR_HANDLE(storeTSHandler);
|
||||
CHECK_DUMP_FIELDS(TaggedObject::TaggedObjectSize(), StoreAOTHandler::SIZE, 3U);
|
||||
JSHandle<StoreAOTHandler> storeAOTHandler = factory->NewStoreAOTHandler();
|
||||
DUMP_FOR_HANDLE(storeAOTHandler);
|
||||
break;
|
||||
}
|
||||
case JSType::PROPERTY_BOX: {
|
||||
|
@ -117,7 +117,6 @@ void GetAllKeysCommon(JSThread *thread, bool enumKeys = false)
|
||||
PropertyAttributes defaultAttr = PropertyAttributes::Default();
|
||||
JSHandle<JSTaggedValue> key3(factory->NewFromASCII("3"));
|
||||
|
||||
JSHandle<JSObject> objectHandle = factory->NewEmptyJSObject();
|
||||
JSHandle<TaggedArray> keyArray = factory->NewTaggedArray(infoLength);
|
||||
JSHandle<LayoutInfo> layoutInfoHandle = factory->CreateLayoutInfo(infoLength);
|
||||
EXPECT_TRUE(*layoutInfoHandle != nullptr);
|
||||
@ -138,11 +137,11 @@ void GetAllKeysCommon(JSThread *thread, bool enumKeys = false)
|
||||
}
|
||||
if (enumKeys) {
|
||||
uint32_t keys = 0;
|
||||
layoutInfoHandle->GetAllEnumKeys(thread, infoLength, 0, keyArray, &keys, objectHandle); // 0: offset
|
||||
layoutInfoHandle->GetAllEnumKeys(thread, infoLength, 0, keyArray, &keys); // 0: offset
|
||||
EXPECT_EQ(keyArray->Get(0), key3.GetTaggedValue());
|
||||
EXPECT_EQ(keys, 1U);
|
||||
} else {
|
||||
layoutInfoHandle->GetAllKeys(thread, infoLength, 0, *keyArray, objectHandle); // 0: offset
|
||||
layoutInfoHandle->GetAllKeys(thread, infoLength, 0, *keyArray); // 0: offset
|
||||
layoutInfoHandle->GetAllKeysForSerialization(infoLength, keyVector);
|
||||
EXPECT_EQ(keyArray->GetLength(), keyVector.size());
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user