[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:27:41 UTC 2010
The following commit has been merged in the debian/experimental branch:
commit f81ceb3638e4c2853fa99202eb8263a698e86464
Author: paroga at webkit.org <paroga at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Sat Oct 9 15:32:07 2010 +0000
2010-10-09 Patrick Gansterer <paroga at webkit.org>
Reviewed by Adam Barth.
Use WTF::StringHasher for hashing MappedAttributeKey
https://bugs.webkit.org/show_bug.cgi?id=46516
* dom/StyledElement.cpp:
(WebCore::MappedAttributeHash::hash):
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@69449 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 9d31064..2cb2e3c 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,13 @@
+2010-10-09 Patrick Gansterer <paroga at webkit.org>
+
+ Reviewed by Adam Barth.
+
+ Use WTF::StringHasher for hashing MappedAttributeKey
+ https://bugs.webkit.org/show_bug.cgi?id=46516
+
+ * dom/StyledElement.cpp:
+ (WebCore::MappedAttributeHash::hash):
+
2010-10-09 Martin Robinson <mrobinson at igalia.com>
Reviewed by Xan Lopez.
diff --git a/WebCore/dom/StyledElement.cpp b/WebCore/dom/StyledElement.cpp
index 45b80c5..12744cb 100644
--- a/WebCore/dom/StyledElement.cpp
+++ b/WebCore/dom/StyledElement.cpp
@@ -402,62 +402,25 @@ void StyledElement::createMappedDecl(Attribute* attr)
decl->setStrictParsing(false); // Mapped attributes are just always quirky.
}
-// Paul Hsieh's SuperFastHash
-// http://www.azillionmonkeys.com/qed/hash.html
unsigned MappedAttributeHash::hash(const MappedAttributeKey& key)
{
- uint32_t hash = WTF::stringHashingStartValue;
- uint32_t tmp;
-
- const uint16_t* p;
-
- p = reinterpret_cast<const uint16_t*>(&key.name);
- hash += p[0];
- tmp = (p[1] << 11) ^ hash;
- hash = (hash << 16) ^ tmp;
- hash += hash >> 11;
- ASSERT(sizeof(key.name) == 4 || sizeof(key.name) == 8);
- if (sizeof(key.name) == 8) {
- p += 2;
- hash += p[0];
- tmp = (p[1] << 11) ^ hash;
- hash = (hash << 16) ^ tmp;
- hash += hash >> 11;
- }
+ COMPILE_ASSERT(sizeof(key.name) == 4 || sizeof(key.name) == 8, key_name_size);
+ COMPILE_ASSERT(sizeof(key.value) == 4 || sizeof(key.value) == 8, key_value_size);
- p = reinterpret_cast<const uint16_t*>(&key.value);
- hash += p[0];
- tmp = (p[1] << 11) ^ hash;
- hash = (hash << 16) ^ tmp;
- hash += hash >> 11;
- ASSERT(sizeof(key.value) == 4 || sizeof(key.value) == 8);
- if (sizeof(key.value) == 8) {
- p += 2;
- hash += p[0];
- tmp = (p[1] << 11) ^ hash;
- hash = (hash << 16) ^ tmp;
- hash += hash >> 11;
- }
+ WTF::StringHasher hasher;
+ const UChar* data;
+
+ data = reinterpret_cast<const UChar*>(&key.name);
+ hasher.addCharacters(data[0], data[1]);
+ if (sizeof(key.name) == 8)
+ hasher.addCharacters(data[2], data[3]);
+
+ data = reinterpret_cast<const UChar*>(&key.value);
+ hasher.addCharacters(data[0], data[1]);
+ if (sizeof(key.value) == 8)
+ hasher.addCharacters(data[2], data[3]);
- // Handle end case
- hash += key.type;
- 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
- if (hash == 0)
- hash = 0x80000000;
-
- return hash;
+ return hasher.hash();
}
void StyledElement::copyNonAttributeProperties(const Element *sourceElement)
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list