Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 106837a9c4ea12d4618f4fdb5d28f8a48b9abed3
      
https://github.com/WebKit/WebKit/commit/106837a9c4ea12d4618f4fdb5d28f8a48b9abed3
  Author: Antti Koivisto <[email protected]>
  Date:   2025-11-01 (Sat, 01 Nov 2025)

  Changed paths:
    M Source/JavaScriptCore/dfg/DFGIntegerCheckCombiningPhase.cpp
    M Source/JavaScriptCore/ftl/FTLSlowPathCallKey.h
    M Source/JavaScriptCore/runtime/FunctionHasExecutedCache.h
    M Source/JavaScriptCore/runtime/TemplateObjectDescriptor.h
    M Source/JavaScriptCore/runtime/TypeLocationCache.h
    M Source/WTF/wtf/HashFunctions.h
    M Source/WebCore/style/RuleFeature.h
    M Source/WebKit/Shared/WebPageNetworkParameters.h

  Log Message:
  -----------
  Add generic DefaultHash<> for types with hash() function and equality operator
https://bugs.webkit.org/show_bug.cgi?id=301803
rdar://163849870

Reviewed by Darin Adler and Sam Weinig.

With this any moveable class or struct can be turned into a hash table key with 
minimal ceremony:

struct Foo {
    unsigned a;
    Field b;

    bool operator==(const Foo&) = default;
    unsigned hash() const { return computeHash(a, b); }
};

HashSet<GenericHashKey<Foo>> set;

Also remove a bunch of now-unneeded DefaultHashes that match this pattern (with 
safeToCompareToEmptyOrDeleted = false).

* Source/JavaScriptCore/dfg/DFGIntegerCheckCombiningPhase.cpp:
(JSC::DFG::IntegerCheckCombiningPhase::RangeKey::Hash::hash): Deleted.
(JSC::DFG::IntegerCheckCombiningPhase::RangeKey::Hash::equal): Deleted.
* Source/JavaScriptCore/ftl/FTLSlowPathCallKey.h:
(JSC::FTL::SlowPathCallKeyHash::hash): Deleted.
(JSC::FTL::SlowPathCallKeyHash::equal): Deleted.
* Source/JavaScriptCore/runtime/FunctionHasExecutedCache.h:
(JSC::FunctionHasExecutedCache::FunctionRange::Hash::hash): Deleted.
(JSC::FunctionHasExecutedCache::FunctionRange::Hash::equal): Deleted.
* Source/JavaScriptCore/runtime/TemplateObjectDescriptor.h:
(JSC::TemplateObjectDescriptor::Hasher::hash): Deleted.
(JSC::TemplateObjectDescriptor::Hasher::equal): Deleted.
* Source/JavaScriptCore/runtime/TypeLocationCache.h:
(JSC::TypeLocationCache::LocationKey::Hash::hash): Deleted.
(JSC::TypeLocationCache::LocationKey::Hash::equal): Deleted.
* Source/WTF/wtf/HashFunctions.h:
(WTF::requires):

Add HashableWithMemberFunction concept.

(WTF::MemberBasedHash::hash):
(WTF::MemberBasedHash::equal):

Use it.

* Source/WebCore/style/RuleFeature.h:
(WebCore::Style::RuleFeatureDeduplicationKey::Hash::hash): Deleted.
(WebCore::Style::RuleFeatureDeduplicationKey::Hash::equal): Deleted.
* Source/WebKit/Shared/WebPageNetworkParameters.h:
(WTF::DefaultHash<WebKit::WebPageNetworkParameters>::hash): Deleted.
(WTF::DefaultHash<WebKit::WebPageNetworkParameters>::equal): Deleted.

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



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications

Reply via email to