@@ -388,7 +388,17 @@ namespace Js
388
388
#endif
389
389
// This can happen if object header inlining is deoptimized, and we haven't built a full path from the root.
390
390
// For now, just punt this case.
391
- return TryConvertToSimpleDictionaryType (instance, GetPathLength ())->SetAttributes (instance, propertyId, ObjectSlotAttributesToPropertyAttributes (propertyAttributes));
391
+
392
+ if (setAllAttributes)
393
+ {
394
+ // We could be trying to convert an accessor to a data property, or something similar, so do the type handler conversion here and let the caller handle setting the attributes.
395
+ TryConvertToSimpleDictionaryType (instance, GetPathLength ());
396
+ return false ;
397
+ }
398
+ else
399
+ {
400
+ return TryConvertToSimpleDictionaryType (instance, GetPathLength ())->SetAttributes (instance, propertyId, ObjectSlotAttributesToPropertyAttributes (propertyAttributes));
401
+ }
392
402
}
393
403
predTypeHandler = PathTypeHandlerBase::FromTypeHandler (currentType->GetTypeHandler ());
394
404
}
@@ -752,16 +762,25 @@ namespace Js
752
762
// In CacheOperators::CachePropertyWrite we ensure that we never cache property adds for types that aren't shared.
753
763
Assert (!instance->GetDynamicType ()->GetIsShared () || GetIsShared ());
754
764
765
+ bool setAttrDone;
755
766
if (setAttributes)
756
767
{
757
- this ->SetAttributesHelper (instance, propertyId, index, GetAttributeArray (), attr, true );
768
+ setAttrDone = this ->SetAttributesHelper (instance, propertyId, index, GetAttributeArray (), attr, true );
769
+ if (!setAttrDone)
770
+ {
771
+ return instance->GetTypeHandler ()->SetPropertyWithAttributes (instance, propertyId, value, attr, info, flags, possibleSideEffects);
772
+ }
758
773
}
759
774
else if (isInit)
760
775
{
761
776
ObjectSlotAttributes * attributes = this ->GetAttributeArray ();
762
777
if (attributes && (attributes[index] & ObjectSlotAttr_Accessor))
763
778
{
764
- this ->SetAttributesHelper (instance, propertyId, index, attributes, (ObjectSlotAttributes)(attributes[index] & ~ObjectSlotAttr_Accessor), true );
779
+ setAttrDone = this ->SetAttributesHelper (instance, propertyId, index, attributes, (ObjectSlotAttributes)(attributes[index] & ~ObjectSlotAttr_Accessor), true );
780
+ if (!setAttrDone)
781
+ {
782
+ return instance->GetTypeHandler ()->InitProperty (instance, propertyId, value, flags, info);
783
+ }
765
784
// We're changing an accessor into a data property at object init time. Don't cache this transition from setter to non-setter,
766
785
// as it behaves differently from a normal set property.
767
786
PropertyValueInfo::SetNoCache (info, instance);
0 commit comments