Title: [131913] trunk/Source/_javascript_Core
Revision
131913
Author
[email protected]
Date
2012-10-19 10:09:42 -0700 (Fri, 19 Oct 2012)

Log Message

Clean up RegExpKey
https://bugs.webkit.org/show_bug.cgi?id=99798

Reviewed by Darin Adler.

RegExpHash doesn't need to be a class template specialization when the class template is specialized
for JSC::RegExpKey only. Make it a nested class of RegExp instead. Also, make operator== a friend function
so Hash::equal can see it.

* runtime/RegExpKey.h:
(JSC::RegExpKey::RegExpKey):
(JSC::RegExpKey::operator==):
(RegExpKey):
(JSC::RegExpKey::Hash::hash):
(JSC::RegExpKey::Hash::equal):
(Hash):

Modified Paths

Diff

Modified: trunk/Source/_javascript_Core/ChangeLog (131912 => 131913)


--- trunk/Source/_javascript_Core/ChangeLog	2012-10-19 17:08:28 UTC (rev 131912)
+++ trunk/Source/_javascript_Core/ChangeLog	2012-10-19 17:09:42 UTC (rev 131913)
@@ -1,3 +1,22 @@
+2012-10-18  Anders Carlsson  <[email protected]>
+
+        Clean up RegExpKey
+        https://bugs.webkit.org/show_bug.cgi?id=99798
+
+        Reviewed by Darin Adler.
+
+        RegExpHash doesn't need to be a class template specialization when the class template is specialized
+        for JSC::RegExpKey only. Make it a nested class of RegExp instead. Also, make operator== a friend function
+        so Hash::equal can see it.
+
+        * runtime/RegExpKey.h:
+        (JSC::RegExpKey::RegExpKey):
+        (JSC::RegExpKey::operator==):
+        (RegExpKey):
+        (JSC::RegExpKey::Hash::hash):
+        (JSC::RegExpKey::Hash::equal):
+        (Hash):
+
 2012-10-19  Mark Lam  <[email protected]>
 
         Bot greening: Follow up to r131877 to fix the Windows build.

Modified: trunk/Source/_javascript_Core/runtime/RegExpKey.h (131912 => 131913)


--- trunk/Source/_javascript_Core/runtime/RegExpKey.h	2012-10-19 17:08:28 UTC (rev 131912)
+++ trunk/Source/_javascript_Core/runtime/RegExpKey.h	2012-10-19 17:09:42 UTC (rev 131913)
@@ -73,9 +73,17 @@
         , pattern(pattern)
     {
     }
+
+    friend inline bool operator==(const RegExpKey& a, const RegExpKey& b);
+
+    struct Hash {
+        static unsigned hash(const RegExpKey& key) { return key.pattern->hash(); }
+        static bool equal(const RegExpKey& a, const RegExpKey& b) { return a == b; }
+        static const bool safeToCompareToEmptyOrDeleted = false;
+    };
 };
 
-inline bool operator==(const RegExpKey& a, const RegExpKey& b) 
+inline bool operator==(const RegExpKey& a, const RegExpKey& b)
 {
     if (a.flagsValue != b.flagsValue)
         return false;
@@ -90,16 +98,9 @@
 
 namespace WTF {
 template<typename T> struct DefaultHash;
-template<typename T> struct RegExpHash;
 
-template<> struct RegExpHash<JSC::RegExpKey> {
-    static unsigned hash(const JSC::RegExpKey& key) { return key.pattern->hash(); }
-    static bool equal(const JSC::RegExpKey& a, const JSC::RegExpKey& b) { return a == b; }
-    static const bool safeToCompareToEmptyOrDeleted = false;
-};
-
 template<> struct DefaultHash<JSC::RegExpKey> {
-    typedef RegExpHash<JSC::RegExpKey> Hash;
+    typedef JSC::RegExpKey::Hash Hash;
 };
 
 template<> struct HashTraits<JSC::RegExpKey> : GenericHashTraits<JSC::RegExpKey> {
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to