@@ -716,9 +716,14 @@ namespace Js
716
716
717
717
template <typename T>
718
718
template <bool allowLetConstGlobal>
719
- void DictionaryTypeHandlerBase<T>::SetPropertyWithDescriptor(DynamicObject* instance, PropertyId propertyId, DictionaryPropertyDescriptor<T> * descriptor,
719
+ void DictionaryTypeHandlerBase<T>::SetPropertyWithDescriptor(DynamicObject* instance,
720
+ PropertyRecord const * propertyRecord,
721
+ DictionaryPropertyDescriptor<T> ** pdescriptor,
720
722
Var value, PropertyOperationFlags flags, PropertyValueInfo* info)
721
723
{
724
+ Assert (pdescriptor && *pdescriptor);
725
+ DictionaryPropertyDescriptor<T> * descriptor = *pdescriptor;
726
+ PropertyId propertyId = propertyRecord->GetPropertyId ();
722
727
Assert (instance);
723
728
Assert ((descriptor->Attributes & PropertyDeleted) == 0 || (allowLetConstGlobal && descriptor->IsShadowed ));
724
729
@@ -784,14 +789,23 @@ namespace Js
784
789
785
790
// Wait for the setter to return before setting up the inline cache info, as the setter may change
786
791
// the attributes
787
- T dataSlot = descriptor-> template GetDataPropertyIndex < false >();
788
- if (dataSlot != NoSlots )
792
+
793
+ if (propertyMap-> TryGetReference (propertyRecord, pdescriptor) )
789
794
{
790
- SetPropertyValueInfo (info, instance, dataSlot, descriptor->Attributes );
795
+ descriptor = *pdescriptor;
796
+ T dataSlot = descriptor->template GetDataPropertyIndex <false >();
797
+ if (dataSlot != NoSlots)
798
+ {
799
+ SetPropertyValueInfo (info, instance, dataSlot, descriptor->Attributes );
800
+ }
801
+ else if (descriptor->GetSetterPropertyIndex () != NoSlots)
802
+ {
803
+ SetPropertyValueInfo (info, instance, descriptor->GetSetterPropertyIndex (), descriptor->Attributes , InlineCacheSetterFlag);
804
+ }
791
805
}
792
- else if (descriptor-> GetSetterPropertyIndex () != NoSlots)
806
+ else
793
807
{
794
- SetPropertyValueInfo (info, instance, descriptor-> GetSetterPropertyIndex (), descriptor-> Attributes , InlineCacheSetterFlag) ;
808
+ *pdescriptor = nullptr ;
795
809
}
796
810
}
797
811
SetPropertyUpdateSideEffect (instance, propertyId, value, SideEffects_Any);
@@ -854,7 +868,7 @@ namespace Js
854
868
{
855
869
descriptor->ConvertToData ();
856
870
}
857
- SetPropertyWithDescriptor<allowLetConstGlobal>(instance, propertyId, descriptor, value, flags, info);
871
+ SetPropertyWithDescriptor<allowLetConstGlobal>(instance, propertyRecord, & descriptor, value, flags, info);
858
872
return true ;
859
873
}
860
874
@@ -1895,25 +1909,26 @@ namespace Js
1895
1909
1896
1910
if (attributes & PropertyLetConstGlobal)
1897
1911
{
1898
- SetPropertyWithDescriptor<true >(instance, propertyId, descriptor, value, flags, info);
1912
+ SetPropertyWithDescriptor<true >(instance, propertyRecord, & descriptor, value, flags, info);
1899
1913
}
1900
1914
else
1901
1915
{
1902
- SetPropertyWithDescriptor<false >(instance, propertyId, descriptor, value, flags, info);
1916
+ SetPropertyWithDescriptor<false >(instance, propertyRecord, & descriptor, value, flags, info);
1903
1917
}
1904
-
1905
- if (descriptor->Attributes & PropertyEnumerable)
1918
+ if (descriptor != nullptr ) // descriptor can dissappear, so this reference may not exist.
1906
1919
{
1907
- instance->SetHasNoEnumerableProperties (false );
1908
- }
1909
-
1910
- if (!(descriptor->Attributes & PropertyWritable))
1911
- {
1912
- this ->ClearHasOnlyWritableDataProperties ();
1913
- if (GetFlags () & IsPrototypeFlag)
1920
+ if (descriptor->Attributes & PropertyEnumerable)
1914
1921
{
1915
- scriptContext->InvalidateStoreFieldCaches (propertyId);
1916
- instance->GetLibrary ()->NoPrototypeChainsAreEnsuredToHaveOnlyWritableDataProperties ();
1922
+ instance->SetHasNoEnumerableProperties (false );
1923
+ }
1924
+ if (!(descriptor->Attributes & PropertyWritable))
1925
+ {
1926
+ this ->ClearHasOnlyWritableDataProperties ();
1927
+ if (GetFlags () & IsPrototypeFlag)
1928
+ {
1929
+ scriptContext->InvalidateStoreFieldCaches (propertyId);
1930
+ instance->GetLibrary ()->NoPrototypeChainsAreEnsuredToHaveOnlyWritableDataProperties ();
1931
+ }
1917
1932
}
1918
1933
}
1919
1934
0 commit comments