Title: [253864] trunk/Source
Revision
253864
Author
[email protected]
Date
2019-12-21 09:18:32 -0800 (Sat, 21 Dec 2019)

Log Message

Move Vector HashTraits to HashTraits.h to fix GCC build
https://bugs.webkit.org/show_bug.cgi?id=205540

Reviewed by Zalan Bujtas.

Source/WebCore:

* contentextensions/DFAMinimizer.cpp:

ActionKey HashTrait claims that emptyValueIsZero. Now with Vector HashTrait having emptyValueIsZero too
HashMap<ActionKey, Vector<>> started taking the optimized path.

However ActionKey empty value wasn't actually zero because Empty enum value wasn't 0.

Source/WTF:

GCC is stricter than LLVM with partial specializations

Error: partial specialization of struct WTF::HashTraits<WTF::Vector<U, otherCapacity, WTF::CrashOnOverflow, 16> >
after instantiation of struct WTF::HashTraits<WTF::Vector<WTF::String> >

* wtf/HashTraits.h:
* wtf/VectorHash.h:

Modified Paths

Diff

Modified: trunk/Source/WTF/ChangeLog (253863 => 253864)


--- trunk/Source/WTF/ChangeLog	2019-12-21 14:58:01 UTC (rev 253863)
+++ trunk/Source/WTF/ChangeLog	2019-12-21 17:18:32 UTC (rev 253864)
@@ -1,3 +1,18 @@
+2019-12-21  Antti Koivisto  <[email protected]>
+
+        Move Vector HashTraits to HashTraits.h to fix GCC build
+        https://bugs.webkit.org/show_bug.cgi?id=205540
+
+        Reviewed by Zalan Bujtas.
+
+        GCC is stricter than LLVM with partial specializations
+
+        Error: partial specialization of struct WTF::HashTraits<WTF::Vector<U, otherCapacity, WTF::CrashOnOverflow, 16> >
+        after instantiation of struct WTF::HashTraits<WTF::Vector<WTF::String> >
+
+        * wtf/HashTraits.h:
+        * wtf/VectorHash.h:
+
 2019-12-20  Truitt Savell  <[email protected]>
 
         Unreviewed, rolling out r253820.

Modified: trunk/Source/WTF/wtf/HashTraits.h (253863 => 253864)


--- trunk/Source/WTF/wtf/HashTraits.h	2019-12-21 14:58:01 UTC (rev 253863)
+++ trunk/Source/WTF/wtf/HashTraits.h	2019-12-21 17:18:32 UTC (rev 253864)
@@ -361,6 +361,14 @@
     static T emptyValue() { return reinterpret_cast<T>(1); }
 };
 
+template<typename T, size_t inlineCapacity>
+struct HashTraits<Vector<T, inlineCapacity>> : GenericHashTraits<Vector<T, inlineCapacity>> {
+    static constexpr bool emptyValueIsZero = !inlineCapacity;
+
+    static void constructDeletedValue(Vector<T, inlineCapacity>& slot) { new (NotNull, std::addressof(slot)) Vector<T, inlineCapacity>(WTF::HashTableDeletedValue); }
+    static bool isDeletedValue(const Vector<T, inlineCapacity>& value) { return value.isHashTableDeletedValue(); }
+};
+
 // Useful for classes that want complete control over what is empty and what is deleted,
 // and how to construct both.
 template<typename T>

Modified: trunk/Source/WTF/wtf/VectorHash.h (253863 => 253864)


--- trunk/Source/WTF/wtf/VectorHash.h	2019-12-21 14:58:01 UTC (rev 253863)
+++ trunk/Source/WTF/wtf/VectorHash.h	2019-12-21 17:18:32 UTC (rev 253864)
@@ -48,14 +48,6 @@
 };
 
 template<typename T, size_t inlineCapacity>
-struct HashTraits<Vector<T, inlineCapacity>> : GenericHashTraits<Vector<T, inlineCapacity>> {
-    static constexpr bool emptyValueIsZero = !inlineCapacity;
-
-    static void constructDeletedValue(Vector<T, inlineCapacity>& slot) { new (NotNull, std::addressof(slot)) Vector<T, inlineCapacity>(WTF::HashTableDeletedValue); }
-    static bool isDeletedValue(const Vector<T, inlineCapacity>& value) { return value.isHashTableDeletedValue(); }
-};
-
-template<typename T, size_t inlineCapacity>
 struct DefaultHash<Vector<T, inlineCapacity>> {
     using Hash = VectorHash<T, inlineCapacity>;
 };

Modified: trunk/Source/WebCore/ChangeLog (253863 => 253864)


--- trunk/Source/WebCore/ChangeLog	2019-12-21 14:58:01 UTC (rev 253863)
+++ trunk/Source/WebCore/ChangeLog	2019-12-21 17:18:32 UTC (rev 253864)
@@ -1,3 +1,17 @@
+2019-12-21  Antti Koivisto  <[email protected]>
+
+        Move Vector HashTraits to HashTraits.h to fix GCC build
+        https://bugs.webkit.org/show_bug.cgi?id=205540
+
+        Reviewed by Zalan Bujtas.
+
+        * contentextensions/DFAMinimizer.cpp:
+
+        ActionKey HashTrait claims that emptyValueIsZero. Now with Vector HashTrait having emptyValueIsZero too
+        HashMap<ActionKey, Vector<>> started taking the optimized path.
+
+        However ActionKey empty value wasn't actually zero because Empty enum value wasn't 0.
+
 2019-12-21  Kate Cheney  <[email protected]>
 
         Add timeStamp to ITP database

Modified: trunk/Source/WebCore/contentextensions/DFAMinimizer.cpp (253863 => 253864)


--- trunk/Source/WebCore/contentextensions/DFAMinimizer.cpp	2019-12-21 14:58:01 UTC (rev 253863)
+++ trunk/Source/WebCore/contentextensions/DFAMinimizer.cpp	2019-12-21 17:18:32 UTC (rev 253864)
@@ -409,17 +409,17 @@
     bool isEmptyValue() const { return state == Empty; }
     bool isDeletedValue() const { return state == Deleted; }
 
-    unsigned hash;
+    unsigned hash { 0 };
     
-    const DFA* dfa;
-    uint32_t actionsStart;
-    uint16_t actionsLength;
+    const DFA* dfa { nullptr };
+    uint32_t actionsStart { 0 };
+    uint16_t actionsLength { 0 };
     
     enum {
+        Empty,
         Valid,
-        Empty,
         Deleted
-    } state;
+    } state { Empty };
 };
 
 struct ActionKeyHash {
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to