[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc
paroga at webkit.org
paroga at webkit.org
Wed Dec 22 14:28:17 UTC 2010
The following commit has been merged in the debian/experimental branch:
commit 70284ef9eabae59c94e3e32d271a1e92c62bde4a
Author: paroga at webkit.org <paroga at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Sun Oct 10 20:19:46 2010 +0000
2010-10-10 Patrick Gansterer <paroga at webkit.org>
Reviewed by Adam Barth.
Use WTF::StringHasher in WTF::CaseFoldingHash
https://bugs.webkit.org/show_bug.cgi?id=46523
* wtf/text/StringHash.h:
(WTF::CaseFoldingHash::foldCase):
(WTF::CaseFoldingHash::hash):
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@69472 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/JavaScriptCore/ChangeLog b/JavaScriptCore/ChangeLog
index e144723..b9b0e39 100644
--- a/JavaScriptCore/ChangeLog
+++ b/JavaScriptCore/ChangeLog
@@ -1,3 +1,14 @@
+2010-10-10 Patrick Gansterer <paroga at webkit.org>
+
+ Reviewed by Adam Barth.
+
+ Use WTF::StringHasher in WTF::CaseFoldingHash
+ https://bugs.webkit.org/show_bug.cgi?id=46523
+
+ * wtf/text/StringHash.h:
+ (WTF::CaseFoldingHash::foldCase):
+ (WTF::CaseFoldingHash::hash):
+
2010-10-09 Pratik Solanki <psolanki at apple.com>
Reviewed by Xan Lopez.
diff --git a/JavaScriptCore/wtf/text/StringHash.h b/JavaScriptCore/wtf/text/StringHash.h
index bfd05eb..484396d 100644
--- a/JavaScriptCore/wtf/text/StringHash.h
+++ b/JavaScriptCore/wtf/text/StringHash.h
@@ -96,100 +96,27 @@ namespace WTF {
};
class CaseFoldingHash {
+ template<typename T> static inline UChar foldCase(T ch)
+ {
+ return WTF::Unicode::foldCase(ch);
+ }
+
public:
- // Paul Hsieh's SuperFastHash
- // http://www.azillionmonkeys.com/qed/hash.html
static unsigned hash(const UChar* data, unsigned length)
{
- unsigned l = length;
- const UChar* s = data;
- uint32_t hash = WTF::stringHashingStartValue;
- uint32_t tmp;
-
- int rem = l & 1;
- l >>= 1;
-
- // Main loop.
- for (; l > 0; l--) {
- hash += WTF::Unicode::foldCase(s[0]);
- tmp = (WTF::Unicode::foldCase(s[1]) << 11) ^ hash;
- hash = (hash << 16) ^ tmp;
- s += 2;
- hash += hash >> 11;
- }
-
- // Handle end case.
- if (rem) {
- hash += WTF::Unicode::foldCase(s[0]);
- hash ^= hash << 11;
- hash += hash >> 17;
- }
-
- // Force "avalanching" of final 127 bits.
- hash ^= hash << 3;
- hash += hash >> 5;
- hash ^= hash << 2;
- hash += hash >> 15;
- hash ^= hash << 10;
-
- // This avoids ever returning a hash code of 0, since that is used to
- // signal "hash not computed yet", using a value that is likely to be
- // effectively the same as 0 when the low bits are masked.
- hash |= !hash << 31;
-
- return hash;
+ return StringHasher::createHash<UChar, foldCase>(data, length);
}
static unsigned hash(StringImpl* str)
{
return hash(str->characters(), str->length());
}
-
- static unsigned hash(const char* str, unsigned length)
- {
- // This hash is designed to work on 16-bit chunks at a time. But since the normal case
- // (above) is to hash UTF-16 characters, we just treat the 8-bit chars as if they
- // were 16-bit chunks, which will give matching results.
- unsigned l = length;
- const char* s = str;
- uint32_t hash = WTF::stringHashingStartValue;
- uint32_t tmp;
-
- int rem = l & 1;
- l >>= 1;
-
- // Main loop
- for (; l > 0; l--) {
- hash += WTF::Unicode::foldCase(s[0]);
- tmp = (WTF::Unicode::foldCase(s[1]) << 11) ^ hash;
- hash = (hash << 16) ^ tmp;
- s += 2;
- hash += hash >> 11;
- }
-
- // Handle end case
- if (rem) {
- hash += WTF::Unicode::foldCase(s[0]);
- hash ^= hash << 11;
- hash += hash >> 17;
- }
-
- // Force "avalanching" of final 127 bits
- hash ^= hash << 3;
- hash += hash >> 5;
- hash ^= hash << 2;
- hash += hash >> 15;
- hash ^= hash << 10;
-
- // this avoids ever returning a hash code of 0, since that is used to
- // signal "hash not computed yet", using a value that is likely to be
- // effectively the same as 0 when the low bits are masked
- hash |= !hash << 31;
-
- return hash;
+ static unsigned hash(const char* data, unsigned length)
+ {
+ return StringHasher::createHash<char, foldCase>(data, length);
}
-
+
static bool equal(const StringImpl* a, const StringImpl* b)
{
if (a == b)
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list