@@ -5706,11 +5706,18 @@ using namespace Js;
5706
5706
uint formalsSlotLimit = (firstFuncSlot != Constants::NoProperty) ? (uint)firstFuncSlot :
5707
5707
(firstVarSlot != Constants::NoProperty) ? (uint)firstVarSlot :
5708
5708
propIds->count;
5709
- type = PathTypeHandlerBase::CreateNewScopeObject(scriptContext, type, propIds, PropertyLet, formalsSlotLimit);
5709
+ if (func->GetFunctionBody()->HasReferenceableBuiltInArguments())
5710
+ {
5711
+ type = PathTypeHandlerBase::CreateNewScopeObject<true>(scriptContext, type, propIds, PropertyLet, formalsSlotLimit);
5712
+ }
5713
+ else
5714
+ {
5715
+ type = PathTypeHandlerBase::CreateNewScopeObject<false>(scriptContext, type, propIds, PropertyLet, formalsSlotLimit);
5716
+ }
5710
5717
}
5711
5718
else
5712
5719
{
5713
- type = PathTypeHandlerBase::CreateNewScopeObject(scriptContext, type, propIds);
5720
+ type = PathTypeHandlerBase::CreateNewScopeObject<false> (scriptContext, type, propIds);
5714
5721
}
5715
5722
*literalType = type;
5716
5723
}
@@ -7167,7 +7174,26 @@ using namespace Js;
7167
7174
// CONSIDER : When we delay type sharing until the second instance is created, pass an argument indicating we want the types
7168
7175
// and handlers created here to be marked as shared up-front. This is to ensure we don't get any fixed fields and that the handler
7169
7176
// is ready for storing values directly to slots.
7170
- DynamicType* newType = PathTypeHandlerBase::CreateNewScopeObject(scriptContext, frameObject->GetDynamicType(), propIds, nonSimpleParamList ? PropertyLetDefaults : PropertyNone);
7177
+ DynamicType* newType = nullptr;
7178
+ if (nonSimpleParamList)
7179
+ {
7180
+ bool skipLetAttrForArguments = ((JavascriptGeneratorFunction::Is(funcCallee) || JavascriptAsyncFunction::Is(funcCallee)) ?
7181
+ JavascriptGeneratorFunction::FromVar(funcCallee)->GetGeneratorVirtualScriptFunction()->GetFunctionBody()->HasReferenceableBuiltInArguments()
7182
+ : funcCallee->GetFunctionBody()->HasReferenceableBuiltInArguments());
7183
+
7184
+ if (skipLetAttrForArguments)
7185
+ {
7186
+ newType = PathTypeHandlerBase::CreateNewScopeObject<true>(scriptContext, frameObject->GetDynamicType(), propIds, PropertyLetDefaults);
7187
+ }
7188
+ else
7189
+ {
7190
+ newType = PathTypeHandlerBase::CreateNewScopeObject<false>(scriptContext, frameObject->GetDynamicType(), propIds, PropertyLetDefaults);
7191
+ }
7192
+ }
7193
+ else
7194
+ {
7195
+ newType = PathTypeHandlerBase::CreateNewScopeObject<false>(scriptContext, frameObject->GetDynamicType(), propIds);
7196
+ }
7171
7197
int oldSlotCapacity = frameObject->GetDynamicType()->GetTypeHandler()->GetSlotCapacity();
7172
7198
int newSlotCapacity = newType->GetTypeHandler()->GetSlotCapacity();
7173
7199
__analysis_assume((uint32)newSlotCapacity >= formalsCount);
@@ -7267,7 +7293,22 @@ using namespace Js;
7267
7293
// CONSIDER : When we delay type sharing until the second instance is created, pass an argument indicating we want the types
7268
7294
// and handlers created here to be marked as shared up-front. This is to ensure we don't get any fixed fields and that the handler
7269
7295
// is ready for storing values directly to slots.
7270
- DynamicType* newType = PathTypeHandlerBase::CreateNewScopeObject(scriptContext, frameObject->GetDynamicType(), calleeBody->GetFormalsPropIdArray(), nonSimpleParamList ? PropertyLetDefaults : PropertyNone);
7296
+ DynamicType* newType = nullptr;
7297
+ if (nonSimpleParamList)
7298
+ {
7299
+ if (calleeBody->HasReferenceableBuiltInArguments())
7300
+ {
7301
+ newType = PathTypeHandlerBase::CreateNewScopeObject<true>(scriptContext, frameObject->GetDynamicType(), calleeBody->GetFormalsPropIdArray(), PropertyLetDefaults);
7302
+ }
7303
+ else
7304
+ {
7305
+ newType = PathTypeHandlerBase::CreateNewScopeObject<false>(scriptContext, frameObject->GetDynamicType(), calleeBody->GetFormalsPropIdArray(), PropertyLetDefaults);
7306
+ }
7307
+ }
7308
+ else
7309
+ {
7310
+ newType = PathTypeHandlerBase::CreateNewScopeObject<false>(scriptContext, frameObject->GetDynamicType(), calleeBody->GetFormalsPropIdArray());
7311
+ }
7271
7312
7272
7313
int oldSlotCapacity = frameObject->GetDynamicType()->GetTypeHandler()->GetSlotCapacity();
7273
7314
int newSlotCapacity = newType->GetTypeHandler()->GetSlotCapacity();
0 commit comments