Ignore:
Timestamp:
Jan 4, 2010, 5:24:48 PM (15 years ago)
Author:
[email protected]
Message:

JavaScriptCore: https://bugs.webkit.org/show_bug.cgi?id=33163
Add string hashing functions to WTF.
Use WTF's string hashing functions from UStringImpl.

Reviewed by Sam Weinig, additional coding by Mark Rowe.

(JSC::UStringImpl::computeHash):

  • wtf/HashFunctions.h:
  • wtf/StringHashFunctions.h: Added.

(WTF::stringHash):

JavaScriptGlue: Add a forwarding header so that StringHashFunctions.h can be found.

Reviewed by Sam Weinig.

  • ForwardingHeaders/wtf/StringHashFunctions.h: Added.

WebCore: https://bugs.webkit.org/show_bug.cgi?id=33163
Use WTF's string hashing functions from StringImpl.

Patch by Mark Rowe <[email protected]> on 2010-01-04
Reviewed by Sam Weinig.

  • ForwardingHeaders/wtf/StringHashFunctions.h: Added.
  • platform/text/StringHash.h:
  • platform/text/StringImpl.h:

(WebCore::StringImpl::computeHash):

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/runtime/UStringImpl.h

    r52768 r52776  
    2727#define UStringImpl_h
    2828
     29#include <limits>
    2930#include <wtf/CrossThreadRefCounted.h>
    3031#include <wtf/OwnFastMallocPtr.h>
    3132#include <wtf/PossiblyNull.h>
     33#include <wtf/StringHashFunctions.h>
    3234#include <wtf/unicode/Unicode.h>
    33 #include <limits>
    3435
    3536namespace JSC {
     
    161162    }
    162163
    163     static unsigned computeHash(const UChar*, int length);
    164     static unsigned computeHash(const char*, int length);
    165     static unsigned computeHash(const char* s) { return computeHash(s, strlen(s)); }
     164    static unsigned computeHash(const UChar* s, int length) { ASSERT(length >= 0); return WTF::stringHash(s, length); }
     165    static unsigned computeHash(const char* s, int length) { ASSERT(length >= 0); return WTF::stringHash(s, length); }
     166    static unsigned computeHash(const char* s) { return WTF::stringHash(s); }
    166167
    167168    static UStringImpl& null() { return *s_null; }
Note: See TracChangeset for help on using the changeset viewer.