X-Git-Url: https://git.saurik.com/apple/javascriptcore.git/blobdiff_plain/ba379fdc102753d6be2c4d937058fe40257329fe..1981f5dfe8d77d97469d20652f712a09400c48ed:/profiler/CallIdentifier.h diff --git a/profiler/CallIdentifier.h b/profiler/CallIdentifier.h index ba48c55..2da8a2f 100644 --- a/profiler/CallIdentifier.h +++ b/profiler/CallIdentifier.h @@ -28,11 +28,14 @@ #define CallIdentifier_h #include -#include "FastAllocBase.h" +#include +#include namespace JSC { - struct CallIdentifier : public FastAllocBase { + struct CallIdentifier { + WTF_MAKE_FAST_ALLOCATED; + public: UString m_name; UString m_url; unsigned m_lineNumber; @@ -44,7 +47,7 @@ namespace JSC { CallIdentifier(const UString& name, const UString& url, int lineNumber) : m_name(name) - , m_url(url) + , m_url(!url.isNull() ? url : "") , m_lineNumber(lineNumber) { } @@ -56,11 +59,11 @@ namespace JSC { static unsigned hash(const CallIdentifier& key) { unsigned hashCodes[3] = { - key.m_name.rep()->hash(), - key.m_url.rep()->hash(), + key.m_name.impl()->hash(), + key.m_url.impl()->hash(), key.m_lineNumber }; - return UString::Rep::computeHash(reinterpret_cast(hashCodes), sizeof(hashCodes)); + return StringHasher::hashMemory(hashCodes); } static bool equal(const CallIdentifier& a, const CallIdentifier& b) { return a == b; } @@ -71,7 +74,7 @@ namespace JSC { #ifndef NDEBUG operator const char*() const { return c_str(); } - const char* c_str() const { return m_name.UTF8String().c_str(); } + const char* c_str() const { return m_name.utf8().data(); } #endif }; @@ -84,7 +87,7 @@ namespace WTF { template<> struct HashTraits : GenericHashTraits { static void constructDeletedValue(JSC::CallIdentifier& slot) { - new (&slot) JSC::CallIdentifier(JSC::UString(), JSC::UString(), std::numeric_limits::max()); + new (NotNull, &slot) JSC::CallIdentifier(JSC::UString(), JSC::UString(), std::numeric_limits::max()); } static bool isDeletedValue(const JSC::CallIdentifier& value) {