[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 13:47:07 UTC 2010
The following commit has been merged in the debian/experimental branch:
commit 4f0be44344d3f6479bb0ebca827d4980fcc41f9e
Author: paroga at webkit.org <paroga at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Mon Sep 27 05:28:15 2010 +0000
2010-09-26 Patrick Gansterer <paroga at webkit.org>
Reviewed by Adam Barth.
Add WTF::StringHasher::createBlobHash
https://bugs.webkit.org/show_bug.cgi?id=46514
Add this function for hashing FormElementKey and QualifiedNameComponents.
* wtf/StringHashFunctions.h:
(WTF::StringHasher::createBlobHash):
2010-09-26 Patrick Gansterer <paroga at webkit.org>
Reviewed by Adam Barth.
Add WTF::StringHasher::createBlobHash
https://bugs.webkit.org/show_bug.cgi?id=46514
Add this function for hashing FormElementKey and QualifiedNameComponents.
* dom/Document.cpp:
(WebCore::FormElementKeyHash::hash):
* dom/QualifiedName.h:
(WebCore::hashComponents):
(WebCore::QualifiedNameHash::hash):
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@68369 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/JavaScriptCore/ChangeLog b/JavaScriptCore/ChangeLog
index 6a9550e..01cfdf8 100644
--- a/JavaScriptCore/ChangeLog
+++ b/JavaScriptCore/ChangeLog
@@ -2,6 +2,18 @@
Reviewed by Adam Barth.
+ Add WTF::StringHasher::createBlobHash
+ https://bugs.webkit.org/show_bug.cgi?id=46514
+
+ Add this function for hashing FormElementKey and QualifiedNameComponents.
+
+ * wtf/StringHashFunctions.h:
+ (WTF::StringHasher::createBlobHash):
+
+2010-09-26 Patrick Gansterer <paroga at webkit.org>
+
+ Reviewed by Adam Barth.
+
REGRESSION (r68289): Assertion failure in StringHasher::addCharacter() (ch != invalidCharacterValue)
running websocket/tests/bad-sub-protocol-non-ascii.html
https://bugs.webkit.org/show_bug.cgi?id=46553
diff --git a/JavaScriptCore/wtf/StringHashFunctions.h b/JavaScriptCore/wtf/StringHashFunctions.h
index c5d8efd..6810b31 100644
--- a/JavaScriptCore/wtf/StringHashFunctions.h
+++ b/JavaScriptCore/wtf/StringHashFunctions.h
@@ -135,6 +135,12 @@ public:
return createHash<T, defaultCoverter>(data);
}
+ template<size_t length> static inline unsigned createBlobHash(const void* data)
+ {
+ COMPILE_ASSERT(!(length % 4), length_must_be_a_multible_of_four);
+ return createHash<UChar>(static_cast<const UChar*>(data), length / sizeof(UChar));
+ }
+
private:
static inline UChar defaultCoverter(UChar ch)
{
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 901a80a..4b83c22 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,18 @@
+2010-09-26 Patrick Gansterer <paroga at webkit.org>
+
+ Reviewed by Adam Barth.
+
+ Add WTF::StringHasher::createBlobHash
+ https://bugs.webkit.org/show_bug.cgi?id=46514
+
+ Add this function for hashing FormElementKey and QualifiedNameComponents.
+
+ * dom/Document.cpp:
+ (WebCore::FormElementKeyHash::hash):
+ * dom/QualifiedName.h:
+ (WebCore::hashComponents):
+ (WebCore::QualifiedNameHash::hash):
+
2010-09-26 David Hyatt <hyatt at apple.com>
Reviewed by Sam Weinig.
diff --git a/WebCore/dom/Document.cpp b/WebCore/dom/Document.cpp
index c3feae4..27c5ef9 100644
--- a/WebCore/dom/Document.cpp
+++ b/WebCore/dom/Document.cpp
@@ -4277,37 +4277,9 @@ void FormElementKey::deref() const
type()->deref();
}
-unsigned FormElementKeyHash::hash(const FormElementKey& k)
+unsigned FormElementKeyHash::hash(const FormElementKey& key)
{
- ASSERT(sizeof(k) % (sizeof(uint16_t) * 2) == 0);
-
- unsigned l = sizeof(k) / (sizeof(uint16_t) * 2);
- const uint16_t* s = reinterpret_cast<const uint16_t*>(&k);
- uint32_t hash = WTF::stringHashingStartValue;
-
- // Main loop
- for (; l > 0; l--) {
- hash += s[0];
- uint32_t tmp = (s[1] << 11) ^ hash;
- hash = (hash << 16) ^ tmp;
- s += 2;
- hash += hash >> 11;
- }
-
- // 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)
- hash = 0x80000000;
-
- return hash;
+ return WTF::StringHasher::createBlobHash<sizeof(FormElementKey)>(&key);
}
void Document::setIconURL(const String& iconURL, const String& type)
diff --git a/WebCore/dom/QualifiedName.h b/WebCore/dom/QualifiedName.h
index ee90408..2da8f0c 100644
--- a/WebCore/dom/QualifiedName.h
+++ b/WebCore/dom/QualifiedName.h
@@ -112,52 +112,24 @@ inline bool operator!=(const QualifiedName& q, const AtomicString& a) { return a
inline unsigned hashComponents(const QualifiedNameComponents& buf)
{
- ASSERT(sizeof(QualifiedNameComponents) % (sizeof(uint16_t) * 2) == 0);
-
- unsigned l = sizeof(QualifiedNameComponents) / (sizeof(uint16_t) * 2);
- const uint16_t* s = reinterpret_cast<const uint16_t*>(&buf);
- uint32_t hash = WTF::stringHashingStartValue;
-
- // Main loop
- for (; l > 0; l--) {
- hash += s[0];
- uint32_t tmp = (s[1] << 11) ^ hash;
- hash = (hash << 16) ^ tmp;
- s += 2;
- hash += hash >> 11;
- }
-
- // 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 WTF::StringHasher::createBlobHash<sizeof(QualifiedNameComponents)>(&buf);
}
-
+
struct QualifiedNameHash {
static unsigned hash(const QualifiedName& name) { return hash(name.impl()); }
-
+
static unsigned hash(const QualifiedName::QualifiedNameImpl* name)
- {
+ {
QualifiedNameComponents c = { name->m_prefix.impl(), name->m_localName.impl(), name->m_namespace.impl() };
return hashComponents(c);
}
-
+
static bool equal(const QualifiedName& a, const QualifiedName& b) { return a == b; }
static bool equal(const QualifiedName::QualifiedNameImpl* a, const QualifiedName::QualifiedNameImpl* b) { return a == b; }
-
+
static const bool safeToCompareToEmptyOrDeleted = false;
};
-
+
}
namespace WTF {
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list