[SCM] WebKit Debian packaging branch, webkit-1.1, updated. upstream/1.1.17-1283-gcf603cf

mrowe at apple.com mrowe at apple.com
Wed Jan 6 00:20:14 UTC 2010


The following commit has been merged in the webkit-1.1 branch:
commit 196b3a525d31d0df1a3519bdd37171dd8eace242
Author: mrowe at apple.com <mrowe at apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Tue Jan 5 00:13:21 2010 +0000

    Roll out r52758 as it accidentally the whole build.
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@52768 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/JavaScriptCore/ChangeLog b/JavaScriptCore/ChangeLog
index a9149c7..5917038 100644
--- a/JavaScriptCore/ChangeLog
+++ b/JavaScriptCore/ChangeLog
@@ -1,9 +1,3 @@
-2010-01-04  Gavin Barraclough  <barraclough at apple.com>
-
-        Reviewed by NOBODY (more speculative build fix).
-
-        * wtf/unicode/Unicode.h:
-
 2010-01-04  Dmitry Titov  <dimich at chromium.org>
 
         Not reviewed, attempt to fix ARM bulid.
@@ -31,33 +25,6 @@
 
 2010-01-04  Gavin Barraclough  <barraclough at apple.com>
 
-        Reviewed by NOBODY build fix for DRT, fix incorrect style include.
-
-        * wtf/HashFunctions.h:
-
-2010-01-04  Gavin Barraclough  <barraclough at apple.com>
-
-        Reviewed by NOBODY Windows build fix.
-
-        * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def:
-
-2010-01-04  Gavin Barraclough  <barraclough at apple.com>
-
-        Reviewed by Sam Weinig.
-
-        https://bugs.webkit.org/show_bug.cgi?id=33163
-        Add string hashing functions to WTF.
-        Use WTF's string hashing functions from UStringImpl.
-
-        * JavaScriptCore.exp:
-        * runtime/UStringImpl.cpp:
-        * runtime/UStringImpl.h:
-        (JSC::UStringImpl::computeHash):
-        * wtf/HashFunctions.h:
-        (WTF::stringHash):
-
-2010-01-04  Gavin Barraclough  <barraclough at apple.com>
-
         Reviewed by Sam "Shimmey Shimmey" Weinig.
 
         https://bugs.webkit.org/show_bug.cgi?id=33158
diff --git a/JavaScriptCore/JavaScriptCore.exp b/JavaScriptCore/JavaScriptCore.exp
index 4a87e4e..30b174c 100644
--- a/JavaScriptCore/JavaScriptCore.exp
+++ b/JavaScriptCore/JavaScriptCore.exp
@@ -103,6 +103,8 @@ __ZN3JSC10throwErrorEPNS_9ExecStateENS_9ErrorTypeERKNS_7UStringE
 __ZN3JSC11JSByteArray15createStructureENS_7JSValueE
 __ZN3JSC11JSByteArrayC1EPNS_9ExecStateEN3WTF17NonNullPassRefPtrINS_9StructureEEEPNS3_9ByteArrayEPKNS_9ClassInfoE
 __ZN3JSC11ParserArena5resetEv
+__ZN3JSC11UStringImpl11computeHashEPKci
+__ZN3JSC11UStringImpl11computeHashEPKti
 __ZN3JSC11UStringImpl12sharedBufferEv
 __ZN3JSC11UStringImpl6s_nullE
 __ZN3JSC11UStringImpl7destroyEv
diff --git a/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def b/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def
index eee2c5d..e692c60 100644
--- a/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def
+++ b/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def
@@ -61,6 +61,7 @@ EXPORTS
     ?collate at Collator@WTF@@QBE?AW4Result at 12@PB_WI0I at Z
     ?collectAllGarbage at Heap@JSC@@QAEXXZ
     ?computeHash at UStringImpl@JSC@@SAIPB_WH at Z
+    ?computeHash at UStringImpl@JSC@@SAIPBDH at Z
     ?configurable at PropertyDescriptor@JSC@@QBE_NXZ
     ?construct at JSC@@YAPAVJSObject at 1@PAVExecState at 1@VJSValue at 1@W4ConstructType at 1@ABTConstructData at 1@ABVArgList at 1@@Z
     ?constructArray at JSC@@YAPAVJSArray at 1@PAVExecState at 1@ABVArgList at 1@@Z
diff --git a/JavaScriptCore/runtime/UStringImpl.cpp b/JavaScriptCore/runtime/UStringImpl.cpp
index 4288624..fa9abe6 100644
--- a/JavaScriptCore/runtime/UStringImpl.cpp
+++ b/JavaScriptCore/runtime/UStringImpl.cpp
@@ -81,4 +81,97 @@ void UStringImpl::destroy()
     delete this;
 }
 
+// Golden ratio - arbitrary start value to avoid mapping all 0's to all 0's
+// or anything like that.
+const unsigned PHI = 0x9e3779b9U;
+
+// Paul Hsieh's SuperFastHash
+// http://www.azillionmonkeys.com/qed/hash.html
+unsigned UStringImpl::computeHash(const UChar* s, int len)
+{
+    unsigned l = len;
+    uint32_t hash = PHI;
+    uint32_t tmp;
+
+    int rem = l & 1;
+    l >>= 1;
+
+    // Main loop
+    for (; l > 0; l--) {
+        hash += s[0];
+        tmp = (s[1] << 11) ^ hash;
+        hash = (hash << 16) ^ tmp;
+        s += 2;
+        hash += hash >> 11;
+    }
+
+    // Handle end case
+    if (rem) {
+        hash += 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
+    if (hash == 0)
+        hash = 0x80000000;
+
+    return hash;
+}
+
+// Paul Hsieh's SuperFastHash
+// http://www.azillionmonkeys.com/qed/hash.html
+unsigned UStringImpl::computeHash(const char* s, int l)
+{
+    // 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 should give matching results
+
+    uint32_t hash = PHI;
+    uint32_t tmp;
+
+    size_t rem = l & 1;
+    l >>= 1;
+
+    // Main loop
+    for (; l > 0; l--) {
+        hash += static_cast<unsigned char>(s[0]);
+        tmp = (static_cast<unsigned char>(s[1]) << 11) ^ hash;
+        hash = (hash << 16) ^ tmp;
+        s += 2;
+        hash += hash >> 11;
+    }
+
+    // Handle end case
+    if (rem) {
+        hash += static_cast<unsigned char>(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
+    if (hash == 0)
+        hash = 0x80000000;
+
+    return hash;
+}
+
 }
diff --git a/JavaScriptCore/runtime/UStringImpl.h b/JavaScriptCore/runtime/UStringImpl.h
index e6fcc27..e6c91a0 100644
--- a/JavaScriptCore/runtime/UStringImpl.h
+++ b/JavaScriptCore/runtime/UStringImpl.h
@@ -27,7 +27,6 @@
 #define UStringImpl_h
 
 #include <wtf/CrossThreadRefCounted.h>
-#include <wtf/HashFunctions.h>
 #include <wtf/OwnFastMallocPtr.h>
 #include <wtf/PossiblyNull.h>
 #include <wtf/unicode/Unicode.h>
@@ -161,9 +160,9 @@ public:
             memcpy(destination, source, numCharacters * sizeof(UChar));
     }
 
-    static unsigned computeHash(const UChar* s, int length) { ASSERT(length >= 0); return WTF::stringHash(s, length); }
-    static unsigned computeHash(const char* s, int length) { ASSERT(length >= 0); return WTF::stringHash(s, length); }
-    static unsigned computeHash(const char* s) { return WTF::stringHash(s); }
+    static unsigned computeHash(const UChar*, int length);
+    static unsigned computeHash(const char*, int length);
+    static unsigned computeHash(const char* s) { return computeHash(s, strlen(s)); }
 
     static UStringImpl& null() { return *s_null; }
     static UStringImpl& empty() { return *s_empty; }
diff --git a/JavaScriptCore/wtf/HashFunctions.h b/JavaScriptCore/wtf/HashFunctions.h
index 6641e1a..13afb72 100644
--- a/JavaScriptCore/wtf/HashFunctions.h
+++ b/JavaScriptCore/wtf/HashFunctions.h
@@ -22,7 +22,6 @@
 #define WTF_HashFunctions_h
 
 #include "RefPtr.h"
-#include "Unicode.h"
 #include <stdint.h>
 
 namespace WTF {
@@ -178,125 +177,6 @@ namespace WTF {
     // Golden ratio - arbitrary start value to avoid mapping all 0's to all 0's
     static const unsigned stringHashingStartValue = 0x9e3779b9U;
 
-    // stringHash methods based on Paul Hsieh's SuperFastHash.
-    // http://www.azillionmonkeys.com/qed/hash.html
-    // char* data is interpreted as latin-encoded (zero extended to 16 bits).
-
-    inline unsigned stringHash(const UChar* data, unsigned length)
-    {
-        unsigned hash = WTF::stringHashingStartValue;
-        unsigned rem = length & 1;
-        length >>= 1;
-
-        // Main loop
-        for (; length > 0; length--) {
-            hash += data[0];
-            unsigned tmp = (data[1] << 11) ^ hash;
-            hash = (hash << 16) ^ tmp;
-            data += 2;
-            hash += hash >> 11;
-        }
-
-        // Handle end case
-        if (rem) {
-            hash += data[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
-        if (hash == 0)
-            hash = 0x80000000;
-
-        return hash;
-    }
-
-    inline unsigned stringHash(const char* data, unsigned length)
-    {
-        unsigned hash = WTF::stringHashingStartValue;
-        unsigned rem = length & 1;
-        length >>= 1;
-
-        // Main loop
-        for (; length > 0; length--) {
-            hash += static_cast<unsigned char>(data[0]);
-            unsigned tmp = (static_cast<unsigned char>(data[1]) << 11) ^ hash;
-            hash = (hash << 16) ^ tmp;
-            data += 2;
-            hash += hash >> 11;
-        }
-
-        // Handle end case
-        if (rem) {
-            hash += static_cast<unsigned char>(data[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
-        if (hash == 0)
-            hash = 0x80000000;
-
-        return hash;
-    }
-
-    inline unsigned stringHash(const char* data)
-    {
-        unsigned hash = WTF::stringHashingStartValue;
-        
-        // Main loop
-        for (;;) {
-            unsigned char b0 = data[0];
-            if (!b0)
-                break;
-            unsigned char b1 = data[1];
-            if (!b1) {
-                hash += b0;
-                hash ^= hash << 11;
-                hash += hash >> 17;
-                break;
-            }
-            hash += b0;
-            unsigned tmp = (b1 << 11) ^ hash;
-            hash = (hash << 16) ^ tmp;
-            data += 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;
-    }
-
 } // namespace WTF
 
 using WTF::DefaultHash;
diff --git a/JavaScriptCore/wtf/unicode/Unicode.h b/JavaScriptCore/wtf/unicode/Unicode.h
index 775b3aa..d59439d 100644
--- a/JavaScriptCore/wtf/unicode/Unicode.h
+++ b/JavaScriptCore/wtf/unicode/Unicode.h
@@ -23,7 +23,7 @@
 #ifndef WTF_UNICODE_H
 #define WTF_UNICODE_H
 
-#include "Assertions.h"
+#include <wtf/Assertions.h>
 
 #if USE(QT4_UNICODE)
 #include "qt4/UnicodeQt4.h"
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 1766b22..345855f 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -5,16 +5,6 @@
         * page/FrameView.cpp:
         (WebCore::FrameView::layout):
 
-2010-01-04  Gavin Barraclough  <barraclough at apple.com>
-
-        Reviewed by Sam Weinig.
-
-        https://bugs.webkit.org/show_bug.cgi?id=33163
-        Use WTF's string hashing functions from StringImpl.
-
-        * platform/text/StringImpl.h:
-        (WebCore::StringImpl::computeHash):
-
 2010-01-04  Simon Fraser  <simon.fraser at apple.com>
 
         Reviewed by Dan Bernstein.
diff --git a/WebCore/platform/text/StringImpl.h b/WebCore/platform/text/StringImpl.h
index 75f1f2f..b454463 100644
--- a/WebCore/platform/text/StringImpl.h
+++ b/WebCore/platform/text/StringImpl.h
@@ -26,7 +26,6 @@
 #include <limits.h>
 #include <wtf/ASCIICType.h>
 #include <wtf/CrossThreadRefCounted.h>
-#include <wtf/HashFunctions.h>
 #include <wtf/OwnFastMallocPtr.h>
 #include <wtf/PtrAndFlags.h>
 #include <wtf/RefCounted.h>
@@ -103,8 +102,8 @@ public:
 
     unsigned hash() { if (m_hash == 0) m_hash = computeHash(m_data, m_length); return m_hash; }
     unsigned existingHash() const { ASSERT(m_hash); return m_hash; }
-    inline static unsigned computeHash(const UChar* data, unsigned length) { return WTF::stringHash(data, length); }
-    inline static unsigned computeHash(const char* data) { return WTF::stringHash(data); }
+    static unsigned computeHash(const UChar*, unsigned len);
+    static unsigned computeHash(const char*);
     
     // Returns a StringImpl suitable for use on another thread.
     PassRefPtr<StringImpl> crossThreadString();
@@ -214,6 +213,91 @@ inline bool equalIgnoringCase(const char* a, const UChar* b, unsigned length) {
 
 bool equalIgnoringNullity(StringImpl*, StringImpl*);
 
+// Golden ratio - arbitrary start value to avoid mapping all 0's to all 0's
+// or anything like that.
+const unsigned phi = 0x9e3779b9U;
+
+// Paul Hsieh's SuperFastHash
+// http://www.azillionmonkeys.com/qed/hash.html
+inline unsigned StringImpl::computeHash(const UChar* data, unsigned length)
+{
+    unsigned hash = phi;
+    
+    // Main loop.
+    for (unsigned pairCount = length >> 1; pairCount; pairCount--) {
+        hash += data[0];
+        unsigned tmp = (data[1] << 11) ^ hash;
+        hash = (hash << 16) ^ tmp;
+        data += 2;
+        hash += hash >> 11;
+    }
+    
+    // Handle end case.
+    if (length & 1) {
+        hash += data[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;
+}
+
+// Paul Hsieh's SuperFastHash
+// http://www.azillionmonkeys.com/qed/hash.html
+inline unsigned StringImpl::computeHash(const char* data)
+{
+    // 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 should give matching results
+
+    unsigned hash = phi;
+    
+    // Main loop
+    for (;;) {
+        unsigned char b0 = data[0];
+        if (!b0)
+            break;
+        unsigned char b1 = data[1];
+        if (!b1) {
+            hash += b0;
+            hash ^= hash << 11;
+            hash += hash >> 17;
+            break;
+        }
+        hash += b0;
+        unsigned tmp = (b1 << 11) ^ hash;
+        hash = (hash << 16) ^ tmp;
+        data += 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.
+    hash |= !hash << 31;
+    
+    return hash;
+}
+
 static inline bool isSpaceOrNewline(UChar c)
 {
     // Use isASCIISpace() for basic Latin-1.

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list