Bug 1843344: Improve diagnostic for icEntryFromPCOffset crashes r=jandem

This assertion has been failing in nightly/beta recently for unclear reasons. Unfortunately, minidumps just show us the MOZ_DIAGNOSTIC_ASSERT machinery instead of any useful information.

Printing out these two values before crashing will help us figure out if the pcOffset is out of bounds, or if it is pointing to an offset without an IC.

Differential Revision: https://phabricator.services.mozilla.com/D184861
This commit is contained in:
Iain Ireland 2023-08-07 21:28:28 +00:00
parent f46b175360
commit 6d116a9a6c

View File

@ -360,7 +360,15 @@ static bool ComputeBinarySearchMid(FallbackStubs stubs, uint32_t pcOffset,
ICEntry& ICScript::icEntryFromPCOffset(uint32_t pcOffset) {
size_t mid;
MOZ_ALWAYS_TRUE(ComputeBinarySearchMid(FallbackStubs(this), pcOffset, &mid));
bool success = ComputeBinarySearchMid(FallbackStubs(this), pcOffset, &mid);
#ifdef MOZ_DIAGNOSTIC_ASSERT_ENABLED
if (!success) {
MOZ_CRASH_UNSAFE_PRINTF("Missing icEntry for offset %d (max offset: %d)",
int(pcOffset),
int(fallbackStub(numICEntries() - 1)->pcOffset()));
}
#endif
MOZ_ALWAYS_TRUE(success);
MOZ_ASSERT(mid < numICEntries());