diff options
| author | Ben Murdoch <benm@google.com> | 2011-05-13 16:23:25 +0100 |
|---|---|---|
| committer | Ben Murdoch <benm@google.com> | 2011-05-16 11:35:02 +0100 |
| commit | 65f03d4f644ce73618e5f4f50dd694b26f55ae12 (patch) | |
| tree | f478babb801e720de7bfaee23443ffe029f58731 /Source/JavaScriptCore/wtf | |
| parent | 47de4a2fb7262c7ebdb9cd133ad2c54c187454d0 (diff) | |
| download | external_webkit-65f03d4f644ce73618e5f4f50dd694b26f55ae12.zip external_webkit-65f03d4f644ce73618e5f4f50dd694b26f55ae12.tar.gz external_webkit-65f03d4f644ce73618e5f4f50dd694b26f55ae12.tar.bz2 | |
Merge WebKit at r75993: Initial merge by git.
Change-Id: I602bbdc3974787a3b0450456a30a7868286921c3
Diffstat (limited to 'Source/JavaScriptCore/wtf')
| -rw-r--r-- | Source/JavaScriptCore/wtf/AlwaysInline.h | 4 | ||||
| -rw-r--r-- | Source/JavaScriptCore/wtf/FastMalloc.cpp | 189 | ||||
| -rw-r--r-- | Source/JavaScriptCore/wtf/Platform.h | 17 | ||||
| -rw-r--r-- | Source/JavaScriptCore/wtf/RefPtrHashMap.h | 5 | ||||
| -rw-r--r-- | Source/JavaScriptCore/wtf/StackBounds.cpp | 32 | ||||
| -rw-r--r-- | Source/JavaScriptCore/wtf/text/AtomicString.cpp | 49 |
6 files changed, 192 insertions, 104 deletions
diff --git a/Source/JavaScriptCore/wtf/AlwaysInline.h b/Source/JavaScriptCore/wtf/AlwaysInline.h index 29c35a8..bacbdd0 100644 --- a/Source/JavaScriptCore/wtf/AlwaysInline.h +++ b/Source/JavaScriptCore/wtf/AlwaysInline.h @@ -41,7 +41,7 @@ #endif #ifndef UNLIKELY -#if defined(__GNUC__) +#if COMPILER(GCC) || (RVCT_VERSION_AT_LEAST(3, 0, 0, 0) && defined(__GNUC__)) #define UNLIKELY(x) __builtin_expect((x), 0) #else #define UNLIKELY(x) (x) @@ -49,7 +49,7 @@ #endif #ifndef LIKELY -#if defined(__GNUC__) +#if COMPILER(GCC) || (RVCT_VERSION_AT_LEAST(3, 0, 0, 0) && defined(__GNUC__)) #define LIKELY(x) __builtin_expect((x), 1) #else #define LIKELY(x) (x) diff --git a/Source/JavaScriptCore/wtf/FastMalloc.cpp b/Source/JavaScriptCore/wtf/FastMalloc.cpp index 62d7def..882f10d 100644 --- a/Source/JavaScriptCore/wtf/FastMalloc.cpp +++ b/Source/JavaScriptCore/wtf/FastMalloc.cpp @@ -1,6 +1,6 @@ // Copyright (c) 2005, 2007, Google Inc. // All rights reserved. -// Copyright (C) 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved. +// Copyright (C) 2005, 2006, 2007, 2008, 2009, 2011 Apple Inc. All rights reserved. // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are @@ -442,10 +442,18 @@ extern "C" const int jscore_fastmalloc_introspection = 0; #include <wtf/HashSet.h> #include <wtf/Vector.h> #endif + +#if HAVE(HEADER_DETECTION_H) +#include "HeaderDetection.h" +#endif + #if HAVE(DISPATCH_H) #include <dispatch/dispatch.h> #endif +#if HAVE(PTHREAD_MACHDEP_H) +#include <System/pthread_machdep.h> +#endif #ifndef PRIuS #define PRIuS "zu" @@ -455,7 +463,7 @@ extern "C" const int jscore_fastmalloc_introspection = 0; // call to the function on Mac OS X, and it's used in performance-critical code. So we // use a function pointer. But that's not necessarily faster on other platforms, and we had // problems with this technique on Windows, so we'll do this only on Mac OS X. -#if OS(DARWIN) +#if OS(DARWIN) && !defined(__PTK_FRAMEWORK_JAVASCRIPTCORE_KEY0) static void* (*pthread_getspecific_function_pointer)(pthread_key_t) = pthread_getspecific; #define pthread_getspecific(key) pthread_getspecific_function_pointer(key) #endif @@ -1438,7 +1446,22 @@ class TCMalloc_PageHeap { void scavenge(); ALWAYS_INLINE bool shouldScavenge() const; -#if !HAVE(DISPATCH_H) +#if HAVE(DISPATCH_H) || OS(WINDOWS) + void periodicScavenge(); + ALWAYS_INLINE bool isScavengerSuspended(); + ALWAYS_INLINE void scheduleScavenger(); + ALWAYS_INLINE void rescheduleScavenger(); + ALWAYS_INLINE void suspendScavenger(); +#endif + +#if HAVE(DISPATCH_H) + dispatch_queue_t m_scavengeQueue; + dispatch_source_t m_scavengeTimer; + bool m_scavengingSuspended; +#elif OS(WINDOWS) + static void CALLBACK scavengerTimerFired(void*, BOOLEAN); + HANDLE m_scavengeQueueTimer; +#else static NO_RETURN_WITH_VALUE void* runScavengerThread(void*); NO_RETURN void scavengerThread(); @@ -1448,12 +1471,6 @@ class TCMalloc_PageHeap { pthread_mutex_t m_scavengeMutex; pthread_cond_t m_scavengeCondition; -#else // !HAVE(DISPATCH_H) - void periodicScavenge(); - - dispatch_queue_t m_scavengeQueue; - dispatch_source_t m_scavengeTimer; - bool m_scavengingScheduled; #endif #endif // USE_BACKGROUND_THREAD_TO_SCAVENGE_MEMORY @@ -1489,7 +1506,85 @@ void TCMalloc_PageHeap::init() #if USE_BACKGROUND_THREAD_TO_SCAVENGE_MEMORY -#if !HAVE(DISPATCH_H) +#if HAVE(DISPATCH_H) + +void TCMalloc_PageHeap::initializeScavenger() +{ + m_scavengeQueue = dispatch_queue_create("com.apple.JavaScriptCore.FastMallocSavenger", NULL); + m_scavengeTimer = dispatch_source_create(DISPATCH_SOURCE_TYPE_TIMER, 0, 0, m_scavengeQueue); + dispatch_time_t startTime = dispatch_time(DISPATCH_TIME_NOW, kScavengeDelayInSeconds * NSEC_PER_SEC); + dispatch_source_set_timer(m_scavengeTimer, startTime, kScavengeDelayInSeconds * NSEC_PER_SEC, 1000 * NSEC_PER_USEC); + dispatch_source_set_event_handler(m_scavengeTimer, ^{ periodicScavenge(); }); + m_scavengingSuspended = true; +} + +ALWAYS_INLINE bool TCMalloc_PageHeap::isScavengerSuspended() +{ + ASSERT(IsHeld(pageheap_lock)); + return m_scavengingSuspended; +} + +ALWAYS_INLINE void TCMalloc_PageHeap::scheduleScavenger() +{ + ASSERT(IsHeld(pageheap_lock)); + m_scavengingSuspended = false; + dispatch_resume(m_scavengeTimer); +} + +ALWAYS_INLINE void TCMalloc_PageHeap::rescheduleScavenger() +{ + // Nothing to do here for libdispatch. +} + +ALWAYS_INLINE void TCMalloc_PageHeap::suspendScavenger() +{ + ASSERT(IsHeld(pageheap_lock)); + m_scavengingSuspended = true; + dispatch_suspend(m_scavengeTimer); +} + +#elif OS(WINDOWS) + +void TCMalloc_PageHeap::scavengerTimerFired(void* context, BOOLEAN) +{ + static_cast<TCMalloc_PageHeap*>(context)->periodicScavenge(); +} + +void TCMalloc_PageHeap::initializeScavenger() +{ + m_scavengeQueueTimer = 0; +} + +ALWAYS_INLINE bool TCMalloc_PageHeap::isScavengerSuspended() +{ + ASSERT(IsHeld(pageheap_lock)); + return !m_scavengeQueueTimer; +} + +ALWAYS_INLINE void TCMalloc_PageHeap::scheduleScavenger() +{ + // We need to use WT_EXECUTEONLYONCE here and reschedule the timer, because + // Windows will fire the timer event even when the function is already running. + ASSERT(IsHeld(pageheap_lock)); + CreateTimerQueueTimer(&m_scavengeQueueTimer, 0, scavengerTimerFired, this, kScavengeDelayInSeconds * 1000, 0, WT_EXECUTEONLYONCE); +} + +ALWAYS_INLINE void TCMalloc_PageHeap::rescheduleScavenger() +{ + // We must delete the timer and create it again, because it is not possible to retrigger a timer on Windows. + suspendScavenger(); + scheduleScavenger(); +} + +ALWAYS_INLINE void TCMalloc_PageHeap::suspendScavenger() +{ + ASSERT(IsHeld(pageheap_lock)); + HANDLE scavengeQueueTimer = m_scavengeQueueTimer; + m_scavengeQueueTimer = 0; + DeleteTimerQueueTimer(0, scavengeQueueTimer, 0); +} + +#else void TCMalloc_PageHeap::initializeScavenger() { @@ -1529,27 +1624,6 @@ ALWAYS_INLINE void TCMalloc_PageHeap::signalScavenger() pthread_cond_signal(&m_scavengeCondition); } -#else // !HAVE(DISPATCH_H) - -void TCMalloc_PageHeap::initializeScavenger() -{ - m_scavengeQueue = dispatch_queue_create("com.apple.JavaScriptCore.FastMallocSavenger", NULL); - m_scavengeTimer = dispatch_source_create(DISPATCH_SOURCE_TYPE_TIMER, 0, 0, m_scavengeQueue); - dispatch_time_t startTime = dispatch_time(DISPATCH_TIME_NOW, kScavengeDelayInSeconds * NSEC_PER_SEC); - dispatch_source_set_timer(m_scavengeTimer, startTime, kScavengeDelayInSeconds * NSEC_PER_SEC, 1000 * NSEC_PER_USEC); - dispatch_source_set_event_handler(m_scavengeTimer, ^{ periodicScavenge(); }); - m_scavengingScheduled = false; -} - -ALWAYS_INLINE void TCMalloc_PageHeap::signalScavenger() -{ - ASSERT(IsHeld(pageheap_lock)); - if (!m_scavengingScheduled && shouldScavenge()) { - m_scavengingScheduled = true; - dispatch_resume(m_scavengeTimer); - } -} - #endif void TCMalloc_PageHeap::scavenge() @@ -2378,13 +2452,29 @@ static inline TCMalloc_PageHeap* getPageHeap() #if USE_BACKGROUND_THREAD_TO_SCAVENGE_MEMORY -#if !HAVE(DISPATCH_H) -#if OS(WINDOWS) -static void sleep(unsigned seconds) +#if HAVE(DISPATCH_H) || OS(WINDOWS) + +void TCMalloc_PageHeap::periodicScavenge() { - ::Sleep(seconds * 1000); + SpinLockHolder h(&pageheap_lock); + pageheap->scavenge(); + + if (shouldScavenge()) { + rescheduleScavenger(); + return; + } + + suspendScavenger(); } -#endif + +ALWAYS_INLINE void TCMalloc_PageHeap::signalScavenger() +{ + ASSERT(IsHeld(pageheap_lock)); + if (isScavengerSuspended() && shouldScavenge()) + scheduleScavenger(); +} + +#else void TCMalloc_PageHeap::scavengerThread() { @@ -2409,19 +2499,7 @@ void TCMalloc_PageHeap::scavengerThread() } } -#else - -void TCMalloc_PageHeap::periodicScavenge() -{ - SpinLockHolder h(&pageheap_lock); - pageheap->scavenge(); - - if (!shouldScavenge()) { - m_scavengingScheduled = false; - dispatch_suspend(m_scavengeTimer); - } -} -#endif // HAVE(DISPATCH_H) +#endif #endif @@ -2448,11 +2526,18 @@ DWORD tlsIndex = TLS_OUT_OF_INDEXES; static ALWAYS_INLINE void setThreadHeap(TCMalloc_ThreadCache* heap) { - // still do pthread_setspecific when using MSVC fast TLS to - // benefit from the delete callback. + // Still do pthread_setspecific even if there's an alternate form + // of thread-local storage in use, to benefit from the delete callback. pthread_setspecific(heap_key, heap); + #if OS(WINDOWS) TlsSetValue(tlsIndex, heap); +#elif defined(__PTK_FRAMEWORK_JAVASCRIPTCORE_KEY0) + // Can't have two libraries both doing this in the same process, + // so check and make this crash right away. + if (_pthread_getspecific_direct(__PTK_FRAMEWORK_JAVASCRIPTCORE_KEY0)) + CRASH(); + _pthread_setspecific_direct(__PTK_FRAMEWORK_JAVASCRIPTCORE_KEY0, heap); #endif } @@ -2964,6 +3049,8 @@ inline TCMalloc_ThreadCache* TCMalloc_ThreadCache::GetThreadHeap() { return threadlocal_heap; #elif OS(WINDOWS) return static_cast<TCMalloc_ThreadCache*>(TlsGetValue(tlsIndex)); +#elif defined(__PTK_FRAMEWORK_JAVASCRIPTCORE_KEY0) + return static_cast<TCMalloc_ThreadCache*>(_pthread_getspecific_direct(__PTK_FRAMEWORK_JAVASCRIPTCORE_KEY0)); #else return static_cast<TCMalloc_ThreadCache*>(pthread_getspecific(heap_key)); #endif diff --git a/Source/JavaScriptCore/wtf/Platform.h b/Source/JavaScriptCore/wtf/Platform.h index e6175c4..e3fec74 100644 --- a/Source/JavaScriptCore/wtf/Platform.h +++ b/Source/JavaScriptCore/wtf/Platform.h @@ -74,9 +74,10 @@ /* COMPILER(RVCT4_OR_GREATER) - ARM RealView Compilation Tools 4.0 or greater */ #if defined(__CC_ARM) || defined(__ARMCC__) #define WTF_COMPILER_RVCT 1 -#if __ARMCC_VERSION >= 400000 -#define WTF_COMPILER_RVCT4_OR_GREATER 1 -#endif +#define RVCT_VERSION_AT_LEAST(major, minor, patch, build) (__ARMCC_VERSION >= (major * 100000 + minor * 10000 + patch * 1000 + build)) +#else +/* Define this for !RVCT compilers, just so we can write things like RVCT_VERSION_AT_LEAST(3, 0, 0, 0). */ +#define RVCT_VERSION_AT_LEAST(major, minor, patch, build) 0 #endif /* COMPILER(GCC) - GNU Compiler Collection */ @@ -86,7 +87,7 @@ #define GCC_VERSION (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__) #define GCC_VERSION_AT_LEAST(major, minor, patch) (GCC_VERSION >= (major * 10000 + minor * 100 + patch)) #else -/* define this for !GCC compilers, just so we can write things like COMPILER(GCC) && GCC_VERSION_AT_LEAST(4,1,0) */ +/* Define this for !GCC compilers, just so we can write things like GCC_VERSION_AT_LEAST(4, 1, 0). */ #define GCC_VERSION_AT_LEAST(major, minor, patch) 0 #endif @@ -971,8 +972,8 @@ #define ENABLE_REPAINT_THROTTLING 0 #endif -/* Disable the JIT on versiond of GCC prior to 4.1 */ -#if !defined(ENABLE_JIT) && COMPILER(GCC) && !GCC_VERSION_AT_LEAST(4,1,0) +/* Disable the JIT on versions of GCC prior to 4.1 */ +#if !defined(ENABLE_JIT) && COMPILER(GCC) && !GCC_VERSION_AT_LEAST(4, 1, 0) #define ENABLE_JIT 0 #endif @@ -984,7 +985,7 @@ /* The JIT is enabled by default on all x86, x64-64, ARM & MIPS platforms. */ #if !defined(ENABLE_JIT) \ && (CPU(X86) || CPU(X86_64) || CPU(ARM) || CPU(MIPS)) \ - && (OS(DARWIN) || !COMPILER(GCC) || GCC_VERSION_AT_LEAST(4,1,0)) \ + && (OS(DARWIN) || !COMPILER(GCC) || GCC_VERSION_AT_LEAST(4, 1, 0)) \ && !OS(WINCE) #define ENABLE_JIT 1 #endif @@ -1028,7 +1029,7 @@ #endif /* Configure the interpreter */ -#if COMPILER(GCC) || (COMPILER(RVCT4_OR_GREATER) && defined(__GNUC__)) +#if COMPILER(GCC) || (RVCT_VERSION_AT_LEAST(4, 0, 0, 0) && defined(__GNUC__)) #define HAVE_COMPUTED_GOTO 1 #endif #if HAVE(COMPUTED_GOTO) && ENABLE(INTERPRETER) diff --git a/Source/JavaScriptCore/wtf/RefPtrHashMap.h b/Source/JavaScriptCore/wtf/RefPtrHashMap.h index 7f6ebfe..b9e7eea 100644 --- a/Source/JavaScriptCore/wtf/RefPtrHashMap.h +++ b/Source/JavaScriptCore/wtf/RefPtrHashMap.h @@ -18,6 +18,9 @@ * */ +#ifndef RefPtrHashMap_h +#define RefPtrHashMap_h + namespace WTF { // This specialization is a direct copy of HashMap, with overloaded functions @@ -334,3 +337,5 @@ namespace WTF { } } // namespace WTF + +#endif // RefPtrHashMap_h diff --git a/Source/JavaScriptCore/wtf/StackBounds.cpp b/Source/JavaScriptCore/wtf/StackBounds.cpp index f83695e..be8ce84 100644 --- a/Source/JavaScriptCore/wtf/StackBounds.cpp +++ b/Source/JavaScriptCore/wtf/StackBounds.cpp @@ -60,12 +60,12 @@ namespace WTF { // Bug 26276 - Need a mechanism to determine stack extent // // These platforms should now be working correctly: -// DARWIN, WINDOWS-CPU(X86), QNX, UNIX, WINCE +// DARWIN, QNX, UNIX // These platforms are not: -// WINDOWS-CPU(X86_64), SOLARIS, OPENBSD, SYMBIAN, HAIKU +// WINDOWS, SOLARIS, OPENBSD, SYMBIAN, HAIKU, WINCE // // FIXME: remove this! - this code unsafely guesses at stack sizes! -#if (OS(WINDOWS) && CPU(X86_64)) || OS(SOLARIS) || OS(OPENBSD) || OS(SYMBIAN) || OS(HAIKU) +#if OS(WINDOWS) || OS(SOLARIS) || OS(OPENBSD) || OS(SYMBIAN) || OS(HAIKU) // Based on the current limit used by the JSC parser, guess the stack size. static const ptrdiff_t estimatedStackSize = 128 * sizeof(void*) * 1024; // This method assumes the stack is growing downwards. @@ -247,37 +247,39 @@ void StackBounds::initialize() m_bound = isGrowingDownward ? lowerStackBound : upperStackBound; } -#elif OS(WINDOWS) && (CPU(X86) || CPU(X86_64)) +#elif OS(WINDOWS) void StackBounds::initialize() { -#if CPU(X86) - // Offset 0x18 from the FS segment register gives a pointer to - // the thread information block for the current thread. +#if CPU(X86) && COMPILER(MSVC) + // offset 0x18 from the FS segment register gives a pointer to + // the thread information block for the current thread NT_TIB* pTib; -#if COMPILER(MSVC) __asm { MOV EAX, FS:[18h] MOV pTib, EAX } -#else + m_origin = static_cast<void*>(pTib->StackBase); +#elif CPU(X86) && COMPILER(GCC) + // offset 0x18 from the FS segment register gives a pointer to + // the thread information block for the current thread + NT_TIB* pTib; asm ( "movl %%fs:0x18, %0\n" : "=r" (pTib) ); -#endif - // See http://en.wikipedia.org/wiki/Win32_Thread_Information_Block for more information! - void* pDeallocationStack = reinterpret_cast<char*>(pTib) + 0xE0C; m_origin = static_cast<void*>(pTib->StackBase); - m_bound = *static_cast<void**>(pDeallocationStack); #elif CPU(X86_64) PNT_TIB64 pTib = reinterpret_cast<PNT_TIB64>(NtCurrentTeb()); m_origin = reinterpret_cast<void*>(pTib->StackBase); - m_bound = estimateStackBound(m_origin); +#else +#error Need a way to get the stack bounds on this platform (Windows) #endif + // Looks like we should be able to get pTib->StackLimit + m_bound = estimateStackBound(m_origin); } #else -#error Need a way to get the stack bounds on this platform. +#error Need a way to get the stack bounds on this platform #endif } // namespace WTF diff --git a/Source/JavaScriptCore/wtf/text/AtomicString.cpp b/Source/JavaScriptCore/wtf/text/AtomicString.cpp index 93ad21d..dd8d66c 100644 --- a/Source/JavaScriptCore/wtf/text/AtomicString.cpp +++ b/Source/JavaScriptCore/wtf/text/AtomicString.cpp @@ -74,6 +74,16 @@ static inline HashSet<StringImpl*>& stringTable() return table->table(); } +template<typename T, typename HashTranslator> +static inline PassRefPtr<StringImpl> addToStringTable(const T& value) +{ + pair<HashSet<StringImpl*>::iterator, bool> addResult = stringTable().add<T, HashTranslator>(value); + + // If the string is newly-translated, then we need to adopt it. + // The boolean in the pair tells us if that is so. + return addResult.second ? adoptRef(*addResult.first) : *addResult.first; +} + struct CStringTranslator { static unsigned hash(const char* c) { @@ -115,11 +125,9 @@ PassRefPtr<StringImpl> AtomicString::add(const char* c) if (!c) return 0; if (!*c) - return StringImpl::empty(); - pair<HashSet<StringImpl*>::iterator, bool> addResult = stringTable().add<const char*, CStringTranslator>(c); - if (!addResult.second) - return *addResult.first; - return adoptRef(*addResult.first); + return StringImpl::empty(); + + return addToStringTable<const char*, CStringTranslator>(c); } struct UCharBuffer { @@ -265,12 +273,8 @@ PassRefPtr<StringImpl> AtomicString::add(const UChar* s, unsigned length) if (!length) return StringImpl::empty(); - UCharBuffer buf = { s, length }; - pair<HashSet<StringImpl*>::iterator, bool> addResult = stringTable().add<UCharBuffer, UCharBufferTranslator>(buf); - - // If the string is newly-translated, then we need to adopt it. - // The boolean in the pair tells us if that is so. - return addResult.second ? adoptRef(*addResult.first) : *addResult.first; + UCharBuffer buffer = { s, length }; + return addToStringTable<UCharBuffer, UCharBufferTranslator>(buffer); } PassRefPtr<StringImpl> AtomicString::add(const UChar* s, unsigned length, unsigned existingHash) @@ -280,12 +284,9 @@ PassRefPtr<StringImpl> AtomicString::add(const UChar* s, unsigned length, unsign if (!length) return StringImpl::empty(); - - HashAndCharacters buffer = { existingHash, s, length }; - pair<HashSet<StringImpl*>::iterator, bool> addResult = stringTable().add<HashAndCharacters, HashAndCharactersTranslator>(buffer); - if (!addResult.second) - return *addResult.first; - return adoptRef(*addResult.first); + + HashAndCharacters buffer = { existingHash, s, length }; + return addToStringTable<HashAndCharacters, HashAndCharactersTranslator>(buffer); } PassRefPtr<StringImpl> AtomicString::add(const UChar* s) @@ -300,12 +301,8 @@ PassRefPtr<StringImpl> AtomicString::add(const UChar* s) if (!length) return StringImpl::empty(); - UCharBuffer buf = {s, length}; - pair<HashSet<StringImpl*>::iterator, bool> addResult = stringTable().add<UCharBuffer, UCharBufferTranslator>(buf); - - // If the string is newly-translated, then we need to adopt it. - // The boolean in the pair tells us if that is so. - return addResult.second ? adoptRef(*addResult.first) : *addResult.first; + UCharBuffer buffer = { s, length }; + return addToStringTable<UCharBuffer, UCharBufferTranslator>(buffer); } PassRefPtr<StringImpl> AtomicString::addSlowCase(StringImpl* r) @@ -370,12 +367,8 @@ AtomicString AtomicString::fromUTF8(const char* characters, size_t length) if (!buffer.hash) return AtomicString(); - pair<HashSet<StringImpl*>::iterator, bool> addResult = stringTable().add<HashAndUTF8Characters, HashAndUTF8CharactersTranslator>(buffer); - - // If the string is newly-translated, then we need to adopt it. - // The boolean in the pair tells us if that is so. AtomicString atomicString; - atomicString.m_string = addResult.second ? adoptRef(*addResult.first) : *addResult.first; + atomicString.m_string = addToStringTable<HashAndUTF8Characters, HashAndUTF8CharactersTranslator>(buffer); return atomicString; } |
