Skip to content

Commit 2bd57e5

Browse files
author
Atul Katti
committed
[MERGE #5454 @atulkatti] MSFT:16597129 Relax assert in TypePropertyCache::TryGetProperty for cases where implicit calls may be disabled.
Merge pull request #5454 from atulkatti:Bug16597129.TypePropertyCache.CEO.1
2 parents 78bdc0a + fc32ae2 commit 2bd57e5

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

lib/Runtime/Language/InlineCache.h

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -458,8 +458,11 @@ namespace Js
458458
ScriptContext *const requestContext)
459459
{
460460
*propertyValue = InlineCache::GetPropertyValue<slotType>(cache->GetSourceObject<cacheType>(propertyObject), cache->GetSlotIndex<cacheType>());
461-
Assert(*propertyValue == JavascriptOperators::GetProperty(propertyObject, propertyId, requestContext) ||
462-
(RootObjectBase::Is(propertyObject) && *propertyValue == JavascriptOperators::GetRootProperty(propertyObject, propertyId, requestContext)));
461+
DebugOnly(Var getPropertyValue = JavascriptOperators::GetProperty(propertyObject, propertyId, requestContext));
462+
Assert(*propertyValue == getPropertyValue ||
463+
(RootObjectBase::Is(propertyObject) && *propertyValue == JavascriptOperators::GetRootProperty(propertyObject, propertyId, requestContext))||
464+
// In some cases, such as CustomExternalObject, if implicit calls are disabled GetPropertyQuery may return null. See CustomExternalObject::GetPropertyQuery for an example.
465+
(getPropertyValue == requestContext->GetLibrary()->GetNull() && requestContext->GetThreadContext()->IsDisableImplicitCall() && propertyObject->GetType()->IsExternal()));
463466
}
464467
};
465468
};

lib/Runtime/Types/TypePropertyCache.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -300,7 +300,10 @@ namespace Js
300300
{
301301
if (!OutputExistence)
302302
{
303-
Assert(*propertyValue == JavascriptOperators::GetProperty(propertyObject, propertyId, requestContext));
303+
DebugOnly(Var getPropertyValue = JavascriptOperators::GetProperty(propertyObject, propertyId, requestContext));
304+
Assert(*propertyValue == getPropertyValue ||
305+
// In some cases, such as CustomExternalObject, if implicit calls are disabled GetPropertyQuery may return null. See CustomExternalObject::GetPropertyQuery for an example.
306+
(getPropertyValue == requestContext->GetLibrary()->GetNull() && requestContext->GetThreadContext()->IsDisableImplicitCall() && propertyObject->GetType()->IsExternal()));
304307
}
305308

306309
if(propertyObject->GetScriptContext() != requestContext)

0 commit comments

Comments
 (0)