Removed ENABLE_WTF_MULTIPLE_THREADS and related #ifdefs
authorggaren@apple.com <ggaren@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 20 Sep 2011 03:55:29 +0000 (03:55 +0000)
committerggaren@apple.com <ggaren@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 20 Sep 2011 03:55:29 +0000 (03:55 +0000)
https://bugs.webkit.org/show_bug.cgi?id=68423

As discussed on webkit-dev. All ports build with threads enabled in WTF now.

This may break WinCE and other ports that have not built and tested with
this configuration. I've filed bugs for port maintainers. It's time for
WebKit to move forward.

Reviewed by Mark Rowe.

* wtf/CryptographicallyRandomNumber.cpp:
(WTF::ARC4Stream::ARC4RandomNumberGenerator::randomNumber):
(WTF::ARC4Stream::ARC4RandomNumberGenerator::randomValues):
* wtf/FastMalloc.cpp:
* wtf/Platform.h:
* wtf/RandomNumber.cpp:
(WTF::randomNumber):
* wtf/RefCountedLeakCounter.cpp:
(WTF::RefCountedLeakCounter::increment):
(WTF::RefCountedLeakCounter::decrement):
* wtf/ThreadingPthreads.cpp:
(WTF::initializeThreading):
* wtf/ThreadingWin.cpp:
(WTF::initializeThreading):
* wtf/dtoa.cpp:
(WTF::pow5mult):
* wtf/gtk/ThreadingGtk.cpp:
(WTF::initializeThreading):
* wtf/qt/ThreadingQt.cpp:
(WTF::initializeThreading):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@95511 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/JavaScriptCore/ChangeLog
Source/JavaScriptCore/wtf/CryptographicallyRandomNumber.cpp
Source/JavaScriptCore/wtf/FastMalloc.cpp
Source/JavaScriptCore/wtf/Platform.h
Source/JavaScriptCore/wtf/RandomNumber.cpp
Source/JavaScriptCore/wtf/RefCountedLeakCounter.cpp
Source/JavaScriptCore/wtf/ThreadingPthreads.cpp
Source/JavaScriptCore/wtf/ThreadingWin.cpp
Source/JavaScriptCore/wtf/dtoa.cpp
Source/JavaScriptCore/wtf/gtk/ThreadingGtk.cpp
Source/JavaScriptCore/wtf/qt/ThreadingQt.cpp

index 233aaf3..cd385b8 100644 (file)
@@ -1,5 +1,39 @@
 2011-09-19  Geoffrey Garen  <ggaren@apple.com>
 
+        Removed ENABLE_WTF_MULTIPLE_THREADS and related #ifdefs
+        https://bugs.webkit.org/show_bug.cgi?id=68423
+
+        As discussed on webkit-dev. All ports build with threads enabled in WTF now.
+        
+        This may break WinCE and other ports that have not built and tested with
+        this configuration. I've filed bugs for port maintainers. It's time for
+        WebKit to move forward.
+
+        Reviewed by Mark Rowe.
+
+        * wtf/CryptographicallyRandomNumber.cpp:
+        (WTF::ARC4Stream::ARC4RandomNumberGenerator::randomNumber):
+        (WTF::ARC4Stream::ARC4RandomNumberGenerator::randomValues):
+        * wtf/FastMalloc.cpp:
+        * wtf/Platform.h:
+        * wtf/RandomNumber.cpp:
+        (WTF::randomNumber):
+        * wtf/RefCountedLeakCounter.cpp:
+        (WTF::RefCountedLeakCounter::increment):
+        (WTF::RefCountedLeakCounter::decrement):
+        * wtf/ThreadingPthreads.cpp:
+        (WTF::initializeThreading):
+        * wtf/ThreadingWin.cpp:
+        (WTF::initializeThreading):
+        * wtf/dtoa.cpp:
+        (WTF::pow5mult):
+        * wtf/gtk/ThreadingGtk.cpp:
+        (WTF::initializeThreading):
+        * wtf/qt/ThreadingQt.cpp:
+        (WTF::initializeThreading):
+
+2011-09-19  Geoffrey Garen  <ggaren@apple.com>
+
         Removed ENABLE_JSC_MULTIPLE_THREADS and related #ifdefs.
         https://bugs.webkit.org/show_bug.cgi?id=68422
         
index 0232a04..8c16f53 100644 (file)
@@ -65,9 +65,7 @@ private:
 
     ARC4Stream m_stream;
     int m_count;
-#if ENABLE(WTF_MULTIPLE_THREADS)
     Mutex m_mutex;
-#endif
 };
 
 ARC4Stream::ARC4Stream()
@@ -139,9 +137,7 @@ uint32_t ARC4RandomNumberGenerator::getWord()
 
 uint32_t ARC4RandomNumberGenerator::randomNumber()
 {
-#if ENABLE(WTF_MULTIPLE_THREADS)
     MutexLocker locker(m_mutex);
-#endif
 
     m_count -= 4;
     stirIfNeeded();
@@ -150,9 +146,7 @@ uint32_t ARC4RandomNumberGenerator::randomNumber()
 
 void ARC4RandomNumberGenerator::randomValues(void* buffer, size_t length)
 {
-#if ENABLE(WTF_MULTIPLE_THREADS)
     MutexLocker locker(m_mutex);
-#endif
 
     unsigned char* result = reinterpret_cast<unsigned char*>(buffer);
     stirIfNeeded();
index fc78ba8..8f39c0a 100644 (file)
 
 #include "Assertions.h"
 #include <limits>
-#if ENABLE(WTF_MULTIPLE_THREADS)
 #if OS(WINDOWS) && PLATFORM(CHROMIUM) || OS(WINCE) && PLATFORM(WIN)
 #include <windows.h>
 #else
 #include <pthread.h>
 #endif // OS(WINDOWS) && PLATFORM(CHROMIUM) || OS(WINCE) && PLATFORM(WIN)
-#endif
 #include <wtf/StdLibExtras.h>
+#include <string.h>
 
 #ifndef NO_TCMALLOC_SAMPLES
 #ifdef WTF_CHANGES
 #ifndef NDEBUG
 namespace WTF {
 
-#if ENABLE(WTF_MULTIPLE_THREADS)
 #if OS(WINDOWS) && PLATFORM(CHROMIUM) || OS(WINCE) && PLATFORM(WIN)
 
 // TLS_OUT_OF_INDEXES is not defined on WinCE.
@@ -171,30 +169,10 @@ void fastMallocAllow()
     pthread_setspecific(isForbiddenKey, 0);
 }
 #endif // OS(WINDOWS) && PLATFORM(CHROMIUM) || OS(WINCE) && PLATFORM(WIN)
-#else
-
-static bool staticIsForbidden;
-static bool isForbidden()
-{
-    return staticIsForbidden;
-}
-
-void fastMallocForbid()
-{
-    staticIsForbidden = true;
-}
-
-void fastMallocAllow()
-{
-    staticIsForbidden = false;
-}
-#endif // ENABLE(WTF_MULTIPLE_THREADS)
 
 } // namespace WTF
 #endif // NDEBUG
 
-#include <string.h>
-
 namespace WTF {
 
 
index fec1164..dda5885 100644 (file)
 #define WTF_USE_PTHREAD_BASED_QT 1
 #endif
 
-#if !defined(ENABLE_WTF_MULTIPLE_THREADS)
-#define ENABLE_WTF_MULTIPLE_THREADS 1
-#endif
-
 /* On Windows, use QueryPerformanceCounter by default */
 #if OS(WINDOWS)
 #define WTF_USE_QUERY_PERFORMANCE_COUNTER  1
index 490c591..0e4ee53 100644 (file)
@@ -61,14 +61,6 @@ double randomNumber()
     // that might not be cryptographically secure. Ideally, most ports would
     // define USE(OS_RANDOMNESS).
 
-#if !ENABLE(WTF_MULTIPLE_THREADS)
-    static bool s_initialized = false;
-    if (!s_initialized) {
-        initializeRandomNumberGenerator();
-        s_initialized = true;
-    }
-#endif
-
 #if USE(MERSENNE_TWISTER_19937)
     return genrand_res53();
 #elif PLATFORM(BREWMP)
index 08b32ab..670f2a0 100644 (file)
@@ -79,20 +79,12 @@ RefCountedLeakCounter::~RefCountedLeakCounter()
 
 void RefCountedLeakCounter::increment()
 {
-#if ENABLE(WTF_MULTIPLE_THREADS)
     atomicIncrement(&m_count);
-#else
-    ++m_count;
-#endif
 }
 
 void RefCountedLeakCounter::decrement()
 {
-#if ENABLE(WTF_MULTIPLE_THREADS)
     atomicDecrement(&m_count);
-#else
-    --m_count;
-#endif
 }
 
 #endif
index 82b04b5..6c2e32a 100644 (file)
@@ -83,10 +83,8 @@ void initializeThreading()
     initializeRandomNumberGenerator();
     ThreadIdentifierData::initializeOnce();
     wtfThreadData();
-#if ENABLE(WTF_MULTIPLE_THREADS)
     s_dtoaP5Mutex = new Mutex;
     initializeDates();
-#endif
 }
 
 void lockAtomicallyInitializedStaticMutex()
index 1825627..f59b123 100644 (file)
@@ -172,11 +172,8 @@ void initializeThreading()
     threadMapMutex();
     initializeRandomNumberGenerator();
     wtfThreadData();
-#if ENABLE(WTF_MULTIPLE_THREADS)
     s_dtoaP5Mutex = new Mutex;
     initializeDates();
-#endif
-
 }
 
 static HashMap<DWORD, HANDLE>& threadMap()
index 97d57f3..1130322 100644 (file)
@@ -90,9 +90,7 @@
 
 namespace WTF {
 
-#if ENABLE(WTF_MULTIPLE_THREADS)
 Mutex* s_dtoaP5Mutex;
-#endif
 
 typedef union {
     double d;
@@ -435,9 +433,7 @@ static ALWAYS_INLINE void pow5mult(BigInt& b, int k)
     if (!(k >>= 2))
         return;
 
-#if ENABLE(WTF_MULTIPLE_THREADS)
     s_dtoaP5Mutex->lock();
-#endif
     P5Node* p5 = p5s;
 
     if (!p5) {
@@ -450,9 +446,7 @@ static ALWAYS_INLINE void pow5mult(BigInt& b, int k)
     }
 
     int p5sCountLocal = p5sCount;
-#if ENABLE(WTF_MULTIPLE_THREADS)
     s_dtoaP5Mutex->unlock();
-#endif
     int p5sUsed = 0;
 
     for (;;) {
@@ -463,9 +457,7 @@ static ALWAYS_INLINE void pow5mult(BigInt& b, int k)
             break;
 
         if (++p5sUsed == p5sCountLocal) {
-#if ENABLE(WTF_MULTIPLE_THREADS)
             s_dtoaP5Mutex->lock();
-#endif
             if (p5sUsed == p5sCount) {
                 ASSERT(!p5->next);
                 p5->next = new P5Node;
@@ -476,9 +468,7 @@ static ALWAYS_INLINE void pow5mult(BigInt& b, int k)
             }
 
             p5sCountLocal = p5sCount;
-#if ENABLE(WTF_MULTIPLE_THREADS)
             s_dtoaP5Mutex->unlock();
-#endif
         }
         p5 = p5->next;
     }
index afa1f07..1f243ee 100644 (file)
@@ -70,10 +70,8 @@ void initializeThreading()
         threadMapMutex();
         initializeRandomNumberGenerator();
         wtfThreadData();
-#if ENABLE(WTF_MULTIPLE_THREADS)
         s_dtoaP5Mutex = new Mutex;
         initializeDates();
-#endif
     }
 }
 
index 182c54b..4631b7c 100644 (file)
@@ -149,11 +149,8 @@ void initializeThreading()
         threadMapMutex();
         initializeRandomNumberGenerator();
         wtfThreadData();
-#if ENABLE(WTF_MULTIPLE_THREADS)
         s_dtoaP5Mutex = new Mutex;
         initializeDates();
-#endif
-
     }
 }