Title: [100417] trunk/Source/_javascript_Core
Revision
100417
Author
da...@apple.com
Date
2011-11-16 00:05:40 -0800 (Wed, 16 Nov 2011)

Log Message

Fix some hash traits that don't derive from the base hash traits
https://bugs.webkit.org/show_bug.cgi?id=72470

Reviewed by Filip Pizlo.

Hash traits structures need to derive from the base hash traits in
HashTraits.h, but some were not. This is needed for compatibility with
some additional traits we will be adding to make OwnPtr work with HashMap.

* runtime/Identifier.h: Make IdentifierMapIndexHashTraits derive from
HashTraits<int>. This enabled removal of all the members except for the
ones that control the empty value, because this is otherwise the same
as the standard int hash.

* runtime/SymbolTable.h: Changed SymbolTableIndexHashTraits to derive
from HashTraits<SymbolTableEntry> and removed redundant members.

Modified Paths

Diff

Modified: trunk/Source/_javascript_Core/ChangeLog (100416 => 100417)


--- trunk/Source/_javascript_Core/ChangeLog	2011-11-16 07:51:03 UTC (rev 100416)
+++ trunk/Source/_javascript_Core/ChangeLog	2011-11-16 08:05:40 UTC (rev 100417)
@@ -1,3 +1,22 @@
+2011-11-16  Darin Adler  <da...@apple.com>
+
+        Fix some hash traits that don't derive from the base hash traits
+        https://bugs.webkit.org/show_bug.cgi?id=72470
+
+        Reviewed by Filip Pizlo.
+
+        Hash traits structures need to derive from the base hash traits in
+        HashTraits.h, but some were not. This is needed for compatibility with
+        some additional traits we will be adding to make OwnPtr work with HashMap.
+
+        * runtime/Identifier.h: Make IdentifierMapIndexHashTraits derive from
+        HashTraits<int>. This enabled removal of all the members except for the
+        ones that control the empty value, because this is otherwise the same
+        as the standard int hash.
+
+        * runtime/SymbolTable.h: Changed SymbolTableIndexHashTraits to derive
+        from HashTraits<SymbolTableEntry> and removed redundant members.
+
 2011-11-15  Sheriff Bot  <webkit.review....@gmail.com>
 
         Unreviewed, rolling out r100375 and r100385.

Modified: trunk/Source/_javascript_Core/runtime/Identifier.h (100416 => 100417)


--- trunk/Source/_javascript_Core/runtime/Identifier.h	2011-11-16 07:51:03 UTC (rev 100416)
+++ trunk/Source/_javascript_Core/runtime/Identifier.h	2011-11-16 08:05:40 UTC (rev 100417)
@@ -235,13 +235,9 @@
         static unsigned hash(StringImpl* key) { return key->existingHash(); }
     };
 
-    struct IdentifierMapIndexHashTraits {
-        typedef int TraitType;
-        typedef IdentifierMapIndexHashTraits StorageTraits;
+    struct IdentifierMapIndexHashTraits : HashTraits<int> {
         static int emptyValue() { return std::numeric_limits<int>::max(); }
         static const bool emptyValueIsZero = false;
-        static const bool needsDestruction = false;
-        static const bool needsRef = false;
     };
 
     typedef HashMap<RefPtr<StringImpl>, int, IdentifierRepHash, HashTraits<RefPtr<StringImpl> >, IdentifierMapIndexHashTraits> IdentifierMap;

Modified: trunk/Source/_javascript_Core/runtime/SymbolTable.h (100416 => 100417)


--- trunk/Source/_javascript_Core/runtime/SymbolTable.h	2011-11-16 07:51:03 UTC (rev 100416)
+++ trunk/Source/_javascript_Core/runtime/SymbolTable.h	2011-11-16 08:05:40 UTC (rev 100417)
@@ -32,6 +32,7 @@
 #include "JSObject.h"
 #include "UString.h"
 #include <wtf/AlwaysInline.h>
+#include <wtf/HashTraits.h>
 
 namespace JSC {
 
@@ -112,9 +113,7 @@
         int m_bits;
     };
 
-    struct SymbolTableIndexHashTraits {
-        typedef SymbolTableEntry TraitType;
-        static SymbolTableEntry emptyValue() { return SymbolTableEntry(); }
+    struct SymbolTableIndexHashTraits : HashTraits<SymbolTableEntry> {
         static const bool emptyValueIsZero = true;
         static const bool needsDestruction = false;
     };
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to