Changeset 162777 in webkit
- Timestamp:
- Jan 25, 2014 1:16:42 PM (10 years ago)
- Location:
- trunk/Source
- Files:
-
- 19 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/ChangeLog
r162767 r162777 1 2014-01-25 Anders Carlsson <andersca@apple.com> 2 3 Remove atomicIncrement/atomicDecrement 4 https://bugs.webkit.org/show_bug.cgi?id=127625 5 6 Reviewed by Andreas Kling. 7 8 Replace atomicIncrement/atomicDecrement with std::atomic. 9 10 * bytecode/Watchpoint.h: 11 * ftl/FTLLowerDFGToLLVM.cpp: 12 (JSC::FTL::LowerDFGToLLVM::lower): 13 * profiler/ProfilerDatabase.cpp: 14 (JSC::Profiler::Database::Database): 15 (JSC::Profiler::Database::addDatabaseToAtExit): 16 1 17 2014-01-24 Joseph Pecoraro <pecoraro@apple.com> 2 18 -
trunk/Source/JavaScriptCore/bytecode/Watchpoint.h
r161554 r162777 27 27 #define Watchpoint_h 28 28 29 #include <wtf/Atomics.h> 29 30 #include <wtf/SentinelLinkedList.h> 30 31 #include <wtf/ThreadSafeRefCounted.h> -
trunk/Source/JavaScriptCore/ftl/FTLLowerDFGToLLVM.cpp
r161399 r162777 43 43 #include "Operations.h" 44 44 #include "VirtualRegister.h" 45 45 #include <atomic> 46 46 #include <wtf/ProcessID.h> 47 47 … … 50 50 using namespace DFG; 51 51 52 static intcompileCounter;52 static std::atomic<int> compileCounter; 53 53 54 54 // Using this instead of typeCheck() helps to reduce the load on LLVM, by creating … … 82 82 if (verboseCompilationEnabled()) { 83 83 name = toCString( 84 "jsBody_", atomicIncrement(&compileCounter), "_", codeBlock()->inferredName(),84 "jsBody_", ++compileCounter, "_", codeBlock()->inferredName(), 85 85 "_", codeBlock()->hash()); 86 86 } else -
trunk/Source/JavaScriptCore/profiler/ProfilerDatabase.cpp
r156968 r162777 34 34 namespace JSC { namespace Profiler { 35 35 36 #if COMPILER(MINGW) || COMPILER(MSVC7_OR_LOWER) || OS(WINCE) 37 static int databaseCounter; 38 #else 39 static volatile int databaseCounter; 40 #endif 36 static std::atomic<int> databaseCounter; 37 41 38 static SpinLock registrationLock = SPINLOCK_INITIALIZER; 42 static intdidRegisterAtExit;39 static std::atomic<int> didRegisterAtExit; 43 40 static Database* firstDatabase; 44 41 45 42 Database::Database(VM& vm) 46 : m_databaseID( atomicIncrement(&databaseCounter))43 : m_databaseID(++databaseCounter) 47 44 , m_vm(vm) 48 45 , m_shouldSaveAtExit(false) … … 139 136 void Database::addDatabaseToAtExit() 140 137 { 141 if ( atomicIncrement(&didRegisterAtExit)== 1)138 if (++didRegisterAtExit == 1) 142 139 atexit(atExitCallback); 143 140 -
trunk/Source/WTF/ChangeLog
r162774 r162777 1 2014-01-25 Anders Carlsson <andersca@apple.com> 2 3 Remove atomicIncrement/atomicDecrement 4 https://bugs.webkit.org/show_bug.cgi?id=127625 5 6 Reviewed by Andreas Kling. 7 8 Replace atomicIncrement/atomicDecrement with std::atomic. 9 10 * wtf/Atomics.h: 11 * wtf/RefCountedLeakCounter.cpp: 12 (WTF::RefCountedLeakCounter::~RefCountedLeakCounter): 13 (WTF::RefCountedLeakCounter::increment): 14 (WTF::RefCountedLeakCounter::decrement): 15 * wtf/RefCountedLeakCounter.h: 16 * wtf/ThreadSafeRefCounted.h: 17 (WTF::ThreadSafeRefCountedBase::ref): 18 (WTF::ThreadSafeRefCountedBase::refCount): 19 (WTF::ThreadSafeRefCountedBase::derefBase): 20 1 21 2014-01-25 Anders Carlsson <andersca@apple.com> 2 22 -
trunk/Source/WTF/wtf/Atomics.h
r162137 r162777 74 74 75 75 #if OS(WINDOWS) 76 77 #if OS(WINCE)78 inline int atomicIncrement(int* addend) { return InterlockedIncrement(reinterpret_cast<long*>(addend)); }79 inline int atomicDecrement(int* addend) { return InterlockedDecrement(reinterpret_cast<long*>(addend)); }80 #elif COMPILER(MINGW)81 inline int atomicIncrement(int* addend) { return InterlockedIncrement(reinterpret_cast<long*>(addend)); }82 inline int atomicDecrement(int* addend) { return InterlockedDecrement(reinterpret_cast<long*>(addend)); }83 84 inline int64_t atomicIncrement(int64_t* addend) { return InterlockedIncrement64(reinterpret_cast<long long*>(addend)); }85 inline int64_t atomicDecrement(int64_t* addend) { return InterlockedDecrement64(reinterpret_cast<long long*>(addend)); }86 #else87 inline int atomicIncrement(int volatile* addend) { return InterlockedIncrement(reinterpret_cast<long volatile*>(addend)); }88 inline int atomicDecrement(int volatile* addend) { return InterlockedDecrement(reinterpret_cast<long volatile*>(addend)); }89 90 inline int64_t atomicIncrement(int64_t volatile* addend) { return InterlockedIncrement64(reinterpret_cast<long long volatile*>(addend)); }91 inline int64_t atomicDecrement(int64_t volatile* addend) { return InterlockedDecrement64(reinterpret_cast<long long volatile*>(addend)); }92 #endif93 94 #elif COMPILER(GCC)95 96 inline int atomicIncrement(int volatile* addend) { return __sync_add_and_fetch(addend, 1); }97 inline int atomicDecrement(int volatile* addend) { return __sync_sub_and_fetch(addend, 1); }98 99 inline int64_t atomicIncrement(int64_t volatile* addend) { return __sync_add_and_fetch(addend, 1); }100 inline int64_t atomicDecrement(int64_t volatile* addend) { return __sync_sub_and_fetch(addend, 1); }101 102 #endif103 104 #if OS(WINDOWS)105 76 inline bool weakCompareAndSwap(volatile unsigned* location, unsigned expected, unsigned newValue) 106 77 { … … 344 315 } // namespace WTF 345 316 346 using WTF::atomicDecrement;347 using WTF::atomicIncrement;348 349 317 #endif // Atomics_h -
trunk/Source/WTF/wtf/RefCountedLeakCounter.cpp
r157653 r162777 69 69 if (m_count) { 70 70 if (!leakMessageSuppressionReasons || leakMessageSuppressionReasons->isEmpty()) 71 LOG(RefCountedLeaks, "LEAK: %u %s", m_count , m_description);71 LOG(RefCountedLeaks, "LEAK: %u %s", m_count.load(), m_description); 72 72 else if (!loggedSuppressionReason) { 73 73 // This logs only one reason. Later we could change it so we log all the reasons. … … 80 80 void RefCountedLeakCounter::increment() 81 81 { 82 atomicIncrement(&m_count);82 ++m_count; 83 83 } 84 84 85 85 void RefCountedLeakCounter::decrement() 86 86 { 87 atomicDecrement(&m_count);87 --m_count; 88 88 } 89 89 -
trunk/Source/WTF/wtf/RefCountedLeakCounter.h
r150134 r162777 21 21 #ifndef RefCountedLeakCounter_h 22 22 #define RefCountedLeakCounter_h 23 23 24 #include <atomic> 24 25 #include <wtf/Assertions.h> 25 #include <wtf/Threading.h>26 26 27 27 namespace WTF { 28 28 29 30 31 32 33 34 29 struct RefCountedLeakCounter { 30 WTF_EXPORT_PRIVATE static void suppressMessages(const char*); 31 WTF_EXPORT_PRIVATE static void cancelMessageSuppression(const char*); 32 33 WTF_EXPORT_PRIVATE explicit RefCountedLeakCounter(const char* description); 34 WTF_EXPORT_PRIVATE ~RefCountedLeakCounter(); 35 35 36 37 36 WTF_EXPORT_PRIVATE void increment(); 37 WTF_EXPORT_PRIVATE void decrement(); 38 38 39 39 #ifndef NDEBUG 40 private: 41 #if COMPILER(MINGW) || OS(WINCE) 42 int m_count; 43 #else 44 volatile int m_count; 40 private: 41 std::atomic<int> m_count; 42 const char* m_description; 45 43 #endif 46 const char* m_description; 47 #endif 48 }; 44 }; 49 45 50 46 } // namespace WTF -
trunk/Source/WTF/wtf/ThreadSafeRefCounted.h
r157897 r162777 60 60 #define ThreadSafeRefCounted_h 61 61 62 #include <wtf/Platform.h> 63 64 #include <wtf/Atomics.h> 62 #include <atomic> 65 63 #include <wtf/DynamicAnnotations.h> 66 #include <wtf/ ThreadingPrimitives.h>64 #include <wtf/Noncopyable.h> 67 65 68 66 namespace WTF { … … 79 77 void ref() 80 78 { 81 atomicIncrement(&m_refCount);79 ++m_refCount; 82 80 } 83 81 … … 89 87 int refCount() const 90 88 { 91 return static_cast<int const volatile&>(m_refCount);89 return m_refCount; 92 90 } 93 91 … … 97 95 { 98 96 WTF_ANNOTATE_HAPPENS_BEFORE(&m_refCount); 99 if ( atomicDecrement(&m_refCount)<= 0) {97 if (--m_refCount <= 0) { 100 98 WTF_ANNOTATE_HAPPENS_AFTER(&m_refCount); 101 99 return true; … … 106 104 107 105 private: 108 intm_refCount;106 std::atomic<int> m_refCount; 109 107 }; 110 108 -
trunk/Source/WebCore/ChangeLog
r162776 r162777 1 2014-01-25 Anders Carlsson <andersca@apple.com> 2 3 Remove atomicIncrement/atomicDecrement 4 https://bugs.webkit.org/show_bug.cgi?id=127625 5 6 Reviewed by Andreas Kling. 7 8 Replace atomicIncrement/atomicDecrement with std::atomic. 9 10 * Modules/webaudio/AudioContext.cpp: 11 (WebCore::AudioContext::incrementActiveSourceCount): 12 (WebCore::AudioContext::decrementActiveSourceCount): 13 * Modules/webaudio/AudioContext.h: 14 * Modules/webaudio/AudioNode.cpp: 15 (WebCore::AudioNode::~AudioNode): 16 (WebCore::AudioNode::ref): 17 (WebCore::AudioNode::finishDeref): 18 * Modules/webaudio/AudioNode.h: 19 * Modules/webdatabase/OriginLock.h: 20 1 21 2014-01-25 Alex Christensen <achristensen@webkit.org> 2 22 -
trunk/Source/WebCore/Modules/webaudio/AudioContext.cpp
r162368 r162777 1002 1002 void AudioContext::incrementActiveSourceCount() 1003 1003 { 1004 atomicIncrement(&m_activeSourceCount);1004 ++m_activeSourceCount; 1005 1005 } 1006 1006 1007 1007 void AudioContext::decrementActiveSourceCount() 1008 1008 { 1009 atomicDecrement(&m_activeSourceCount);1009 --m_activeSourceCount; 1010 1010 } 1011 1011 -
trunk/Source/WebCore/Modules/webaudio/AudioContext.h
r162368 r162777 33 33 #include "EventTarget.h" 34 34 #include "MediaCanStartListener.h" 35 #include <atomic> 35 36 #include <wtf/HashSet.h> 36 37 #include <wtf/MainThread.h> … … 362 363 363 364 // Number of AudioBufferSourceNodes that are active (playing). 364 intm_activeSourceCount;365 std::atomic<int> m_activeSourceCount; 365 366 366 367 BehaviorRestrictions m_restrictions; -
trunk/Source/WebCore/Modules/webaudio/AudioNode.cpp
r162368 r162777 70 70 #if DEBUG_AUDIONODE_REFERENCES 71 71 --s_nodeCount[nodeType()]; 72 fprintf(stderr, "%p: %d: AudioNode::~AudioNode() %d %d\n", this, nodeType(), m_normalRefCount , m_connectionRefCount);72 fprintf(stderr, "%p: %d: AudioNode::~AudioNode() %d %d\n", this, nodeType(), m_normalRefCount.load(), m_connectionRefCount); 73 73 #endif 74 74 } … … 412 412 switch (refType) { 413 413 case RefTypeNormal: 414 atomicIncrement(&m_normalRefCount);414 ++m_normalRefCount; 415 415 break; 416 416 case RefTypeConnection: 417 atomicIncrement(&m_connectionRefCount);417 ++m_connectionRefCount; 418 418 break; 419 419 default: … … 474 474 case RefTypeNormal: 475 475 ASSERT(m_normalRefCount > 0); 476 atomicDecrement(&m_normalRefCount);476 --m_normalRefCount; 477 477 break; 478 478 case RefTypeConnection: 479 479 ASSERT(m_connectionRefCount > 0); 480 atomicDecrement(&m_connectionRefCount);480 --m_connectionRefCount; 481 481 break; 482 482 default: -
trunk/Source/WebCore/Modules/webaudio/AudioNode.h
r162368 r162777 208 208 209 209 // Ref-counting 210 volatile intm_normalRefCount;211 volatile intm_connectionRefCount;210 std::atomic<int> m_normalRefCount; 211 std::atomic<int> m_connectionRefCount; 212 212 213 213 bool m_isMarkedForDeletion; -
trunk/Source/WebCore/Modules/webdatabase/OriginLock.h
r144760 r162777 31 31 #include "FileSystem.h" 32 32 #include <wtf/ThreadSafeRefCounted.h> 33 #include <wtf/ThreadingPrimitives.h> 33 34 #include <wtf/text/WTFString.h> 34 35 -
trunk/Source/WebKit2/ChangeLog
r162774 r162777 1 2014-01-25 Anders Carlsson <andersca@apple.com> 2 3 Remove atomicIncrement/atomicDecrement 4 https://bugs.webkit.org/show_bug.cgi?id=127625 5 6 Reviewed by Andreas Kling. 7 8 Replace atomicIncrement/atomicDecrement with std::atomic. 9 10 * Platform/IPC/Connection.cpp: 11 (IPC::Connection::createSyncMessageEncoder): 12 * Shared/mac/SecItemShim.cpp: 13 (WebKit::generateSecItemRequestID): 14 * UIProcess/StatisticsRequest.cpp: 15 (WebKit::StatisticsRequest::addOutstandingRequest): 16 1 17 2014-01-25 Anders Carlsson <andersca@apple.com> 2 18 -
trunk/Source/WebKit2/Platform/IPC/Connection.cpp
r161173 r162777 345 345 346 346 // Encode the sync request ID. 347 COMPILE_ASSERT(sizeof(m_syncRequestID) == sizeof(int64_t), CanUseAtomicIncrement);348 347 syncRequestID = ++m_syncRequestID; 349 348 *encoder << syncRequestID; -
trunk/Source/WebKit2/Shared/mac/SecItemShim.cpp
r161849 r162777 37 37 #include "SecItemShimProxyMessages.h" 38 38 #include <Security/Security.h> 39 #include <atomic> 39 40 #include <dlfcn.h> 40 41 #include <mutex> … … 74 75 static uint64_t generateSecItemRequestID() 75 76 { 76 static int64_tuniqueSecItemRequestID;77 return atomicIncrement(&uniqueSecItemRequestID);77 static std::atomic<int64_t> uniqueSecItemRequestID; 78 return ++uniqueSecItemRequestID; 78 79 } 79 80 -
trunk/Source/WebKit2/UIProcess/StatisticsRequest.cpp
r160395 r162777 29 29 #include "APIArray.h" 30 30 #include "MutableDictionary.h" 31 #include <wtf/Atomics.h>32 31 33 32 namespace WebKit { … … 46 45 uint64_t StatisticsRequest::addOutstandingRequest() 47 46 { 48 static int64_tuniqueRequestID;47 static std::atomic<int64_t> uniqueRequestID; 49 48 50 uint64_t requestID = atomicIncrement(&uniqueRequestID);49 uint64_t requestID = ++uniqueRequestID; 51 50 m_outstandingRequests.add(requestID); 52 51 return requestID;
Note: See TracChangeset
for help on using the changeset viewer.