Changeset 181485 in webkit
- Timestamp:
- Mar 13, 2015 1:04:29 PM (9 years ago)
- Location:
- trunk/Source
- Files:
-
- 1 added
- 1 deleted
- 28 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/API/JSValue.mm
r173141 r181485 42 42 #import <wtf/HashSet.h> 43 43 #import <wtf/ObjcRuntimeExtras.h> 44 #import <wtf/SpinLock.h> 44 45 #import <wtf/Vector.h> 45 #import <wtf/TCSpinLock.h>46 46 #import <wtf/text/WTFString.h> 47 47 #import <wtf/text/StringHash.h> … … 1103 1103 static StructTagHandler* handerForStructTag(const char* encodedType) 1104 1104 { 1105 static S pinLock handerForStructTagLock = SPINLOCK_INITIALIZER;1105 static StaticSpinLock handerForStructTagLock; 1106 1106 SpinLockHolder lockHolder(&handerForStructTagLock); 1107 1107 -
trunk/Source/JavaScriptCore/API/JSWrapperMap.mm
r181297 r181485 40 40 #import "WeakGCMapInlines.h" 41 41 #import <wtf/HashSet.h> 42 #import <wtf/TCSpinLock.h>43 42 #import <wtf/Vector.h> 44 43 #import <wtf/spi/cocoa/NSMapTableSPI.h> -
trunk/Source/JavaScriptCore/ChangeLog
r181482 r181485 1 2015-03-13 Mark Lam <mark.lam@apple.com> 2 3 Replace TCSpinLock with a new WTF::SpinLock based on WTF::Atomic. 4 <https://webkit.org/b/142674> 5 6 Reviewed by Filip Pizlo. 7 8 * API/JSValue.mm: 9 (handerForStructTag): 10 * API/JSWrapperMap.mm: 11 * dfg/DFGCommon.cpp: 12 (JSC::DFG::startCrashing): 13 (JSC::DFG::isCrashing): 14 - Changed to use a StaticSpinLock since that's what this code was trying to do 15 anyway. 16 * heap/CopiedBlock.h: 17 (JSC::CopiedBlock::CopiedBlock): 18 * heap/CopiedSpace.cpp: 19 (JSC::CopiedSpace::CopiedSpace): 20 * heap/CopiedSpace.h: 21 * heap/GCThreadSharedData.cpp: 22 (JSC::GCThreadSharedData::GCThreadSharedData): 23 * heap/GCThreadSharedData.h: 24 * heap/ListableHandler.h: 25 (JSC::ListableHandler::List::List): 26 * parser/SourceProvider.cpp: 27 * profiler/ProfilerDatabase.cpp: 28 (JSC::Profiler::Database::addDatabaseToAtExit): 29 (JSC::Profiler::Database::removeDatabaseFromAtExit): 30 (JSC::Profiler::Database::removeFirstAtExitDatabase): 31 1 32 2015-03-13 Ryosuke Niwa <rniwa@webkit.org> 2 33 -
trunk/Source/JavaScriptCore/dfg/DFGCommon.cpp
r181481 r181485 35 35 namespace JSC { namespace DFG { 36 36 37 static Atomic<unsigned>crashLock;37 static StaticSpinLock crashLock; 38 38 39 39 void startCrashing() 40 40 { 41 while (!crashLock.compare_exchange_weak(0, 1, std::memory_order_acquire)) 42 std::this_thread::yield(); 41 crashLock.lock(); 43 42 } 44 43 45 44 bool isCrashing() 46 45 { 47 return !!crashLock.load(std::memory_order_acquire);46 return crashLock.isLocked(); 48 47 } 49 48 -
trunk/Source/JavaScriptCore/heap/CopiedBlock.h
r181177 r181485 33 33 #include <wtf/Atomics.h> 34 34 #include <wtf/DoublyLinkedList.h> 35 #include <wtf/ TCSpinLock.h>35 #include <wtf/SpinLock.h> 36 36 37 37 namespace JSC { … … 153 153 #endif 154 154 { 155 m_workListLock.Init();156 155 ASSERT(is8ByteAligned(reinterpret_cast<void*>(m_remaining))); 157 156 } -
trunk/Source/JavaScriptCore/heap/CopiedSpace.cpp
r181177 r181485 40 40 , m_numberOfLoanedBlocks(0) 41 41 { 42 m_toSpaceLock.Init();43 42 } 44 43 -
trunk/Source/JavaScriptCore/heap/CopiedSpace.h
r162017 r181485 38 38 #include <wtf/PageAllocationAligned.h> 39 39 #include <wtf/PageBlock.h> 40 #include <wtf/SpinLock.h> 40 41 #include <wtf/StdLibExtras.h> 41 #include <wtf/TCSpinLock.h>42 42 #include <wtf/ThreadingPrimitives.h> 43 43 -
trunk/Source/JavaScriptCore/heap/GCThreadSharedData.cpp
r179348 r181485 82 82 , m_currentPhase(NoPhase) 83 83 { 84 m_copyLock.Init();85 84 #if ENABLE(PARALLEL_GC) 86 85 // Grab the lock so the new GC threads can be properly initialized before they start running. -
trunk/Source/JavaScriptCore/heap/GCThreadSharedData.h
r181215 r181485 34 34 #include <condition_variable> 35 35 #include <wtf/HashSet.h> 36 #include <wtf/ TCSpinLock.h>36 #include <wtf/SpinLock.h> 37 37 #include <wtf/Vector.h> 38 38 -
trunk/Source/JavaScriptCore/heap/ListableHandler.h
r126354 r181485 24 24 #include <wtf/Locker.h> 25 25 #include <wtf/Noncopyable.h> 26 #include <wtf/SpinLock.h> 26 27 #include <wtf/ThreadingPrimitives.h> 27 #include <wtf/TCSpinLock.h>28 28 29 29 namespace JSC { … … 62 62 : m_first(0) 63 63 { 64 m_lock.Init();65 64 } 66 65 -
trunk/Source/JavaScriptCore/parser/SourceProvider.cpp
r163844 r181485 28 28 29 29 #include "JSCInlines.h" 30 #include <wtf/SpinLock.h> 30 31 #include <wtf/StdLibExtras.h> 31 #include <wtf/TCSpinLock.h>32 32 33 33 namespace JSC { … … 45 45 } 46 46 47 static TCMalloc_SpinLock providerIdLock = SPINLOCK_INITIALIZER;47 static StaticSpinLock providerIdLock; 48 48 49 49 void SourceProvider::getID() -
trunk/Source/JavaScriptCore/profiler/ProfilerDatabase.cpp
r163844 r181485 36 36 static std::atomic<int> databaseCounter; 37 37 38 static S pinLock registrationLock = SPINLOCK_INITIALIZER;38 static StaticSpinLock registrationLock; 39 39 static std::atomic<int> didRegisterAtExit; 40 40 static Database* firstDatabase; … … 139 139 atexit(atExitCallback); 140 140 141 TCMalloc_SpinLockHolder holder(®istrationLock);141 SpinLockHolder holder(registrationLock); 142 142 m_nextRegisteredDatabase = firstDatabase; 143 143 firstDatabase = this; … … 146 146 void Database::removeDatabaseFromAtExit() 147 147 { 148 TCMalloc_SpinLockHolder holder(®istrationLock);148 SpinLockHolder holder(registrationLock); 149 149 for (Database** current = &firstDatabase; *current; current = &(*current)->m_nextRegisteredDatabase) { 150 150 if (*current != this) … … 164 164 Database* Database::removeFirstAtExitDatabase() 165 165 { 166 TCMalloc_SpinLockHolder holder(®istrationLock);166 SpinLockHolder holder(registrationLock); 167 167 Database* result = firstDatabase; 168 168 if (result) { -
trunk/Source/WTF/ChangeLog
r181481 r181485 1 2015-03-13 Mark Lam <mark.lam@apple.com> 2 3 Replace TCSpinLock with a new WTF::SpinLock based on WTF::Atomic. 4 <https://webkit.org/b/142674> 5 6 Reviewed by Filip Pizlo. 7 8 We no longer use TCMalloc in our code, and we now have C++11. This replaces the 9 TCMalloc_SpinLock with a new WTF::SpinLock based on WTF::Atomic (which is a 10 wrapper around std::atomic). 11 12 Note that there is a StaticSpinLock and a SpinLock: 13 14 1. StaticSpinLock is an alias for SpinLockBase, and its initialization relies on 15 static / global std:atomic being automatically initialized to 0 at compile time. 16 Hence, StaticSpinLock should only be used for statics / globals (including 17 static members of classes / structs). 18 19 2. SpinLock is derived from SpinLockBase, and adds a default constructor to 20 initialize its internal atomic value to 0. Because SpinLock has a constructor, 21 it cannot be used for statics / globals. Objects that want to embed a spin 22 lock as an instance field should use SpinLock so that it is initialized properly. 23 std::atomic will not automatically initialize instance fields to 0. Hence, 24 StaticSpinLock will not work correctly as instance fields of a class / struct. 25 26 * WTF.vcxproj/WTF.vcxproj: 27 * WTF.vcxproj/WTF.vcxproj.filters: 28 * WTF.xcodeproj/project.pbxproj: 29 * wtf/CMakeLists.txt: 30 * wtf/MetaAllocator.cpp: 31 (WTF::MetaAllocator::~MetaAllocator): 32 (WTF::MetaAllocator::MetaAllocator): 33 * wtf/MetaAllocator.h: 34 * wtf/SpinLock.h: Added. 35 (WTF::SpinLockBase::lock): 36 (WTF::SpinLockBase::unlock): 37 (WTF::SpinLockBase::isLocked): 38 (WTF::SpinLockBase::slowLock): 39 (WTF::SpinLock::SpinLock): 40 * wtf/TCSpinLock.h: Removed. 41 * wtf/text/AtomicString.cpp: 42 1 43 2015-03-13 Mark Lam <mark.lam@apple.com> 2 44 -
trunk/Source/WTF/WTF.vcxproj/WTF.vcxproj
r181220 r181485 272 272 <ClInclude Include="..\wtf\SinglyLinkedList.h" /> 273 273 <ClInclude Include="..\wtf\SixCharacterHash.h" /> 274 <ClInclude Include="..\wtf\SpinLock.h" /> 274 275 <ClInclude Include="..\wtf\StackBounds.h" /> 275 276 <ClInclude Include="..\wtf\StaticConstructors.h" /> … … 279 280 <ClInclude Include="..\wtf\StringHasher.h" /> 280 281 <ClInclude Include="..\wtf\StringPrintStream.h" /> 281 <ClInclude Include="..\wtf\TCSpinLock.h" />282 282 <ClInclude Include="..\wtf\TemporaryChange.h" /> 283 283 <ClInclude Include="..\wtf\text\ASCIIFastPath.h" /> -
trunk/Source/WTF/WTF.vcxproj/WTF.vcxproj.filters
r181220 r181485 613 613 <Filter>wtf</Filter> 614 614 </ClInclude> 615 <ClInclude Include="..\wtf\SpinLock.h"> 616 <Filter>wtf</Filter> 617 </ClInclude> 615 618 <ClInclude Include="..\wtf\StackBounds.h"> 616 619 <Filter>wtf</Filter> … … 632 635 </ClInclude> 633 636 <ClInclude Include="..\wtf\StringPrintStream.h"> 634 <Filter>wtf</Filter>635 </ClInclude>636 <ClInclude Include="..\wtf\TCSpinLock.h">637 637 <Filter>wtf</Filter> 638 638 </ClInclude> -
trunk/Source/WTF/WTF.xcodeproj/project.pbxproj
r180968 r181485 222 222 A8A4742C151A825B004123FF /* StringExtras.h in Headers */ = {isa = PBXBuildFile; fileRef = A8A47313151A825B004123FF /* StringExtras.h */; }; 223 223 A8A4742D151A825B004123FF /* StringHasher.h in Headers */ = {isa = PBXBuildFile; fileRef = A8A47314151A825B004123FF /* StringHasher.h */; }; 224 A8A47430151A825B004123FF /* TCSpinLock.h in Headers */ = {isa = PBXBuildFile; fileRef = A8A47317151A825B004123FF /* TCSpinLock.h */; };225 224 A8A47433151A825B004123FF /* TemporaryChange.h in Headers */ = {isa = PBXBuildFile; fileRef = A8A4731A151A825B004123FF /* TemporaryChange.h */; }; 226 225 A8A47434151A825B004123FF /* ASCIIFastPath.h in Headers */ = {isa = PBXBuildFile; fileRef = A8A4731C151A825B004123FF /* ASCIIFastPath.h */; }; … … 280 279 E4A0AD3D1A96253C00536DF6 /* WorkQueueCocoa.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E4A0AD3C1A96253C00536DF6 /* WorkQueueCocoa.cpp */; }; 281 280 EB95E1F0161A72410089A2F5 /* ByteOrder.h in Headers */ = {isa = PBXBuildFile; fileRef = EB95E1EF161A72410089A2F5 /* ByteOrder.h */; }; 281 FE91E8811AB2A0200099895F /* SpinLock.h in Headers */ = {isa = PBXBuildFile; fileRef = FE91E8801AB2A0200099895F /* SpinLock.h */; }; 282 282 FEDACD3D1630F83F00C69634 /* StackStats.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FEDACD3B1630F83F00C69634 /* StackStats.cpp */; }; 283 283 FEDACD3E1630F83F00C69634 /* StackStats.h in Headers */ = {isa = PBXBuildFile; fileRef = FEDACD3C1630F83F00C69634 /* StackStats.h */; }; … … 514 514 A8A47313151A825B004123FF /* StringExtras.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = StringExtras.h; sourceTree = "<group>"; }; 515 515 A8A47314151A825B004123FF /* StringHasher.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = StringHasher.h; sourceTree = "<group>"; }; 516 A8A47317151A825B004123FF /* TCSpinLock.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TCSpinLock.h; sourceTree = "<group>"; };517 516 A8A4731A151A825B004123FF /* TemporaryChange.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TemporaryChange.h; sourceTree = "<group>"; }; 518 517 A8A4731C151A825B004123FF /* ASCIIFastPath.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ASCIIFastPath.h; sourceTree = "<group>"; }; … … 572 571 E4A0AD3C1A96253C00536DF6 /* WorkQueueCocoa.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WorkQueueCocoa.cpp; sourceTree = "<group>"; }; 573 572 EB95E1EF161A72410089A2F5 /* ByteOrder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ByteOrder.h; sourceTree = "<group>"; }; 573 FE91E8801AB2A0200099895F /* SpinLock.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SpinLock.h; sourceTree = "<group>"; }; 574 574 FEDACD3B1630F83F00C69634 /* StackStats.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = StackStats.cpp; sourceTree = "<group>"; }; 575 575 FEDACD3C1630F83F00C69634 /* StackStats.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = StackStats.h; sourceTree = "<group>"; }; … … 851 851 A8A4730C151A825B004123FF /* SizeLimits.cpp */, 852 852 A8A4730D151A825B004123FF /* Spectrum.h */, 853 FE91E8801AB2A0200099895F /* SpinLock.h */, 853 854 A8A4730E151A825B004123FF /* StackBounds.cpp */, 854 855 A8A4730F151A825B004123FF /* StackBounds.h */, … … 864 865 0FDDBFA51666DFA300C55FEF /* StringPrintStream.cpp */, 865 866 0FDDBFA61666DFA300C55FEF /* StringPrintStream.h */, 866 A8A47317151A825B004123FF /* TCSpinLock.h */,867 867 A8A4731A151A825B004123FF /* TemporaryChange.h */, 868 868 A8A4732F151A825B004123FF /* ThreadFunctionInvocation.h */, … … 1183 1183 A8A4743D151A825B004123FF /* StringBuilder.h in Headers */, 1184 1184 A8A4743E151A825B004123FF /* StringConcatenate.h in Headers */, 1185 FE91E8811AB2A0200099895F /* SpinLock.h in Headers */, 1185 1186 A8A4742C151A825B004123FF /* StringExtras.h in Headers */, 1186 1187 A8A4743F151A825B004123FF /* StringHash.h in Headers */, … … 1192 1193 1AFDE6531953B23D00C48FFA /* Optional.h in Headers */, 1193 1194 A8A473B8151A825B004123FF /* strtod.h in Headers */, 1194 A8A47430151A825B004123FF /* TCSpinLock.h in Headers */,1195 1195 E15556F618A0CC18006F48FB /* CryptographicUtilities.h in Headers */, 1196 1196 83FBA93219DF459700F30ADB /* TypeCasts.h in Headers */, -
trunk/Source/WTF/wtf/CMakeLists.txt
r180968 r181485 88 88 SaturatedArithmetic.h 89 89 SegmentedVector.h 90 SpinLock.h 90 91 StackBounds.h 91 92 StackStats.h … … 96 97 StringHasher.h 97 98 StringPrintStream.h 98 TCSpinLock.h99 99 ThreadIdentifierDataPthreads.h 100 100 ThreadSafeRefCounted.h -
trunk/Source/WTF/wtf/MetaAllocator.cpp
r165676 r181485 44 44 node = next; 45 45 } 46 m_lock.Finalize();47 46 #ifndef NDEBUG 48 47 ASSERT(!m_mallocBalance); … … 130 129 #endif 131 130 { 132 m_lock.Init();133 134 131 for (m_logPageSize = 0; m_logPageSize < 32; ++m_logPageSize) { 135 132 if (static_cast<size_t>(1) << m_logPageSize == m_pageSize) -
trunk/Source/WTF/wtf/MetaAllocator.h
r165676 r181485 38 38 #include <wtf/RefCounted.h> 39 39 #include <wtf/RefPtr.h> 40 #include <wtf/ TCSpinLock.h>40 #include <wtf/SpinLock.h> 41 41 42 42 namespace WTF { -
trunk/Source/WTF/wtf/text/AtomicString.cpp
r177259 r181485 34 34 35 35 #if USE(WEB_THREAD) 36 #include " TCSpinLock.h"36 #include "SpinLock.h" 37 37 #endif 38 38 … … 48 48 WTF_MAKE_NONCOPYABLE(AtomicStringTableLocker); 49 49 50 static S pinLock s_stringTableLock;50 static StaticSpinLock s_stringTableLock; 51 51 public: 52 52 AtomicStringTableLocker() … … 56 56 }; 57 57 58 S pinLock AtomicStringTableLocker::s_stringTableLock = SPINLOCK_INITIALIZER;58 StaticSpinLock AtomicStringTableLocker::s_stringTableLock; 59 59 60 60 #else -
trunk/Source/WebCore/ChangeLog
r181484 r181485 1 2015-03-13 Mark Lam <mark.lam@apple.com> 2 3 Replace TCSpinLock with a new WTF::SpinLock based on WTF::Atomic. 4 <https://webkit.org/b/142674> 5 6 Reviewed by Filip Pizlo. 7 8 No new tests because there is no new functionality. This is a refactoring effort. 9 10 * bindings/objc/WebScriptObject.mm: 11 * platform/ios/wak/WAKWindow.mm: 12 (-[WAKWindow initWithLayer:]): 13 (-[WAKWindow initWithFrame:]): 14 1 15 2015-03-13 Doug Russell <d_russell@apple.com> 2 16 -
trunk/Source/WebCore/bindings/objc/WebScriptObject.mm
r176278 r181485 49 49 #import <runtime/Completion.h> 50 50 #import <runtime/Completion.h> 51 #import <wtf/ TCSpinLock.h>51 #import <wtf/SpinLock.h> 52 52 #import <wtf/Threading.h> 53 53 #import <wtf/spi/cocoa/NSMapTableSPI.h> … … 73 73 74 74 static NSMapTable* JSWrapperCache; 75 static S pinLock spinLock = SPINLOCK_INITIALIZER;75 static StaticSpinLock spinLock; 76 76 77 77 NSObject* getJSWrapper(JSObject* impl) -
trunk/Source/WebCore/platform/ios/wak/WAKWindow.mm
r179886 r181485 37 37 #import "WKViewPrivate.h" 38 38 #import <QuartzCore/QuartzCore.h> 39 #import <wtf/ TCSpinLock.h>39 #import <wtf/SpinLock.h> 40 40 41 41 WEBCORE_EXPORT NSString * const WAKWindowScreenScaleDidChangeNotification = @"WAKWindowScreenScaleDidChangeNotification"; … … 78 78 _frozenVisibleRect = CGRectNull; 79 79 80 _exposedScrollViewRectLock = SPINLOCK_INITIALIZER;81 80 _exposedScrollViewRect = CGRectNull; 82 81 … … 94 93 _screenScale = wkGetScreenScaleFactor(); 95 94 96 _exposedScrollViewRectLock = SPINLOCK_INITIALIZER;97 95 _exposedScrollViewRect = CGRectNull; 98 96 -
trunk/Source/WebKit2/ChangeLog
r181483 r181485 1 2015-03-13 Mark Lam <mark.lam@apple.com> 2 3 Replace TCSpinLock with a new WTF::SpinLock based on WTF::Atomic. 4 <https://webkit.org/b/142674> 5 6 Reviewed by Filip Pizlo. 7 8 * WebProcess/WebPage/EventDispatcher.cpp: 9 (WebKit::EventDispatcher::EventDispatcher): 10 * WebProcess/WebPage/EventDispatcher.h: 11 * WebProcess/WebPage/ViewUpdateDispatcher.cpp: 12 (WebKit::ViewUpdateDispatcher::ViewUpdateDispatcher): 13 * WebProcess/WebPage/ViewUpdateDispatcher.h: 14 1 15 2015-03-10 Conrad Shultz <conrad_shultz@apple.com> 2 16 -
trunk/Source/WebKit2/WebProcess/WebPage/EventDispatcher.cpp
r180054 r181485 55 55 : m_queue(WorkQueue::create("com.apple.WebKit.EventDispatcher", WorkQueue::Type::Serial, WorkQueue::QOS::UserInteractive)) 56 56 , m_recentWheelEventDeltaTracker(std::make_unique<WheelEventDeltaTracker>()) 57 #if ENABLE(IOS_TOUCH_EVENTS)58 , m_touchEventsLock(SPINLOCK_INITIALIZER)59 #endif60 57 { 61 58 } -
trunk/Source/WebKit2/WebProcess/WebPage/EventDispatcher.h
r180054 r181485 35 35 #include <wtf/Noncopyable.h> 36 36 #include <wtf/RefPtr.h> 37 #include <wtf/ TCSpinLock.h>37 #include <wtf/SpinLock.h> 38 38 #include <wtf/ThreadingPrimitives.h> 39 39 -
trunk/Source/WebKit2/WebProcess/WebPage/ViewUpdateDispatcher.cpp
r180054 r181485 43 43 ViewUpdateDispatcher::ViewUpdateDispatcher() 44 44 : m_queue(WorkQueue::create("com.apple.WebKit.ViewUpdateDispatcher")) 45 , m_dataMutex(SPINLOCK_INITIALIZER)46 45 { 47 46 } -
trunk/Source/WebKit2/WebProcess/WebPage/ViewUpdateDispatcher.h
r180054 r181485 32 32 #include <wtf/HashMap.h> 33 33 #include <wtf/Ref.h> 34 #include <wtf/ TCSpinLock.h>34 #include <wtf/SpinLock.h> 35 35 36 36 namespace WebKit {
Note: See TracChangeset
for help on using the changeset viewer.