|
|
@@ -6624,7 +6624,25 @@ SetElementIHelper_INDEX_TYPE_IS_NUMBER:
|
|
|
|
|
|
if (constructorBody->GetHasOnlyThisStmts())
|
|
|
{
|
|
|
- if (typeHandler->IsSharable())
|
|
|
+ if (!typeHandler->IsSharable())
|
|
|
+ {
|
|
|
+ // Dynamic type created is not sharable.
|
|
|
+ // So in future don't try to check for "this assignment optimization".
|
|
|
+ constructorBody->SetHasOnlyThisStmts(false);
|
|
|
+#if DBG_DUMP
|
|
|
+ TraceUpdateConstructorCache(constructorCache, constructorBody, false, _u("because final type is not shareable"));
|
|
|
+#endif
|
|
|
+ }
|
|
|
+ else if (typeHandler->GetPropertyCount() >= Js::PropertyIndexRanges<PropertyIndex>::MaxValue)
|
|
|
+ {
|
|
|
+ // Dynamic type created has too many properties.
|
|
|
+ // So in future don't try to check for "this assignment optimization".
|
|
|
+ constructorBody->SetHasOnlyThisStmts(false);
|
|
|
+#if DBG_DUMP
|
|
|
+ TraceUpdateConstructorCache(constructorCache, constructorBody, false, _u("because final type has too many properties"));
|
|
|
+#endif
|
|
|
+ }
|
|
|
+ else
|
|
|
{
|
|
|
#if DBG
|
|
|
bool cachedProtoCanBeCached = false;
|
|
|
@@ -6643,7 +6661,6 @@ SetElementIHelper_INDEX_TYPE_IS_NUMBER:
|
|
|
if ((profileInfo != nullptr && profileInfo->GetImplicitCallFlags() <= ImplicitCall_None) ||
|
|
|
CheckIfPrototypeChainHasOnlyWritableDataProperties(type->GetPrototype()))
|
|
|
{
|
|
|
- Assert(typeHandler->GetPropertyCount() < Js::PropertyIndexRanges<PropertyIndex>::MaxValue);
|
|
|
|
|
|
for (PropertyIndex pi = 0; pi < typeHandler->GetPropertyCount(); pi++)
|
|
|
{
|
|
|
@@ -6682,15 +6699,6 @@ SetElementIHelper_INDEX_TYPE_IS_NUMBER:
|
|
|
}
|
|
|
}
|
|
|
#endif
|
|
|
-#endif
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- // Dynamic type created is not sharable.
|
|
|
- // So in future don't try to check for "this assignment optimization".
|
|
|
- constructorBody->SetHasOnlyThisStmts(false);
|
|
|
-#if DBG_DUMP
|
|
|
- TraceUpdateConstructorCache(constructorCache, constructorBody, false, _u("because final type is not shareable"));
|
|
|
#endif
|
|
|
}
|
|
|
}
|