| Index: Source/wtf/FastMalloc.cpp
|
| diff --git a/Source/wtf/FastMalloc.cpp b/Source/wtf/FastMalloc.cpp
|
| index 95d15650e5505c6f99e56dcb9acf3f0af8d3d17a..7347c08df826263fef7a8e08ff02ced3a5aa6071 100644
|
| --- a/Source/wtf/FastMalloc.cpp
|
| +++ b/Source/wtf/FastMalloc.cpp
|
| @@ -87,7 +87,7 @@
|
| #endif
|
|
|
| #include <limits>
|
| -#if OS(WINDOWS)
|
| +#if OS(WIN)
|
| #include <windows.h>
|
| #else
|
| #include <pthread.h>
|
| @@ -116,7 +116,7 @@
|
| #ifndef NDEBUG
|
| namespace WTF {
|
|
|
| -#if OS(WINDOWS)
|
| +#if OS(WIN)
|
|
|
| // TLS_OUT_OF_INDEXES is not defined on WinCE.
|
| #ifndef TLS_OUT_OF_INDEXES
|
| @@ -151,7 +151,7 @@ void fastMallocAllow()
|
| TlsSetValue(isForibiddenTlsIndex, kTlsAllowValue);
|
| }
|
|
|
| -#else // !OS(WINDOWS)
|
| +#else // !OS(WIN)
|
|
|
| static pthread_key_t isForbiddenKey;
|
| static pthread_once_t isForbiddenKeyOnce = PTHREAD_ONCE_INIT;
|
| @@ -179,7 +179,7 @@ void fastMallocAllow()
|
| pthread_once(&isForbiddenKeyOnce, initializeIsForbiddenKey);
|
| pthread_setspecific(isForbiddenKey, 0);
|
| }
|
| -#endif // OS(WINDOWS)
|
| +#endif // OS(WIN)
|
|
|
| } // namespace WTF
|
| #endif // NDEBUG
|
| @@ -207,7 +207,7 @@ char* fastStrDup(const char* src)
|
|
|
| #if OS(MACOSX)
|
| #include <malloc/malloc.h>
|
| -#elif OS(WINDOWS)
|
| +#elif OS(WIN)
|
| #include <malloc.h>
|
| #endif
|
|
|
| @@ -290,7 +290,7 @@ extern "C" const int jscore_fastmalloc_introspection = 0;
|
| #if OS(UNIX)
|
| #include <unistd.h>
|
| #endif
|
| -#if OS(WINDOWS)
|
| +#if OS(WIN)
|
| #ifndef WIN32_LEAN_AND_MEAN
|
| #define WIN32_LEAN_AND_MEAN
|
| #endif
|
| @@ -1600,7 +1600,7 @@ class TCMalloc_PageHeap {
|
| void scavenge();
|
| ALWAYS_INLINE bool shouldScavenge() const;
|
|
|
| -#if HAVE(DISPATCH_H) || OS(WINDOWS)
|
| +#if HAVE(DISPATCH_H) || OS(WIN)
|
| void periodicScavenge();
|
| ALWAYS_INLINE bool isScavengerSuspended();
|
| ALWAYS_INLINE void scheduleScavenger();
|
| @@ -1612,7 +1612,7 @@ class TCMalloc_PageHeap {
|
| dispatch_queue_t m_scavengeQueue;
|
| dispatch_source_t m_scavengeTimer;
|
| bool m_scavengingSuspended;
|
| -#elif OS(WINDOWS)
|
| +#elif OS(WIN)
|
| static void CALLBACK scavengerTimerFired(void*, BOOLEAN);
|
| HANDLE m_scavengeQueueTimer;
|
| #else
|
| @@ -1699,7 +1699,7 @@ ALWAYS_INLINE void TCMalloc_PageHeap::suspendScavenger()
|
| dispatch_suspend(m_scavengeTimer);
|
| }
|
|
|
| -#elif OS(WINDOWS)
|
| +#elif OS(WIN)
|
|
|
| void TCMalloc_PageHeap::scavengerTimerFired(void* context, BOOLEAN)
|
| {
|
| @@ -2370,7 +2370,7 @@ class TCMalloc_ThreadCache_FreeList {
|
| class TCMalloc_ThreadCache {
|
| private:
|
| typedef TCMalloc_ThreadCache_FreeList FreeList;
|
| -#if OS(WINDOWS)
|
| +#if OS(WIN)
|
| typedef DWORD ThreadIdentifier;
|
| #else
|
| typedef pthread_t ThreadIdentifier;
|
| @@ -2475,7 +2475,7 @@ size_t fastMallocGoodSize(size_t bytes)
|
|
|
| #if USE_BACKGROUND_THREAD_TO_SCAVENGE_MEMORY
|
|
|
| -#if HAVE(DISPATCH_H) || OS(WINDOWS)
|
| +#if HAVE(DISPATCH_H) || OS(WIN)
|
|
|
| void TCMalloc_PageHeap::periodicScavenge()
|
| {
|
| @@ -2557,7 +2557,7 @@ static __thread TCMalloc_ThreadCache *threadlocal_heap;
|
| // Until then, we use a slow path to get the heap object.
|
| static bool tsd_inited = false;
|
| static pthread_key_t heap_key;
|
| -#if OS(WINDOWS)
|
| +#if OS(WIN)
|
| DWORD tlsIndex = TLS_OUT_OF_INDEXES;
|
| #endif
|
|
|
| @@ -2574,7 +2574,7 @@ static ALWAYS_INLINE void setThreadHeap(TCMalloc_ThreadCache* heap)
|
| // of thread-local storage in use, to benefit from the delete callback.
|
| pthread_setspecific(heap_key, heap);
|
|
|
| -#if OS(WINDOWS)
|
| +#if OS(WIN)
|
| TlsSetValue(tlsIndex, heap);
|
| #endif
|
| }
|
| @@ -2832,7 +2832,7 @@ ALWAYS_INLINE void TCMalloc_Central_FreeList::Populate() {
|
| if (span) pageheap->RegisterSizeClass(span, size_class_);
|
| }
|
| if (span == NULL) {
|
| -#if OS(WINDOWS)
|
| +#if OS(WIN)
|
| MESSAGE("allocation failed: %d\n", ::GetLastError());
|
| #else
|
| MESSAGE("allocation failed: %d\n", errno);
|
| @@ -3117,7 +3117,7 @@ inline TCMalloc_ThreadCache* TCMalloc_ThreadCache::GetThreadHeap() {
|
| // __thread is faster, but only when the kernel supports it
|
| if (KernelSupportsTLS())
|
| return threadlocal_heap;
|
| -#elif OS(WINDOWS)
|
| +#elif OS(WIN)
|
| return static_cast<TCMalloc_ThreadCache*>(TlsGetValue(tlsIndex));
|
| #else
|
| return static_cast<TCMalloc_ThreadCache*>(pthread_getspecific(heap_key));
|
| @@ -3151,19 +3151,19 @@ void TCMalloc_ThreadCache::InitTSD() {
|
| #else
|
| pthread_key_create(&heap_key, DestroyThreadCache);
|
| #endif
|
| -#if OS(WINDOWS)
|
| +#if OS(WIN)
|
| tlsIndex = TlsAlloc();
|
| #endif
|
| tsd_inited = true;
|
|
|
| -#if !OS(WINDOWS)
|
| +#if !OS(WIN)
|
| // We may have used a fake pthread_t for the main thread. Fix it.
|
| pthread_t zero;
|
| memset(&zero, 0, sizeof(zero));
|
| #endif
|
| ASSERT(pageheap_lock.IsHeld());
|
| for (TCMalloc_ThreadCache* h = thread_heaps; h != NULL; h = h->next_) {
|
| -#if OS(WINDOWS)
|
| +#if OS(WIN)
|
| if (h->tid_ == 0) {
|
| h->tid_ = GetCurrentThreadId();
|
| }
|
| @@ -3181,7 +3181,7 @@ TCMalloc_ThreadCache* TCMalloc_ThreadCache::CreateCacheIfNecessary() {
|
| {
|
| SpinLockHolder h(&pageheap_lock);
|
|
|
| -#if OS(WINDOWS)
|
| +#if OS(WIN)
|
| DWORD me;
|
| if (!tsd_inited) {
|
| me = 0;
|
| @@ -3202,7 +3202,7 @@ TCMalloc_ThreadCache* TCMalloc_ThreadCache::CreateCacheIfNecessary() {
|
| // In that case, the heap for this thread has already been created
|
| // and added to the linked list. So we search for that first.
|
| for (TCMalloc_ThreadCache* h = thread_heaps; h != NULL; h = h->next_) {
|
| -#if OS(WINDOWS)
|
| +#if OS(WIN)
|
| if (h->tid_ == me) {
|
| #else
|
| if (pthread_equal(h->tid_, me)) {
|
|
|