[webkit-changes] [WebKit/WebKit] 075685: [JSC] Reland wyhash in StringImpl for MacOS

Commit Queue noreply at github.com
Thu Aug 31 16:30:37 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 0756854fafd4312b8f0126de111792e39db106ef
      https://github.com/WebKit/WebKit/commit/0756854fafd4312b8f0126de111792e39db106ef
  Author: Yijia Huang <yijia_huang at apple.com>
  Date:   2023-08-31 (Thu, 31 Aug 2023)

  Changed paths:
    M Source/JavaScriptCore/create_hash_table
    M Source/JavaScriptCore/runtime/JSCBytecodeCacheVersion.cpp.in
    M Source/JavaScriptCore/runtime/JSCell.cpp
    M Source/JavaScriptCore/runtime/TemplateObjectDescriptor.h
    M Source/JavaScriptCore/tools/JSDollarVM.cpp
    M Source/JavaScriptCore/tools/VMInspector.cpp
    M Source/JavaScriptCore/yarr/generateYarrUnicodePropertyTables.py
    M Source/JavaScriptCore/yarr/hasher.py
    M Source/WTF/WTF.xcodeproj/project.pbxproj
    M Source/WTF/wtf/CMakeLists.txt
    M Source/WTF/wtf/Hasher.h
    M Source/WTF/wtf/text/CString.cpp
    M Source/WTF/wtf/text/StringHash.h
    M Source/WTF/wtf/text/StringHasher.h
    A Source/WTF/wtf/text/StringHasherInlines.h
    M Source/WTF/wtf/text/StringImpl.h
    A Source/WTF/wtf/text/SuperFastHash.h
    A Source/WTF/wtf/text/WYHash.h
    M Source/WTF/wtf/unicode/UTF8Conversion.cpp
    M Source/WebCore/bindings/scripts/CodeGeneratorJS.pm
    M Source/WebCore/bindings/scripts/Hasher.pm
    M Source/WebCore/bindings/scripts/test/JS/JSTestGlobalObject.cpp
    M Source/WebCore/contentextensions/DFAMinimizer.cpp
    M Source/WebCore/contentextensions/HashableActionList.h
    M Source/WebCore/platform/SharedStringHash.cpp
    M Source/WebCore/platform/graphics/WidthCache.h
    M Tools/TestWebKitAPI/CMakeLists.txt
    M Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj
    M Tools/TestWebKitAPI/Tests/WTF/StringHasher.cpp
    A Tools/TestWebKitAPI/Tests/WTF/SuperFastHash.cpp
    A Tools/TestWebKitAPI/Tests/WTF/WYHash.cpp

  Log Message:
  -----------
  [JSC] Reland wyhash in StringImpl for MacOS
https://bugs.webkit.org/show_bug.cgi?id=260957
rdar://114755168

Reviewed by Yusuke Suzuki.

Previously, we reverted the wyhash patch (landed at 266929 at main and
reverted at 267004 at main) which causes regressions on iOS devices.
This patch only enable wyhash for macOS.

* Source/JavaScriptCore/create_hash_table:
* Source/JavaScriptCore/runtime/JSCBytecodeCacheVersion.cpp.in:
* Source/JavaScriptCore/runtime/JSCell.cpp:
(JSC::reportZappedCellAndCrash):
* Source/JavaScriptCore/runtime/TemplateObjectDescriptor.h:
(JSC::TemplateObjectDescriptor::calculateHash):
* Source/JavaScriptCore/tools/JSDollarVM.cpp:
* Source/JavaScriptCore/tools/VMInspector.cpp:
(JSC::VMInspector::dumpSubspaceHashes):
* Source/JavaScriptCore/yarr/generateYarrUnicodePropertyTables.py:
(PropertyData.createAndDumpHashTable.createAndDumpHashTableHelper):
(PropertyData.createAndDumpHashTable):
* Source/JavaScriptCore/yarr/hasher.py:
(stringHash):
(avalancheBits):
(maskTop8BitsAndAvoidZero):
(superFastHash):
(wyhash):
(wyhash.add64):
(wyhash.multi64):
(wyhash.wymum):
(wyhash.wymix):
(wyhash.convert32BitTo64Bit):
(wyhash.convert16BitTo32Bit):
(wyhash.c2i):
(wyhash.wyr8):
(wyhash.wyr4):
(wyhash.wyr2):
(ceilingToPowerOf2):
(createHashTable):
(createHashTable.createHashTableHelper):
* Source/WTF/WTF.xcodeproj/project.pbxproj:
* Source/WTF/wtf/CMakeLists.txt:
* Source/WTF/wtf/Hasher.h:
* Source/WTF/wtf/text/CString.cpp:
(WTF::CString::hash const):
* Source/WTF/wtf/text/StringHash.h:
(WTF::ASCIICaseInsensitiveHash::hash):
* Source/WTF/wtf/text/StringHasher.h:
(WTF::StringHasher::finalize):
(WTF::StringHasher::finalizeAndMaskTop8Bits):
(WTF::StringHasher::addCharactersAssumingAligned): Deleted.
(WTF::StringHasher::addCharacter): Deleted.
(WTF::StringHasher::addCharacters): Deleted.
(WTF::StringHasher::hashWithTop8BitsMasked const): Deleted.
(WTF::StringHasher::hash const): Deleted.
(WTF::StringHasher::computeHashAndMaskTop8Bits): Deleted.
(WTF::StringHasher::computeHash): Deleted.
(WTF::StringHasher::computeLiteralHash): Deleted.
(WTF::StringHasher::computeLiteralHashAndMaskTop8Bits): Deleted.
(WTF::StringHasher::calculateWithRemainingLastCharacter): Deleted.
(WTF::StringHasher::calculateWithTwoCharacters): Deleted.
(WTF::StringHasher::computeHashImpl): Deleted.
(WTF::StringHasher::processPendingCharacter const): Deleted.
* Source/WTF/wtf/text/StringHasherInlines.h: Added.
(WTF::StringHasher::computeHashAndMaskTop8Bits):
(WTF::StringHasher::computeLiteralHashAndMaskTop8Bits):
(WTF::StringHasher::addCharacter):
(WTF::StringHasher::hashWithTop8BitsMasked):
* Source/WTF/wtf/text/StringImpl.h:
* Source/WTF/wtf/text/SuperFastHash.h: Copied from Source/WTF/wtf/text/StringHasher.h.
(WTF::SuperFastHash::addCharactersAssumingAligned):
(WTF::SuperFastHash::addCharacter):
(WTF::SuperFastHash::addCharacters):
(WTF::SuperFastHash::hashWithTop8BitsMasked const):
(WTF::SuperFastHash::hash const):
(WTF::SuperFastHash::computeHashAndMaskTop8Bits):
(WTF::SuperFastHash::computeHash):
(WTF::SuperFastHash::computeLiteralHash):
(WTF::SuperFastHash::computeLiteralHashAndMaskTop8Bits):
(WTF::SuperFastHash::addCharactersAssumingAlignedImpl):
(WTF::SuperFastHash::addCharacterImpl):
(WTF::SuperFastHash::calculateWithRemainingLastCharacter):
(WTF::SuperFastHash::calculateWithTwoCharacters):
(WTF::SuperFastHash::computeHashImpl):
(WTF::SuperFastHash::processPendingCharacter const):
(WTF::SuperFastHash::hashWithTop8BitsMaskedImpl):
(WTF::SuperFastHash::processPendingCharacterImpl):
* Source/WTF/wtf/text/WYHash.h: Added.
(WTF::WYHash::computeHashAndMaskTop8Bits):
(WTF::WYHash::wyrot):
(WTF::WYHash::wymum):
(WTF::WYHash::wymix):
(WTF::WYHash::bigEndianToLittleEndian8):
(WTF::WYHash::bigEndianToLittleEndian4):
(WTF::WYHash::bigEndianToLittleEndian2):
(WTF::WYHash::Reader16Bit::hasDefaultConverter):
(WTF::WYHash::Reader16Bit::convert):
(WTF::WYHash::Reader16Bit::wyr3):
(WTF::WYHash::Reader16Bit::wyr4WithConvert):
(WTF::WYHash::Reader16Bit::wyr4):
(WTF::WYHash::Reader16Bit::wyr8WithConvert):
(WTF::WYHash::Reader16Bit::wyr8):
(WTF::WYHash::Reader8Bit::hasDefaultConverter):
(WTF::WYHash::Reader8Bit::convert):
(WTF::WYHash::Reader8Bit::wyr3):
(WTF::WYHash::Reader8Bit::wyr4WithConvert):
(WTF::WYHash::Reader8Bit::wyr4):
(WTF::WYHash::Reader8Bit::wyr8WithConvert):
(WTF::WYHash::Reader8Bit::wyr8):
(WTF::WYHash::initSeed):
(WTF::WYHash::consume24Characters):
(WTF::WYHash::handleEndCase):
(WTF::WYHash::handleGreaterThan8CharactersCase):
(WTF::WYHash::hash):
(WTF::WYHash::computeHashImpl):
* Source/WTF/wtf/unicode/UTF8Conversion.cpp:
(WTF::Unicode::calculateStringHashAndLengthFromUTF8MaskingTop8Bits):
* Source/WebCore/bindings/scripts/CodeGeneratorJS.pm:
(GenerateHashTableValueArray):
(GenerateHashTable):
* Source/WebCore/bindings/scripts/Hasher.pm:
(avalancheBits):
(maskTop8BitsAndAvoidZero):
(superFastHash):
(uint64_add):
(uint64_multi):
(GenerateHashValue): Deleted.
* Source/WebCore/bindings/scripts/test/JS/JSTestGlobalObject.cpp:
* Source/WebCore/contentextensions/DFAMinimizer.cpp:
* Source/WebCore/contentextensions/HashableActionList.h:
(WebCore::ContentExtensions::HashableActionList::HashableActionList):
* Source/WebCore/platform/SharedStringHash.cpp:
(WebCore::computeSharedStringHashInline):
* Source/WebCore/platform/graphics/WidthCache.h:
(WebCore::WidthCache::SmallStringKey::SmallStringKey):
* Tools/TestWebKitAPI/CMakeLists.txt:
* Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
* Tools/TestWebKitAPI/Tests/WTF/StringHasher.cpp:
(TestWebKitAPI::TEST):
* Tools/TestWebKitAPI/Tests/WTF/SuperFastHash.cpp: Copied from Tools/TestWebKitAPI/Tests/WTF/StringHasher.cpp.
(TestWebKitAPI::TEST):
* Tools/TestWebKitAPI/Tests/WTF/WYHash.cpp: Added.
(TestWebKitAPI::TEST):

Canonical link: https://commits.webkit.org/267532@main




More information about the webkit-changes mailing list