Skip to content

Commit ddd183b

Browse files
committed
Fix bookkeeping of unregisteredInlineCacheCount
We were removing inlineCache from invalidation list but were not updating the count at `ThreadContext` level. In between we were calling compacting the invalidation list and find that there are more null entries in the invalidation list than we thought (as per `threadContext->unregisteredInlineCacheCount`). Fix by calling compact only after we update the variable at threadContext.
1 parent 6dcb9b2 commit ddd183b

3 files changed

Lines changed: 6 additions & 9 deletions

File tree

lib/Runtime/Base/FunctionBody.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7723,7 +7723,7 @@ namespace Js
77237723
// and doesn't get released to the allocator until there are no more outstanding references. Thus we don't need
77247724
// to (and, in fact, cannot) remove it from the invalidation list here. Instead, we'll do it in ReleaseInlineCache
77257725
// when there are no more outstanding references.
7726-
rootObjectBase->ReleaseInlineCache(this->GetPropertyIdFromCacheId(i), false, false, IsScriptContextShutdown);
7726+
unregisteredInlineCacheCount += rootObjectBase->ReleaseInlineCache(this->GetPropertyIdFromCacheId(i), false, false, IsScriptContextShutdown);
77277727
}
77287728
}
77297729
}
@@ -7743,7 +7743,7 @@ namespace Js
77437743
// and doesn't get released to the allocator until there are no more outstanding references. Thus we don't need
77447744
// to (and, in fact, cannot) remove it from the invalidation list here. Instead, we'll do it in ReleaseInlineCache
77457745
// when there are no more outstanding references.
7746-
rootObjectBase->ReleaseInlineCache(this->GetPropertyIdFromCacheId(i), true, false, IsScriptContextShutdown);
7746+
unregisteredInlineCacheCount += rootObjectBase->ReleaseInlineCache(this->GetPropertyIdFromCacheId(i), true, false, IsScriptContextShutdown);
77477747
}
77487748
}
77497749
}
@@ -7763,7 +7763,7 @@ namespace Js
77637763
// and doesn't get released to the allocator until there are no more outstanding references. Thus we don't need
77647764
// to (and, in fact, cannot) remove it from the invalidation list here. Instead, we'll do it in ReleaseInlineCache
77657765
// when there are no more outstanding references.
7766-
rootObjectBase->ReleaseInlineCache(this->GetPropertyIdFromCacheId(i), false, true, IsScriptContextShutdown);
7766+
unregisteredInlineCacheCount += rootObjectBase->ReleaseInlineCache(this->GetPropertyIdFromCacheId(i), false, true, IsScriptContextShutdown);
77677767
}
77687768
}
77697769
}

lib/Runtime/Library/RootObjectBase.cpp

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ namespace Js
9696

9797
// TODO: Switch to take PropertyRecord instead once we clean up the function body to hold onto propertyRecord
9898
// instead of propertyId.
99-
void
99+
uint
100100
RootObjectBase::ReleaseInlineCache(Js::PropertyId propertyId, bool isLoadMethod, bool isStore, bool isShutdown)
101101
{
102102
uint unregisteredInlineCacheCount = 0;
@@ -129,10 +129,7 @@ namespace Js
129129
}
130130
);
131131
Assert(found);
132-
if (unregisteredInlineCacheCount > 0)
133-
{
134-
this->GetScriptContext()->GetThreadContext()->NotifyInlineCacheBatchUnregistered(unregisteredInlineCacheCount);
135-
}
132+
return unregisteredInlineCacheCount;
136133
}
137134

138135
BOOL

lib/Runtime/Library/RootObjectBase.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ namespace Js
2727

2828
Js::InlineCache * GetInlineCache(Js::PropertyRecord const* propertyRecord, bool isLoadMethod, bool isStore);
2929
Js::RootObjectInlineCache * GetRootInlineCache(Js::PropertyRecord const* propertyRecord, bool isLoadMethod, bool isStore);
30-
void ReleaseInlineCache(PropertyId propertyId, bool isLoadMethod, bool isStore, bool isShutdown);
30+
uint ReleaseInlineCache(PropertyId propertyId, bool isLoadMethod, bool isStore, bool isShutdown);
3131

3232
virtual BOOL EnsureProperty(PropertyId propertyId) override;
3333
virtual BOOL EnsureNoRedeclProperty(PropertyId propertyId) override sealed;

0 commit comments

Comments
 (0)