Bug 161009

Summary: Clean up FontPlatformData::hash()
Product: WebKit Reporter: Myles C. Maxfield <mmaxfield>
Component: New BugsAssignee: Myles C. Maxfield <mmaxfield>
Status: RESOLVED DUPLICATE    
Severity: Normal    
Priority: P2    
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch
none
Patch
none
Patch
buildbot: commit-queue-
Archive of layout-test-results from ews116 for mac-yosemite none

Description Myles C. Maxfield 2016-08-19 12:58:09 PDT
Clean up FontPlatformData::hash()
Comment 1 Myles C. Maxfield 2016-08-19 13:01:08 PDT
Created attachment 286470 [details]
Patch
Comment 2 Myles C. Maxfield 2016-08-19 20:23:09 PDT
Created attachment 286520 [details]
Patch
Comment 3 Myles C. Maxfield 2016-08-19 20:25:47 PDT
Created attachment 286521 [details]
Patch
Comment 4 Build Bot 2016-08-19 21:09:13 PDT
Comment on attachment 286521 [details]
Patch

Attachment 286521 [details] did not pass mac-debug-ews (mac):
Output: http://webkit-queues.webkit.org/results/1903880

Number of test failures exceeded the failure limit.
Comment 5 Build Bot 2016-08-19 21:09:15 PDT
Created attachment 286523 [details]
Archive of layout-test-results from ews116 for mac-yosemite

The attached test failures were seen while running run-webkit-tests on the mac-debug-ews.
Bot: ews116  Port: mac-yosemite  Platform: Mac OS X 10.10.5
Comment 6 Darin Adler 2016-08-20 18:33:48 PDT
Comment on attachment 286521 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=286521&action=review

> Source/WebCore/platform/graphics/cocoa/FontPlatformDataCocoa.mm:61
> +unsigned FontPlatformData::hash() const
> +{
> +    uintptr_t flags = static_cast<uintptr_t>(m_isHashTableDeletedValue << 5 | m_textRenderingMode << 3 | m_orientation << 2 | m_syntheticBold << 1 | m_syntheticOblique);
> +    uintptr_t fontHash = reinterpret_cast<uintptr_t>(m_font.get());
> +    uintptr_t hashCodes[3] = { fontHash, m_widthVariant, flags };
> +    return StringHasher::hashMemory<sizeof(hashCodes)>(hashCodes);
> +}

This doesn’t look right. The hash function should hash the same things that the is-equal function compares. Yet this is hashing things that platformIsEqual does not even look at. Can that really be correct?
Comment 7 Myles C. Maxfield 2017-01-18 13:51:44 PST

*** This bug has been marked as a duplicate of bug 167061 ***