Lines Matching refs:hclass

287         // The transition hclass from AOT, which does not have a prototype, needs to be reset here.
295 // The transition hclass from AOT, which does not have protochangemarker, needs to be reset here
314 // update hclass in object.
333 // 2. new a hclass
344 // 3. Add newClass to old hclass's parent's transitions.
367 // 2. new a hclass
420 // use transPhc to replace the hclass of proto
439 // 1. new a hclass
466 // Because the heap-space of hclass is non-movable, this function can be non-static.
472 const JSHandle<JSHClass> &hclass,
476 // `hclass` can become prototype inside `TransitionProto` if `hclass` is HClass of `proto`.
478 auto wasPrototype = hclass->IsPrototype();
479 JSHandle<JSHClass> newClass = JSHClass::TransitionProto(thread, hclass, proto, isChangeProto);
481 ASSERT(hclass->IsPrototype());
482 JSHClass::NotifyHclassChanged(thread, hclass, newClass);
490 JSHandle<JSHClass> hclass(thread, object->GetJSHClass());
491 auto newClass = SetPrototypeWithNotification(thread, hclass, proto, isChangeProto);
500 // Because the heap-space of hclass is non-movable, this function can be non-static.
509 JSHandle<JSHClass> hclass(thread, proto->GetTaggedObject()->GetClass());
510 ASSERT(!Region::ObjectAddressToRange(reinterpret_cast<TaggedObject *>(*hclass))->InReadOnlySpace());
511 if (!hclass->IsPrototype()) {
512 // Situations for clone proto hclass:
513 // 1: unshared non-ts hclass
514 // 2: no matter whether hclass is ts or not when set function prototype
515 if ((!hclass->IsTS() && !hclass->IsJSShared()) || isChangeProto) {
522 // stability of the prototype-chain o2 -> o1. If directly marking the o1.hclass1 as a prototype hclass,
525 // At here, When a JSArray with initial hclass is set as a proto,
526 // we substitute its hclass with preserved proto hclass.
528 if (ProtoIsFastJSArray(thread, proto, hclass)) {
529 newProtoClass = JSHandle<JSHClass>(thread, thread->GetArrayInstanceHClass(hclass->GetElementsKind(),
532 newProtoClass = JSHClass::Clone(thread, hclass);
545 // After the hclass is updated, check whether the proto chain status of ic is updated.
546 NotifyHclassChanged(thread, hclass, newProtoClass);
552 thread->GetEcmaVM()->GetPGOProfiler()->UpdateRootProfileTypeSafe(*hclass, *newProtoClass);
555 // There is no sharing in AOT hclass. Therefore, it is not necessary or possible to clone here.
556 hclass->SetIsPrototype(true);
563 // 1. new a hclass
586 // 1. new a hclass
590 // 2. If it is dictionary, migrate should change layout. otherwise, copy the hclass only.
633 // 1. Create hclass and copy layout
643 auto hclass = JSHClass::Cast(newHClass.GetTaggedValue().GetTaggedObject());
644 int entry = JSHClass::FindPropertyEntry(thread, hclass, key.GetTaggedValue());
648 // 3. update hclass in object.
667 JSHClass *hclass = JSHClass::Cast(hclassVal.GetTaggedObject());
669 return (targetHClass == hclass || targetHClass == hclassWithProto);
678 // currently we only support initial array hclass
689 JSHClass *hclass = JSHClass::Cast(hclassVal.GetTaggedObject());
690 obj->SynchronizedSetClass(thread, hclass);
693 JSHandle<JSHClass>(thread, hclass));
753 void JSHClass::UpdateFieldType(JSHClass *hclass, const PropertyAttributes &attr)
756 JSHClass *ownHClass = FindFieldOwnHClass(hclass, attr);
760 JSHClass *JSHClass::FindFieldOwnHClass(JSHClass *hclass, const PropertyAttributes &attr)
763 JSTaggedValue parent(hclass);
764 JSHClass *curHClass = hclass;
813 auto hclass = receiver->GetJSHClass();
814 auto layout = LayoutInfo::Cast(hclass->GetLayout().GetTaggedObject());
816 if (thread->IsPGOProfilerEnable() && !hclass->IsJSShared() && attr.UpdateTrackType(value.GetTaggedValue())) {
817 UpdateFieldType(hclass, attr);
904 // The old hclass is the same as new one
908 // For now, at pgo profiling stage, we use ProfileType::Kind to mark a hclass is CHC, PHC or IHC.
925 // when generating hclass at aot, its child hclass and itself will not have IsPrototype bit set as true.
927 // However, we currently support hclass substitution when executing 'C3.valueOf' for C3's oldHclass at runtime.
931 // Good neww is our AOT hclass can not be shared, hence we can set newHclass IsPrototype as true at here.
939 void JSHClass::NotifyAccessorChanged(const JSThread *thread, JSHandle<JSHClass> hclass)
942 JSTaggedValue markerValue = hclass->GetProtoChangeMarker();
948 JSTaggedValue protoDetailsValue = hclass->GetProtoChangeDetails();
975 // Find the prototype chain as far as the hclass has not been registered.
1113 PropertyLookupResult JSHClass::LookupPropertyInAotHClass(const JSThread *thread, JSHClass *hclass, JSTaggedValue key)
1116 ASSERT(hclass->IsTS());
1119 if (hclass->IsDictionaryMode()) {
1125 int entry = JSHClass::FindPropertyEntry(thread, hclass, key);
1130 PropertyAttributes attr = LayoutInfo::Cast(hclass->GetLayout().GetTaggedObject())->GetAttr(entry);
1133 result.SetOffset(hclass->GetInlinedPropertiesOffset(entry));
1136 result.SetOffset(attr.GetOffset() - hclass->GetInlinedProperties());
1154 PropertyLookupResult JSHClass::LookupPropertyInPGOHClass(const JSThread *thread, JSHClass *hclass, JSTaggedValue key)
1159 if (hclass->IsDictionaryMode()) {
1164 int entry = JSHClass::FindPropertyEntry(thread, hclass, key);
1169 PropertyAttributes attr = LayoutInfo::Cast(hclass->GetLayout().GetTaggedObject())->GetAttr(entry);
1172 result.SetOffset(hclass->GetInlinedPropertiesOffset(entry));
1175 result.SetOffset(attr.GetOffset() - hclass->GetInlinedProperties());
1194 PropertyLookupResult JSHClass::LookupPropertyInBuiltinPrototypeHClass(const JSThread *thread, JSHClass *hclass,
1198 ASSERT(hclass->IsPrototype());
1201 if (hclass->IsDictionaryMode()) {
1206 int entry = JSHClass::FindPropertyEntry(thread, hclass, key);
1210 if (entry == -1 || static_cast<uint32_t>(entry) >= hclass->GetInlinedProperties()) {
1217 PropertyAttributes attr = LayoutInfo::Cast(hclass->GetLayout().GetTaggedObject())->GetAttr(entry);
1220 result.SetOffset(hclass->GetInlinedPropertiesOffset(entry));
1223 result.SetOffset(attr.GetOffset() - hclass->GetInlinedProperties());
1272 JSHandle<JSHClass> hclass = factory->NewEcmaHClass(size, type, maxNum);
1275 rootDesc->IterateProps([thread, factory, &index, hclass, layout](const pgo::PropertyDesc& propDesc) {
1281 hclass->SetIsAllTaggedProp(false);
1288 hclass->SetLayout(thread, layout);
1289 hclass->SetNumberOfProps(numOfProps);
1290 hclass->SetTS(true);
1291 return hclass;
1303 JSHandle<JSHClass> hclass = factory->GetObjectLiteralRootHClass(maxNum);
1305 hclass->SetPrototype(thread, JSTaggedValue::Null());
1306 hclass->SetLayout(thread, layout);
1307 hclass->SetTS(true);
1308 rootDesc->IterateProps([thread, factory, &index, &hclass](const pgo::PropertyDesc& propDesc) {
1314 hclass->SetIsAllTaggedProp(false);
1320 JSHandle<JSHClass> child = SetPropertyOfObjHClass(thread, hclass, key, attributes, rep);
1321 child->SetParent(thread, hclass);
1324 hclass = child;
1326 return hclass;
1369 bool JSHClass::DumpRootHClassByPGO(const JSHClass* hclass, HClassLayoutDesc* desc)
1372 if (hclass->IsDictionaryMode()) {
1376 LayoutInfo *layout = LayoutInfo::Cast(hclass->GetLayout().GetTaggedObject());
1377 int element = static_cast<int>(hclass->NumberOfProps());
1384 bool JSHClass::DumpChildHClassByPGO(const JSHClass* hclass, HClassLayoutDesc* desc)
1387 if (hclass->IsDictionaryMode()) {
1390 if (hclass->PropsIsEmpty()) {
1393 uint32_t last = hclass->LastPropIndex();
1394 LayoutInfo *layoutInfo = LayoutInfo::Cast(hclass->GetLayout().GetTaggedObject());
1399 bool JSHClass::UpdateChildLayoutDescByPGO(const JSHClass* hclass, HClassLayoutDesc* childDesc)
1402 if (hclass->IsDictionaryMode()) {
1405 if (hclass->PropsIsEmpty()) {
1408 uint32_t last = hclass->LastPropIndex();
1409 LayoutInfo *layoutInfo = LayoutInfo::Cast(hclass->GetLayout().GetTaggedObject());
1413 bool JSHClass::UpdateRootLayoutDescByPGO(const JSHClass* hclass, HClassLayoutDesc* desc)
1416 if (hclass->IsDictionaryMode()) {
1422 LayoutInfo *layout = LayoutInfo::Cast(hclass->GetLayout().GetTaggedObject());
1432 auto hclass = JSHClass::Cast(JSTaggedValue(hclassVal).GetTaggedObject());
1433 if (hclass->IsDictionaryMode()) {
1438 LayoutInfo *layout = LayoutInfo::Cast(hclass->GetLayout().GetTaggedObject());
1439 int element = static_cast<int>(hclass->NumberOfProps());
1462 PropertyLookupResult JSHClass::LookupPropertyInBuiltinHClass(const JSThread *thread, JSHClass *hclass,
1468 if (hclass->IsDictionaryMode()) {
1473 int entry = JSHClass::FindPropertyEntry(thread, hclass, key);
1478 PropertyAttributes attr = LayoutInfo::Cast(hclass->GetLayout().GetTaggedObject())->GetAttr(entry);
1481 result.SetOffset(hclass->GetInlinedPropertiesOffset(entry));
1484 result.SetOffset(attr.GetOffset() - hclass->GetInlinedProperties());
1523 JSHandle<JSHClass> hclass =
1527 CreateSInlinedLayout(thread, descs, hclass, parentHClass);
1529 CreateSDictLayout(thread, descs, hclass, parentHClass);
1532 return hclass;
1537 auto hclass = CreateSHClass(thread, descs, nullptr, true);
1538 hclass->SetClassConstructor(true);
1539 hclass->SetConstructor(true);
1540 return hclass;
1545 auto hclass = CreateSHClass(thread, descs);
1546 hclass->SetClassPrototype(true);
1547 hclass->SetIsPrototype(true);
1548 return hclass;
1553 const JSHandle<JSHClass> &hclass,
1586 auto entry = layout->FindElementWithCache(thread, *hclass, key.GetTaggedValue(), index);
1597 hclass->SetLayout(thread, layout);
1598 hclass->SetNumberOfProps(index);
1599 auto inlinedPropsLength = hclass->GetInlinedProperties();
1602 hclass->SetObjectSize(hclass->GetObjectSize() - duplicatedSize);
1608 const JSHandle<JSHClass> &hclass,
1659 hclass->SetLayout(thread, dict);
1660 hclass->SetNumberOfProps(0);
1661 hclass->SetIsDictionaryMode(true);
1663 bool JSHClass::IsNeedNotifyHclassChangedForAotTransition(const JSThread *thread, const JSHandle<JSHClass> &hclass,
1666 JSMutableHandle<JSObject> protoHandle(thread, hclass->GetPrototype());