diff options
Diffstat (limited to 'Source/JavaScriptCore/wtf')
33 files changed, 118 insertions, 86 deletions
diff --git a/Source/JavaScriptCore/wtf/CrossThreadRefCounted.h b/Source/JavaScriptCore/wtf/CrossThreadRefCounted.h index 0c0e997..8b65977 100644 --- a/Source/JavaScriptCore/wtf/CrossThreadRefCounted.h +++ b/Source/JavaScriptCore/wtf/CrossThreadRefCounted.h @@ -51,7 +51,8 @@ namespace WTF { // with respect to the original and any other copies. The underlying m_data is jointly // owned by the original instance and all copies. template<class T> - class CrossThreadRefCounted : public Noncopyable { + class CrossThreadRefCounted { + WTF_MAKE_NONCOPYABLE(CrossThreadRefCounted); public: static PassRefPtr<CrossThreadRefCounted<T> > create(T* data) { diff --git a/Source/JavaScriptCore/wtf/DateMath.h b/Source/JavaScriptCore/wtf/DateMath.h index 8d0d932..41bd4fa 100644 --- a/Source/JavaScriptCore/wtf/DateMath.h +++ b/Source/JavaScriptCore/wtf/DateMath.h @@ -44,6 +44,7 @@ #define DateMath_h #include <math.h> +#include <stdint.h> #include <string.h> #include <time.h> #include <wtf/CurrentTime.h> @@ -120,7 +121,9 @@ double parseDateFromNullTerminatedCharacters(ExecState*, const char* dateString) // Intentionally overridding the default tm of the system. // The members of tm differ on various operating systems. -struct GregorianDateTime : Noncopyable { +struct GregorianDateTime { + WTF_MAKE_NONCOPYABLE(GregorianDateTime); +public: GregorianDateTime() : second(0) , minute(0) diff --git a/Source/JavaScriptCore/wtf/Deque.h b/Source/JavaScriptCore/wtf/Deque.h index 745e0b6..1b16afc 100644 --- a/Source/JavaScriptCore/wtf/Deque.h +++ b/Source/JavaScriptCore/wtf/Deque.h @@ -44,7 +44,8 @@ namespace WTF { template<typename T> class DequeConstReverseIterator; template<typename T> - class Deque : public FastAllocBase { + class Deque { + WTF_MAKE_FAST_ALLOCATED; public: typedef DequeIterator<T> iterator; typedef DequeConstIterator<T> const_iterator; diff --git a/Source/JavaScriptCore/wtf/FastAllocBase.h b/Source/JavaScriptCore/wtf/FastAllocBase.h index bb1825e..e4899ab 100644 --- a/Source/JavaScriptCore/wtf/FastAllocBase.h +++ b/Source/JavaScriptCore/wtf/FastAllocBase.h @@ -32,8 +32,8 @@ // Provides customizable overrides of fastMalloc/fastFree and operator new/delete // // Provided functionality: +// Macro: WTF_MAKE_FAST_ALLOCATED // namespace WTF { -// class FastAllocBase; // // T* fastNew<T>(); // T* fastNew<T>(arg); @@ -48,7 +48,16 @@ // FastDelete assumes that the underlying // // Example usage: -// class Widget : public FastAllocBase { ... }; +// class Widget { +// WTF_MAKE_FAST_ALLOCATED +// ... +// }; +// +// struct Data { +// WTF_MAKE_FAST_ALLOCATED +// public: +// ... +// }; // // char* charPtr = fastNew<char>(); // fastDelete(charPtr); @@ -83,8 +92,6 @@ #include "FastMalloc.h" #include "TypeTraits.h" -namespace WTF { - #define WTF_MAKE_FAST_ALLOCATED \ public: \ void* operator new(size_t, void* p) { return p; } \ @@ -115,11 +122,10 @@ public: \ ::WTF::fastMallocMatchValidateFree(p, ::WTF::Internal::AllocTypeClassNewArray); \ ::WTF::fastFree(p); \ } \ -private: +private: \ +typedef int ThisIsHereToForceASemicolonAfterThisMacro -class FastAllocBase { - WTF_MAKE_FAST_ALLOCATED -}; +namespace WTF { // fastNew / fastDelete @@ -410,7 +416,6 @@ class FastAllocBase { } // namespace WTF -using WTF::FastAllocBase; using WTF::fastDeleteSkippingDestructor; #endif // FastAllocBase_h diff --git a/Source/JavaScriptCore/wtf/FastMalloc.cpp b/Source/JavaScriptCore/wtf/FastMalloc.cpp index 882f10d..ae93c02 100644 --- a/Source/JavaScriptCore/wtf/FastMalloc.cpp +++ b/Source/JavaScriptCore/wtf/FastMalloc.cpp @@ -453,6 +453,10 @@ extern "C" const int jscore_fastmalloc_introspection = 0; #if HAVE(PTHREAD_MACHDEP_H) #include <System/pthread_machdep.h> + +#if defined(__PTK_FRAMEWORK_JAVASCRIPTCORE_KEY0) +#define WTF_USE_PTHREAD_GETSPECIFIC_DIRECT 1 +#endif #endif #ifndef PRIuS @@ -463,9 +467,14 @@ 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) && !defined(__PTK_FRAMEWORK_JAVASCRIPTCORE_KEY0) +#if OS(DARWIN) +#if !USE(PTHREAD_GETSPECIFIC_DIRECT) static void* (*pthread_getspecific_function_pointer)(pthread_key_t) = pthread_getspecific; #define pthread_getspecific(key) pthread_getspecific_function_pointer(key) +#else +#define pthread_getspecific(key) _pthread_getspecific_direct(key) +#define pthread_setspecific(key, val) _pthread_setspecific_direct(key, (val)) +#endif #endif #define DEFINE_VARIABLE(type, name, value, meaning) \ @@ -2519,25 +2528,30 @@ static __thread TCMalloc_ThreadCache *threadlocal_heap; // Therefore, we use TSD keys only after tsd_inited is set to true. // Until then, we use a slow path to get the heap object. static bool tsd_inited = false; +#if USE(PTHREAD_GETSPECIFIC_DIRECT) +static const pthread_key_t heap_key = __PTK_FRAMEWORK_JAVASCRIPTCORE_KEY0; +#else static pthread_key_t heap_key; +#endif #if OS(WINDOWS) DWORD tlsIndex = TLS_OUT_OF_INDEXES; #endif static ALWAYS_INLINE void setThreadHeap(TCMalloc_ThreadCache* heap) { +#if USE(PTHREAD_GETSPECIFIC_DIRECT) + // Can't have two libraries both doing this in the same process, + // so check and make this crash right away. + if (pthread_getspecific(heap_key)) + CRASH(); +#endif + // 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 } @@ -3049,8 +3063,6 @@ 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 @@ -3078,7 +3090,11 @@ inline TCMalloc_ThreadCache* TCMalloc_ThreadCache::GetCacheIfPresent() { void TCMalloc_ThreadCache::InitTSD() { ASSERT(!tsd_inited); +#if USE(PTHREAD_GETSPECIFIC_DIRECT) + pthread_key_init_np(heap_key, DestroyThreadCache); +#else pthread_key_create(&heap_key, DestroyThreadCache); +#endif #if OS(WINDOWS) tlsIndex = TlsAlloc(); #endif diff --git a/Source/JavaScriptCore/wtf/HashCountedSet.h b/Source/JavaScriptCore/wtf/HashCountedSet.h index 4ed75c5..b97d8c8 100644 --- a/Source/JavaScriptCore/wtf/HashCountedSet.h +++ b/Source/JavaScriptCore/wtf/HashCountedSet.h @@ -22,14 +22,14 @@ #define WTF_HashCountedSet_h #include "Assertions.h" -#include "FastAllocBase.h" #include "HashMap.h" #include "Vector.h" namespace WTF { template<typename Value, typename HashFunctions = typename DefaultHash<Value>::Hash, - typename Traits = HashTraits<Value> > class HashCountedSet : public FastAllocBase { + typename Traits = HashTraits<Value> > class HashCountedSet { + WTF_MAKE_FAST_ALLOCATED; private: typedef HashMap<Value, unsigned, HashFunctions, Traits> ImplType; public: diff --git a/Source/JavaScriptCore/wtf/HashMap.h b/Source/JavaScriptCore/wtf/HashMap.h index 09094d1..7731546 100644 --- a/Source/JavaScriptCore/wtf/HashMap.h +++ b/Source/JavaScriptCore/wtf/HashMap.h @@ -29,7 +29,8 @@ namespace WTF { template<typename KeyArg, typename MappedArg, typename HashArg = typename DefaultHash<KeyArg>::Hash, typename KeyTraitsArg = HashTraits<KeyArg>, typename MappedTraitsArg = HashTraits<MappedArg> > - class HashMap : public FastAllocBase { + class HashMap { + WTF_MAKE_FAST_ALLOCATED; private: typedef KeyTraitsArg KeyTraits; typedef MappedTraitsArg MappedTraits; diff --git a/Source/JavaScriptCore/wtf/HashSet.h b/Source/JavaScriptCore/wtf/HashSet.h index 66639e4..be6b93d 100644 --- a/Source/JavaScriptCore/wtf/HashSet.h +++ b/Source/JavaScriptCore/wtf/HashSet.h @@ -35,7 +35,8 @@ namespace WTF { template<typename T> struct IdentityExtractor; template<typename ValueArg, typename HashArg = typename DefaultHash<ValueArg>::Hash, - typename TraitsArg = HashTraits<ValueArg> > class HashSet : public FastAllocBase { + typename TraitsArg = HashTraits<ValueArg> > class HashSet { + WTF_MAKE_FAST_ALLOCATED; private: typedef HashArg HashFunctions; typedef TraitsArg ValueTraits; diff --git a/Source/JavaScriptCore/wtf/ListHashSet.h b/Source/JavaScriptCore/wtf/ListHashSet.h index e14ac45..e916ef2 100644 --- a/Source/JavaScriptCore/wtf/ListHashSet.h +++ b/Source/JavaScriptCore/wtf/ListHashSet.h @@ -52,7 +52,8 @@ namespace WTF { template<typename ValueArg, size_t inlineCapacity> struct ListHashSetNodeAllocator; template<typename ValueArg, size_t inlineCapacity, typename HashArg> struct ListHashSetNodeHashFunctions; - template<typename ValueArg, size_t inlineCapacity = 256, typename HashArg = typename DefaultHash<ValueArg>::Hash> class ListHashSet : public FastAllocBase { + template<typename ValueArg, size_t inlineCapacity = 256, typename HashArg = typename DefaultHash<ValueArg>::Hash> class ListHashSet { + WTF_MAKE_FAST_ALLOCATED; private: typedef ListHashSetNode<ValueArg, inlineCapacity> Node; typedef ListHashSetNodeAllocator<ValueArg, inlineCapacity> NodeAllocator; diff --git a/Source/JavaScriptCore/wtf/Locker.h b/Source/JavaScriptCore/wtf/Locker.h index 41813d3..c465b99 100644 --- a/Source/JavaScriptCore/wtf/Locker.h +++ b/Source/JavaScriptCore/wtf/Locker.h @@ -32,7 +32,8 @@ namespace WTF { -template <typename T> class Locker : public Noncopyable { +template <typename T> class Locker { + WTF_MAKE_NONCOPYABLE(Locker); public: Locker(T& lockable) : m_lockable(lockable) { m_lockable.lock(); } ~Locker() { m_lockable.unlock(); } diff --git a/Source/JavaScriptCore/wtf/MessageQueue.h b/Source/JavaScriptCore/wtf/MessageQueue.h index 14100c9..7c18a0c 100644 --- a/Source/JavaScriptCore/wtf/MessageQueue.h +++ b/Source/JavaScriptCore/wtf/MessageQueue.h @@ -48,7 +48,8 @@ namespace WTF { // when messages are fetched from the queue. // Essentially, MessageQueue acts as a queue of OwnPtr<DataType>. template<typename DataType> - class MessageQueue : public Noncopyable { + class MessageQueue { + WTF_MAKE_NONCOPYABLE(MessageQueue); public: MessageQueue() : m_killed(false) { } ~MessageQueue(); diff --git a/Source/JavaScriptCore/wtf/Noncopyable.h b/Source/JavaScriptCore/wtf/Noncopyable.h index 285ed2e..cc6bc55 100644 --- a/Source/JavaScriptCore/wtf/Noncopyable.h +++ b/Source/JavaScriptCore/wtf/Noncopyable.h @@ -41,23 +41,4 @@ ClassName& operator=(const ClassName&) #endif -// We don't want argument-dependent lookup to pull in everything from the WTF -// namespace when you use Noncopyable, so put it in its own namespace. - -#include "FastAllocBase.h" - -namespace WTFNoncopyable { - - class Noncopyable : public FastAllocBase { - Noncopyable(const Noncopyable&); - Noncopyable& operator=(const Noncopyable&); - protected: - Noncopyable() { } - ~Noncopyable() { } - }; - -} // namespace WTFNoncopyable - -using WTFNoncopyable::Noncopyable; - #endif // WTF_Noncopyable_h diff --git a/Source/JavaScriptCore/wtf/OwnArrayPtr.h b/Source/JavaScriptCore/wtf/OwnArrayPtr.h index 643b90b..f838a7e 100644 --- a/Source/JavaScriptCore/wtf/OwnArrayPtr.h +++ b/Source/JavaScriptCore/wtf/OwnArrayPtr.h @@ -24,6 +24,7 @@ #include "Assertions.h" #include "Noncopyable.h" #include "NullPtr.h" +#include "OwnPtrCommon.h" #include "OwnArrayPtrCommon.h" #include <algorithm> @@ -35,7 +36,7 @@ namespace WTF { template<typename T> class PassOwnArrayPtr; template<typename T> PassOwnArrayPtr<T> adoptArrayPtr(T*); -template <typename T> class OwnArrayPtr : public Noncopyable { +template <typename T> class OwnArrayPtr { public: typedef T* PtrType; diff --git a/Source/JavaScriptCore/wtf/OwnFastMallocPtr.h b/Source/JavaScriptCore/wtf/OwnFastMallocPtr.h index 8b6cbf4..9d4841a 100644 --- a/Source/JavaScriptCore/wtf/OwnFastMallocPtr.h +++ b/Source/JavaScriptCore/wtf/OwnFastMallocPtr.h @@ -23,11 +23,11 @@ #define OwnFastMallocPtr_h #include "FastMalloc.h" -#include "Noncopyable.h" namespace WTF { - template<class T> class OwnFastMallocPtr : public Noncopyable { + template<class T> class OwnFastMallocPtr { + WTF_MAKE_NONCOPYABLE(OwnFastMallocPtr); public: explicit OwnFastMallocPtr(T* ptr) : m_ptr(ptr) { diff --git a/Source/JavaScriptCore/wtf/OwnPtr.h b/Source/JavaScriptCore/wtf/OwnPtr.h index cdc277c..fb59432 100644 --- a/Source/JavaScriptCore/wtf/OwnPtr.h +++ b/Source/JavaScriptCore/wtf/OwnPtr.h @@ -22,7 +22,6 @@ #define WTF_OwnPtr_h #include "Assertions.h" -#include "Noncopyable.h" #include "NullPtr.h" #include "OwnPtrCommon.h" #include "TypeTraits.h" @@ -39,7 +38,7 @@ namespace WTF { template<typename T> class PassOwnPtr; template<typename T> PassOwnPtr<T> adoptPtr(T*); - template<typename T> class OwnPtr : public Noncopyable { + template<typename T> class OwnPtr { public: typedef typename RemovePointer<T>::Type ValueType; typedef ValueType* PtrType; diff --git a/Source/JavaScriptCore/wtf/RefCounted.h b/Source/JavaScriptCore/wtf/RefCounted.h index 8d8b302..da178b2 100644 --- a/Source/JavaScriptCore/wtf/RefCounted.h +++ b/Source/JavaScriptCore/wtf/RefCounted.h @@ -22,6 +22,7 @@ #define RefCounted_h #include "Assertions.h" +#include "FastAllocBase.h" #include "Noncopyable.h" namespace WTF { @@ -131,7 +132,8 @@ inline void adopted(RefCountedBase* object) #endif -template<typename T> class RefCounted : public RefCountedBase, public Noncopyable { +template<typename T> class RefCounted : public RefCountedBase { + WTF_MAKE_NONCOPYABLE(RefCounted); WTF_MAKE_FAST_ALLOCATED; public: void deref() { @@ -140,6 +142,7 @@ public: } protected: + RefCounted() { } ~RefCounted() { } diff --git a/Source/JavaScriptCore/wtf/RefPtr.h b/Source/JavaScriptCore/wtf/RefPtr.h index d57f88a..353bd35 100644 --- a/Source/JavaScriptCore/wtf/RefPtr.h +++ b/Source/JavaScriptCore/wtf/RefPtr.h @@ -36,7 +36,8 @@ namespace WTF { enum HashTableDeletedValueType { HashTableDeletedValue }; - template<typename T> class RefPtr : public FastAllocBase { + template<typename T> class RefPtr { + WTF_MAKE_FAST_ALLOCATED; public: ALWAYS_INLINE RefPtr() : m_ptr(0) { } ALWAYS_INLINE RefPtr(T* ptr) : m_ptr(ptr) { refIfNotNull(ptr); } diff --git a/Source/JavaScriptCore/wtf/RefPtrHashMap.h b/Source/JavaScriptCore/wtf/RefPtrHashMap.h index b9e7eea..dbeabfa 100644 --- a/Source/JavaScriptCore/wtf/RefPtrHashMap.h +++ b/Source/JavaScriptCore/wtf/RefPtrHashMap.h @@ -45,7 +45,8 @@ namespace WTF { }; template<typename T, typename MappedArg, typename HashArg, typename KeyTraitsArg, typename MappedTraitsArg> - class HashMap<RefPtr<T>, MappedArg, HashArg, KeyTraitsArg, MappedTraitsArg> : public FastAllocBase { + class HashMap<RefPtr<T>, MappedArg, HashArg, KeyTraitsArg, MappedTraitsArg> { + WTF_MAKE_FAST_ALLOCATED; private: typedef KeyTraitsArg KeyTraits; typedef MappedTraitsArg MappedTraits; diff --git a/Source/JavaScriptCore/wtf/StackBounds.cpp b/Source/JavaScriptCore/wtf/StackBounds.cpp index be8ce84..41e0d60 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, QNX, UNIX +// DARWIN, QNX, UNIX, SYMBIAN // These platforms are not: -// WINDOWS, SOLARIS, OPENBSD, SYMBIAN, HAIKU, WINCE +// WINDOWS, SOLARIS, OPENBSD, HAIKU, WINCE // // FIXME: remove this! - this code unsafely guesses at stack sizes! -#if OS(WINDOWS) || OS(SOLARIS) || OS(OPENBSD) || OS(SYMBIAN) || OS(HAIKU) +#if OS(WINDOWS) || OS(SOLARIS) || OS(OPENBSD) || 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. @@ -139,7 +139,7 @@ void StackBounds::initialize() RThread thread; thread.StackInfo(info); m_origin = (void*)info.iBase; - m_bound = estimateStackBound(m_origin); + m_bound = (void*)info.iLimit; } #elif OS(HAIKU) diff --git a/Source/JavaScriptCore/wtf/ThreadIdentifierDataPthreads.h b/Source/JavaScriptCore/wtf/ThreadIdentifierDataPthreads.h index 3af87a8..ed1ba2c 100644 --- a/Source/JavaScriptCore/wtf/ThreadIdentifierDataPthreads.h +++ b/Source/JavaScriptCore/wtf/ThreadIdentifierDataPthreads.h @@ -31,14 +31,14 @@ #ifndef ThreadIdentifierDataPthreads_h #define ThreadIdentifierDataPthreads_h -#include <wtf/Noncopyable.h> #include <wtf/Threading.h> namespace WTF { // Holds ThreadIdentifier in the thread-specific storage and employs pthreads-specific 2-pass destruction to reliably remove // ThreadIdentifier from threadMap. It assumes regular ThreadSpecific types don't use multiple-pass destruction. -class ThreadIdentifierData : public Noncopyable { +class ThreadIdentifierData { + WTF_MAKE_NONCOPYABLE(ThreadIdentifierData); public: ~ThreadIdentifierData(); diff --git a/Source/JavaScriptCore/wtf/ThreadSafeShared.h b/Source/JavaScriptCore/wtf/ThreadSafeShared.h index 33c6612..a6a1cf2 100644 --- a/Source/JavaScriptCore/wtf/ThreadSafeShared.h +++ b/Source/JavaScriptCore/wtf/ThreadSafeShared.h @@ -62,12 +62,12 @@ #include "Platform.h" #include <wtf/Atomics.h> -#include <wtf/Noncopyable.h> #include <wtf/ThreadingPrimitives.h> namespace WTF { -class ThreadSafeSharedBase : public Noncopyable { +class ThreadSafeSharedBase { + WTF_MAKE_NONCOPYABLE(ThreadSafeSharedBase); WTF_MAKE_FAST_ALLOCATED; public: ThreadSafeSharedBase(int initialRefCount = 1) : m_refCount(initialRefCount) diff --git a/Source/JavaScriptCore/wtf/ThreadSpecific.h b/Source/JavaScriptCore/wtf/ThreadSpecific.h index 93ed466..fa9a393 100644 --- a/Source/JavaScriptCore/wtf/ThreadSpecific.h +++ b/Source/JavaScriptCore/wtf/ThreadSpecific.h @@ -61,7 +61,8 @@ namespace WTF { void ThreadSpecificThreadExit(); #endif -template<typename T> class ThreadSpecific : public Noncopyable { +template<typename T> class ThreadSpecific { + WTF_MAKE_NONCOPYABLE(ThreadSpecific); public: ThreadSpecific(); T* operator->(); @@ -84,7 +85,9 @@ private: void static destroy(void* ptr); #if USE(PTHREADS) || PLATFORM(QT) || PLATFORM(GTK) || OS(WINDOWS) - struct Data : Noncopyable { + struct Data { + WTF_MAKE_NONCOPYABLE(Data); + public: Data(T* value, ThreadSpecific<T>* owner) : value(value), owner(owner) {} #if PLATFORM(QT) ~Data() { owner->destroy(this); } diff --git a/Source/JavaScriptCore/wtf/ThreadSpecificWin.cpp b/Source/JavaScriptCore/wtf/ThreadSpecificWin.cpp index f2c0cad..d72996a 100644 --- a/Source/JavaScriptCore/wtf/ThreadSpecificWin.cpp +++ b/Source/JavaScriptCore/wtf/ThreadSpecificWin.cpp @@ -21,7 +21,6 @@ #include "config.h" #include "ThreadSpecific.h" -#include <wtf/Noncopyable.h> #if USE(PTHREADS) #error This file should not be compiled by ports that do not use Windows native ThreadSpecific implementation. diff --git a/Source/JavaScriptCore/wtf/Threading.cpp b/Source/JavaScriptCore/wtf/Threading.cpp index 49de59e..f2e0565 100644 --- a/Source/JavaScriptCore/wtf/Threading.cpp +++ b/Source/JavaScriptCore/wtf/Threading.cpp @@ -30,7 +30,9 @@ namespace WTF { -struct NewThreadContext : FastAllocBase { +struct NewThreadContext { + WTF_MAKE_FAST_ALLOCATED; +public: NewThreadContext(ThreadFunction entryPoint, void* data, const char* name) : entryPoint(entryPoint) , data(data) diff --git a/Source/JavaScriptCore/wtf/ThreadingPrimitives.h b/Source/JavaScriptCore/wtf/ThreadingPrimitives.h index c11a6cb..809c3e2 100644 --- a/Source/JavaScriptCore/wtf/ThreadingPrimitives.h +++ b/Source/JavaScriptCore/wtf/ThreadingPrimitives.h @@ -34,6 +34,7 @@ #include "Platform.h" #include <wtf/Assertions.h> +#include <wtf/FastAllocBase.h> #include <wtf/Locker.h> #include <wtf/Noncopyable.h> @@ -96,7 +97,8 @@ typedef void* PlatformReadWriteLock; typedef void* PlatformCondition; #endif -class Mutex : public Noncopyable { +class Mutex { + WTF_MAKE_NONCOPYABLE(Mutex); WTF_MAKE_FAST_ALLOCATED; public: Mutex(); ~Mutex(); @@ -113,7 +115,8 @@ private: typedef Locker<Mutex> MutexLocker; -class ReadWriteLock : public Noncopyable { +class ReadWriteLock { + WTF_MAKE_NONCOPYABLE(ReadWriteLock); public: ReadWriteLock(); ~ReadWriteLock(); @@ -130,7 +133,8 @@ private: PlatformReadWriteLock m_readWriteLock; }; -class ThreadCondition : public Noncopyable { +class ThreadCondition { + WTF_MAKE_NONCOPYABLE(ThreadCondition); public: ThreadCondition(); ~ThreadCondition(); diff --git a/Source/JavaScriptCore/wtf/Vector.h b/Source/JavaScriptCore/wtf/Vector.h index f73793f..6d8dd4c 100644 --- a/Source/JavaScriptCore/wtf/Vector.h +++ b/Source/JavaScriptCore/wtf/Vector.h @@ -277,7 +277,8 @@ namespace WTF { }; template<typename T> - class VectorBufferBase : public Noncopyable { + class VectorBufferBase { + WTF_MAKE_NONCOPYABLE(VectorBufferBase); public: void allocateBuffer(size_t newCapacity) { @@ -488,7 +489,8 @@ namespace WTF { }; template<typename T, size_t inlineCapacity = 0> - class Vector : public FastAllocBase { + class Vector { + WTF_MAKE_FAST_ALLOCATED; private: typedef VectorBuffer<T, inlineCapacity> Buffer; typedef VectorTypeOperations<T> TypeOperations; diff --git a/Source/JavaScriptCore/wtf/WTFThreadData.h b/Source/JavaScriptCore/wtf/WTFThreadData.h index 52c267a..243aa91 100644 --- a/Source/JavaScriptCore/wtf/WTFThreadData.h +++ b/Source/JavaScriptCore/wtf/WTFThreadData.h @@ -52,7 +52,8 @@ namespace JSC { typedef HashMap<const char*, RefPtr<StringImpl>, PtrHash<const char*> > LiteralIdentifierTable; -class IdentifierTable : public FastAllocBase { +class IdentifierTable { + WTF_MAKE_FAST_ALLOCATED; public: ~IdentifierTable(); @@ -85,7 +86,8 @@ class AtomicStringTable; typedef void (*AtomicStringTableDestructor)(AtomicStringTable*); -class WTFThreadData : public Noncopyable { +class WTFThreadData { + WTF_MAKE_NONCOPYABLE(WTFThreadData); public: WTFThreadData(); ~WTFThreadData(); diff --git a/Source/JavaScriptCore/wtf/dtoa.cpp b/Source/JavaScriptCore/wtf/dtoa.cpp index c89c036..b5b1261 100644 --- a/Source/JavaScriptCore/wtf/dtoa.cpp +++ b/Source/JavaScriptCore/wtf/dtoa.cpp @@ -414,7 +414,10 @@ static void mult(BigInt& aRef, const BigInt& bRef) aRef = c; } -struct P5Node : Noncopyable { +struct P5Node { + WTF_MAKE_NONCOPYABLE(P5Node); WTF_MAKE_FAST_ALLOCATED; +public: + P5Node() { } BigInt val; P5Node* next; }; diff --git a/Source/JavaScriptCore/wtf/gobject/GOwnPtr.h b/Source/JavaScriptCore/wtf/gobject/GOwnPtr.h index cec3e43..4136f28 100644 --- a/Source/JavaScriptCore/wtf/gobject/GOwnPtr.h +++ b/Source/JavaScriptCore/wtf/gobject/GOwnPtr.h @@ -41,7 +41,8 @@ template<> void freeOwnedGPtr<GPatternSpec>(GPatternSpec*); template<> void freeOwnedGPtr<GDir>(GDir*); template<> void freeOwnedGPtr<GFile>(GFile*); -template <typename T> class GOwnPtr : public Noncopyable { +template <typename T> class GOwnPtr { + WTF_MAKE_NONCOPYABLE(GOwnPtr); public: explicit GOwnPtr(T* ptr = 0) : m_ptr(ptr) { } ~GOwnPtr() { freeOwnedGPtr(m_ptr); } diff --git a/Source/JavaScriptCore/wtf/text/StringBuffer.h b/Source/JavaScriptCore/wtf/text/StringBuffer.h index a546bf3..e73d38e 100644 --- a/Source/JavaScriptCore/wtf/text/StringBuffer.h +++ b/Source/JavaScriptCore/wtf/text/StringBuffer.h @@ -30,13 +30,13 @@ #define StringBuffer_h #include <wtf/Assertions.h> -#include <wtf/Noncopyable.h> #include <wtf/unicode/Unicode.h> #include <limits> namespace WTF { -class StringBuffer : public Noncopyable { +class StringBuffer { + WTF_MAKE_NONCOPYABLE(StringBuffer); public: explicit StringBuffer(unsigned length) : m_length(length) diff --git a/Source/JavaScriptCore/wtf/text/StringImplBase.h b/Source/JavaScriptCore/wtf/text/StringImplBase.h index 6567672..26bc1d9 100644 --- a/Source/JavaScriptCore/wtf/text/StringImplBase.h +++ b/Source/JavaScriptCore/wtf/text/StringImplBase.h @@ -26,12 +26,12 @@ #ifndef StringImplBase_h #define StringImplBase_h -#include <wtf/Noncopyable.h> #include <wtf/unicode/Unicode.h> namespace WTF { -class StringImplBase : public Noncopyable { +class StringImplBase { + WTF_MAKE_NONCOPYABLE(StringImplBase); WTF_MAKE_FAST_ALLOCATED; public: bool isStringImpl() { return (m_refCountAndFlags & s_refCountInvalidForStringImpl) != s_refCountInvalidForStringImpl; } unsigned length() const { return m_length; } @@ -45,9 +45,6 @@ protected: BufferShared, }; - using Noncopyable::operator new; - void* operator new(size_t, void* inPlace) { ASSERT(inPlace); return inPlace; } - // For SmallStringStorage, which allocates an array and uses an in-place new. StringImplBase() { } diff --git a/Source/JavaScriptCore/wtf/text/WTFString.cpp b/Source/JavaScriptCore/wtf/text/WTFString.cpp index 6bb74f6..4b6ff75 100644 --- a/Source/JavaScriptCore/wtf/text/WTFString.cpp +++ b/Source/JavaScriptCore/wtf/text/WTFString.cpp @@ -612,7 +612,7 @@ void String::split(const String& separator, bool allowEmptyEntries, Vector<Strin void String::split(const String& separator, Vector<String>& result) const { - return split(separator, false, result); + split(separator, false, result); } void String::split(UChar separator, bool allowEmptyEntries, Vector<String>& result) const @@ -632,7 +632,7 @@ void String::split(UChar separator, bool allowEmptyEntries, Vector<String>& resu void String::split(UChar separator, Vector<String>& result) const { - return split(String(&separator, 1), false, result); + split(String(&separator, 1), false, result); } CString String::ascii() const diff --git a/Source/JavaScriptCore/wtf/unicode/Collator.h b/Source/JavaScriptCore/wtf/unicode/Collator.h index fe6a809..00ab16e 100644 --- a/Source/JavaScriptCore/wtf/unicode/Collator.h +++ b/Source/JavaScriptCore/wtf/unicode/Collator.h @@ -29,6 +29,7 @@ #ifndef WTF_Collator_h #define WTF_Collator_h +#include <wtf/FastAllocBase.h> #include <wtf/Noncopyable.h> #include <wtf/PassOwnPtr.h> #include <wtf/unicode/Unicode.h> @@ -39,7 +40,8 @@ struct UCollator; namespace WTF { - class Collator : public Noncopyable { + class Collator { + WTF_MAKE_NONCOPYABLE(Collator); WTF_MAKE_FAST_ALLOCATED; public: enum Result { Equal = 0, Greater = 1, Less = -1 }; |