<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[188677] trunk/Source</title>
</head>
<body>
<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/188677">188677</a></dd>
<dt>Author</dt> <dd>fpizlo@apple.com</dd>
<dt>Date</dt> <dd>2015-08-19 19:34:02 -0700 (Wed, 19 Aug 2015)</dd>
</dl>
<h3>Log Message</h3>
<pre>Remove WTF::SpinLock
https://bugs.webkit.org/show_bug.cgi?id=148208
Reviewed by Geoffrey Garen.
Source/JavaScriptCore:
Remove the one remaining use of SpinLock.
* API/JSValue.mm:
(handerForStructTag):
Source/WTF:
Remove the SpinLock.h file and remove references to the SpinLock class. Put the old SpinLock
algorithm in LockSpeedTest.cpp - which isn't compiled as part of a WTF or WebKit build - just
so we can still benchmark our locking algorithms against a spinlock baseline.
* WTF.vcxproj/WTF.vcxproj:
* WTF.xcodeproj/project.pbxproj:
* benchmarks/LockSpeedTest.cpp:
* wtf/CMakeLists.txt:
* wtf/Lock.h:
* wtf/SpinLock.h: Removed.
* wtf/WordLock.h:</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceJavaScriptCoreAPIJSValuemm">trunk/Source/JavaScriptCore/API/JSValue.mm</a></li>
<li><a href="#trunkSourceJavaScriptCoreChangeLog">trunk/Source/JavaScriptCore/ChangeLog</a></li>
<li><a href="#trunkSourceWTFChangeLog">trunk/Source/WTF/ChangeLog</a></li>
<li><a href="#trunkSourceWTFWTFvcxprojWTFvcxproj">trunk/Source/WTF/WTF.vcxproj/WTF.vcxproj</a></li>
<li><a href="#trunkSourceWTFWTFxcodeprojprojectpbxproj">trunk/Source/WTF/WTF.xcodeproj/project.pbxproj</a></li>
<li><a href="#trunkSourceWTFbenchmarksLockSpeedTestcpp">trunk/Source/WTF/benchmarks/LockSpeedTest.cpp</a></li>
<li><a href="#trunkSourceWTFwtfCMakeListstxt">trunk/Source/WTF/wtf/CMakeLists.txt</a></li>
<li><a href="#trunkSourceWTFwtfLockh">trunk/Source/WTF/wtf/Lock.h</a></li>
<li><a href="#trunkSourceWTFwtfWordLockh">trunk/Source/WTF/wtf/WordLock.h</a></li>
</ul>
<h3>Removed Paths</h3>
<ul>
<li><a href="#trunkSourceWTFwtfSpinLockh">trunk/Source/WTF/wtf/SpinLock.h</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceJavaScriptCoreAPIJSValuemm"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/API/JSValue.mm (188676 => 188677)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/API/JSValue.mm        2015-08-20 02:15:39 UTC (rev 188676)
+++ trunk/Source/JavaScriptCore/API/JSValue.mm        2015-08-20 02:34:02 UTC (rev 188677)
</span><span class="lines">@@ -41,8 +41,8 @@
</span><span class="cx"> #import "StrongInlines.h"
</span><span class="cx"> #import <wtf/HashMap.h>
</span><span class="cx"> #import <wtf/HashSet.h>
</span><ins>+#import <wtf/Lock.h>
</ins><span class="cx"> #import <wtf/ObjcRuntimeExtras.h>
</span><del>-#import <wtf/SpinLock.h>
</del><span class="cx"> #import <wtf/Vector.h>
</span><span class="cx"> #import <wtf/text/WTFString.h>
</span><span class="cx"> #import <wtf/text/StringHash.h>
</span><span class="lines">@@ -1114,8 +1114,8 @@
</span><span class="cx">
</span><span class="cx"> static StructTagHandler* handerForStructTag(const char* encodedType)
</span><span class="cx"> {
</span><del>- static StaticSpinLock handerForStructTagLock;
- SpinLockHolder lockHolder(&handerForStructTagLock);
</del><ins>+ static StaticLock handerForStructTagLock;
+ LockHolder lockHolder(&handerForStructTagLock);
</ins><span class="cx">
</span><span class="cx"> static StructHandlers* structHandlers = createStructHandlerMap();
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/ChangeLog (188676 => 188677)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/ChangeLog        2015-08-20 02:15:39 UTC (rev 188676)
+++ trunk/Source/JavaScriptCore/ChangeLog        2015-08-20 02:34:02 UTC (rev 188677)
</span><span class="lines">@@ -1,3 +1,15 @@
</span><ins>+2015-08-19 Filip Pizlo <fpizlo@apple.com>
+
+ Remove WTF::SpinLock
+ https://bugs.webkit.org/show_bug.cgi?id=148208
+
+ Reviewed by Geoffrey Garen.
+
+ Remove the one remaining use of SpinLock.
+
+ * API/JSValue.mm:
+ (handerForStructTag):
+
</ins><span class="cx"> 2015-08-19 Geoffrey Garen <ggaren@apple.com>
</span><span class="cx">
</span><span class="cx"> clearCode() should clear code
</span></span></pre></div>
<a id="trunkSourceWTFChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WTF/ChangeLog (188676 => 188677)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WTF/ChangeLog        2015-08-20 02:15:39 UTC (rev 188676)
+++ trunk/Source/WTF/ChangeLog        2015-08-20 02:34:02 UTC (rev 188677)
</span><span class="lines">@@ -1,3 +1,22 @@
</span><ins>+2015-08-19 Filip Pizlo <fpizlo@apple.com>
+
+ Remove WTF::SpinLock
+ https://bugs.webkit.org/show_bug.cgi?id=148208
+
+ Reviewed by Geoffrey Garen.
+
+ Remove the SpinLock.h file and remove references to the SpinLock class. Put the old SpinLock
+ algorithm in LockSpeedTest.cpp - which isn't compiled as part of a WTF or WebKit build - just
+ so we can still benchmark our locking algorithms against a spinlock baseline.
+
+ * WTF.vcxproj/WTF.vcxproj:
+ * WTF.xcodeproj/project.pbxproj:
+ * benchmarks/LockSpeedTest.cpp:
+ * wtf/CMakeLists.txt:
+ * wtf/Lock.h:
+ * wtf/SpinLock.h: Removed.
+ * wtf/WordLock.h:
+
</ins><span class="cx"> 2015-08-19 Alex Christensen <achristensen@webkit.org>
</span><span class="cx">
</span><span class="cx"> CMake Windows build should not include files directly from other Source directories
</span></span></pre></div>
<a id="trunkSourceWTFWTFvcxprojWTFvcxproj"></a>
<div class="modfile"><h4>Modified: trunk/Source/WTF/WTF.vcxproj/WTF.vcxproj (188676 => 188677)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WTF/WTF.vcxproj/WTF.vcxproj        2015-08-20 02:15:39 UTC (rev 188676)
+++ trunk/Source/WTF/WTF.vcxproj/WTF.vcxproj        2015-08-20 02:34:02 UTC (rev 188677)
</span><span class="lines">@@ -271,7 +271,6 @@
</span><span class="cx"> <ClInclude Include="..\wtf\SHA1.h" />
</span><span class="cx"> <ClInclude Include="..\wtf\SinglyLinkedList.h" />
</span><span class="cx"> <ClInclude Include="..\wtf\SixCharacterHash.h" />
</span><del>- <ClInclude Include="..\wtf\SpinLock.h" />
</del><span class="cx"> <ClInclude Include="..\wtf\StackBounds.h" />
</span><span class="cx"> <ClInclude Include="..\wtf\StaticConstructors.h" />
</span><span class="cx"> <ClInclude Include="..\wtf\StdLibExtras.h" />
</span></span></pre></div>
<a id="trunkSourceWTFWTFxcodeprojprojectpbxproj"></a>
<div class="modfile"><h4>Modified: trunk/Source/WTF/WTF.xcodeproj/project.pbxproj (188676 => 188677)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WTF/WTF.xcodeproj/project.pbxproj        2015-08-20 02:15:39 UTC (rev 188676)
+++ trunk/Source/WTF/WTF.xcodeproj/project.pbxproj        2015-08-20 02:34:02 UTC (rev 188677)
</span><span class="lines">@@ -167,7 +167,6 @@
</span><span class="cx">                 A8A473C9151A825B004123FF /* Functional.h in Headers */ = {isa = PBXBuildFile; fileRef = A8A472A7151A825A004123FF /* Functional.h */; };
</span><span class="cx">                 A8A473CA151A825B004123FF /* GetPtr.h in Headers */ = {isa = PBXBuildFile; fileRef = A8A472A8151A825A004123FF /* GetPtr.h */; };
</span><span class="cx">                 A8A473D3151A825B004123FF /* HashCountedSet.h in Headers */ = {isa = PBXBuildFile; fileRef = A8A472B3151A825A004123FF /* HashCountedSet.h */; };
</span><del>-                A8A4742D151A825B004123FF /* Hasher.h in Headers */ = {isa = PBXBuildFile; fileRef = A8A47314151A825B004123FF /* Hasher.h */; };
</del><span class="cx">                 A8A473D4151A825B004123FF /* HashFunctions.h in Headers */ = {isa = PBXBuildFile; fileRef = A8A472B4151A825A004123FF /* HashFunctions.h */; };
</span><span class="cx">                 A8A473D5151A825B004123FF /* HashIterators.h in Headers */ = {isa = PBXBuildFile; fileRef = A8A472B5151A825A004123FF /* HashIterators.h */; };
</span><span class="cx">                 A8A473D6151A825B004123FF /* HashMap.h in Headers */ = {isa = PBXBuildFile; fileRef = A8A472B6151A825A004123FF /* HashMap.h */; };
</span><span class="lines">@@ -227,6 +226,7 @@
</span><span class="cx">                 A8A47429151A825B004123FF /* StaticConstructors.h in Headers */ = {isa = PBXBuildFile; fileRef = A8A47310151A825B004123FF /* StaticConstructors.h */; };
</span><span class="cx">                 A8A4742A151A825B004123FF /* StdLibExtras.h in Headers */ = {isa = PBXBuildFile; fileRef = A8A47311151A825B004123FF /* StdLibExtras.h */; };
</span><span class="cx">                 A8A4742C151A825B004123FF /* StringExtras.h in Headers */ = {isa = PBXBuildFile; fileRef = A8A47313151A825B004123FF /* StringExtras.h */; };
</span><ins>+                A8A4742D151A825B004123FF /* Hasher.h in Headers */ = {isa = PBXBuildFile; fileRef = A8A47314151A825B004123FF /* Hasher.h */; };
</ins><span class="cx">                 A8A47433151A825B004123FF /* TemporaryChange.h in Headers */ = {isa = PBXBuildFile; fileRef = A8A4731A151A825B004123FF /* TemporaryChange.h */; };
</span><span class="cx">                 A8A47434151A825B004123FF /* ASCIIFastPath.h in Headers */ = {isa = PBXBuildFile; fileRef = A8A4731C151A825B004123FF /* ASCIIFastPath.h */; };
</span><span class="cx">                 A8A47435151A825B004123FF /* AtomicString.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A8A4731D151A825B004123FF /* AtomicString.cpp */; };
</span><span class="lines">@@ -285,7 +285,6 @@
</span><span class="cx">                 E4A0AD3D1A96253C00536DF6 /* WorkQueueCocoa.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E4A0AD3C1A96253C00536DF6 /* WorkQueueCocoa.cpp */; };
</span><span class="cx">                 EB95E1F0161A72410089A2F5 /* ByteOrder.h in Headers */ = {isa = PBXBuildFile; fileRef = EB95E1EF161A72410089A2F5 /* ByteOrder.h */; };
</span><span class="cx">                 FE8225311B2A1E5B00BA68FD /* NakedPtr.h in Headers */ = {isa = PBXBuildFile; fileRef = FE8225301B2A1E5B00BA68FD /* NakedPtr.h */; };
</span><del>-                FE91E8811AB2A0200099895F /* SpinLock.h in Headers */ = {isa = PBXBuildFile; fileRef = FE91E8801AB2A0200099895F /* SpinLock.h */; };
</del><span class="cx">                 FEDACD3D1630F83F00C69634 /* StackStats.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FEDACD3B1630F83F00C69634 /* StackStats.cpp */; };
</span><span class="cx">                 FEDACD3E1630F83F00C69634 /* StackStats.h in Headers */ = {isa = PBXBuildFile; fileRef = FEDACD3C1630F83F00C69634 /* StackStats.h */; };
</span><span class="cx"> /* End PBXBuildFile section */
</span><span class="lines">@@ -465,7 +464,6 @@
</span><span class="cx">                 A8A472A7151A825A004123FF /* Functional.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Functional.h; sourceTree = "<group>"; };
</span><span class="cx">                 A8A472A8151A825A004123FF /* GetPtr.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GetPtr.h; sourceTree = "<group>"; };
</span><span class="cx">                 A8A472B3151A825A004123FF /* HashCountedSet.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HashCountedSet.h; sourceTree = "<group>"; };
</span><del>-                A8A47314151A825B004123FF /* Hasher.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Hasher.h; sourceTree = "<group>"; };
</del><span class="cx">                 A8A472B4151A825A004123FF /* HashFunctions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HashFunctions.h; sourceTree = "<group>"; };
</span><span class="cx">                 A8A472B5151A825A004123FF /* HashIterators.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HashIterators.h; sourceTree = "<group>"; };
</span><span class="cx">                 A8A472B6151A825A004123FF /* HashMap.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HashMap.h; sourceTree = "<group>"; };
</span><span class="lines">@@ -525,6 +523,7 @@
</span><span class="cx">                 A8A47310151A825B004123FF /* StaticConstructors.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = StaticConstructors.h; sourceTree = "<group>"; };
</span><span class="cx">                 A8A47311151A825B004123FF /* StdLibExtras.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = StdLibExtras.h; sourceTree = "<group>"; };
</span><span class="cx">                 A8A47313151A825B004123FF /* StringExtras.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = StringExtras.h; sourceTree = "<group>"; };
</span><ins>+                A8A47314151A825B004123FF /* Hasher.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Hasher.h; sourceTree = "<group>"; };
</ins><span class="cx">                 A8A4731A151A825B004123FF /* TemporaryChange.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TemporaryChange.h; sourceTree = "<group>"; };
</span><span class="cx">                 A8A4731C151A825B004123FF /* ASCIIFastPath.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ASCIIFastPath.h; sourceTree = "<group>"; };
</span><span class="cx">                 A8A4731D151A825B004123FF /* AtomicString.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = AtomicString.cpp; sourceTree = "<group>"; };
</span><span class="lines">@@ -583,7 +582,6 @@
</span><span class="cx">                 E4A0AD3C1A96253C00536DF6 /* WorkQueueCocoa.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WorkQueueCocoa.cpp; sourceTree = "<group>"; };
</span><span class="cx">                 EB95E1EF161A72410089A2F5 /* ByteOrder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ByteOrder.h; sourceTree = "<group>"; };
</span><span class="cx">                 FE8225301B2A1E5B00BA68FD /* NakedPtr.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NakedPtr.h; sourceTree = "<group>"; };
</span><del>-                FE91E8801AB2A0200099895F /* SpinLock.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SpinLock.h; sourceTree = "<group>"; };
</del><span class="cx">                 FEDACD3B1630F83F00C69634 /* StackStats.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = StackStats.cpp; sourceTree = "<group>"; };
</span><span class="cx">                 FEDACD3C1630F83F00C69634 /* StackStats.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = StackStats.h; sourceTree = "<group>"; };
</span><span class="cx"> /* End PBXFileReference section */
</span><span class="lines">@@ -861,7 +859,6 @@
</span><span class="cx">                                 A748745017A0BDAE00FA04CB /* SixCharacterHash.h */,
</span><span class="cx">                                 A8A4730C151A825B004123FF /* SizeLimits.cpp */,
</span><span class="cx">                                 A8A4730D151A825B004123FF /* Spectrum.h */,
</span><del>-                                FE91E8801AB2A0200099895F /* SpinLock.h */,
</del><span class="cx">                                 A8A4730E151A825B004123FF /* StackBounds.cpp */,
</span><span class="cx">                                 A8A4730F151A825B004123FF /* StackBounds.h */,
</span><span class="cx">                                 FEDACD3B1630F83F00C69634 /* StackStats.cpp */,
</span><span class="lines">@@ -1200,7 +1197,6 @@
</span><span class="cx">                                 A8A4743D151A825B004123FF /* StringBuilder.h in Headers */,
</span><span class="cx">                                 70ECA60E1B02426800449739 /* SymbolImpl.h in Headers */,
</span><span class="cx">                                 A8A4743E151A825B004123FF /* StringConcatenate.h in Headers */,
</span><del>-                                FE91E8811AB2A0200099895F /* SpinLock.h in Headers */,
</del><span class="cx">                                 A8A4742C151A825B004123FF /* StringExtras.h in Headers */,
</span><span class="cx">                                 A8A4743F151A825B004123FF /* StringHash.h in Headers */,
</span><span class="cx">                                 FE8225311B2A1E5B00BA68FD /* NakedPtr.h in Headers */,
</span></span></pre></div>
<a id="trunkSourceWTFbenchmarksLockSpeedTestcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WTF/benchmarks/LockSpeedTest.cpp (188676 => 188677)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WTF/benchmarks/LockSpeedTest.cpp        2015-08-20 02:15:39 UTC (rev 188676)
+++ trunk/Source/WTF/benchmarks/LockSpeedTest.cpp        2015-08-20 02:34:02 UTC (rev 188677)
</span><span class="lines">@@ -31,7 +31,6 @@
</span><span class="cx"> #include <unistd.h>
</span><span class="cx"> #include <wtf/CurrentTime.h>
</span><span class="cx"> #include <wtf/Lock.h>
</span><del>-#include <wtf/SpinLock.h>
</del><span class="cx"> #include <wtf/StdLibExtras.h>
</span><span class="cx"> #include <wtf/Threading.h>
</span><span class="cx"> #include <wtf/ThreadingPrimitives.h>
</span><span class="lines">@@ -39,6 +38,35 @@
</span><span class="cx">
</span><span class="cx"> namespace {
</span><span class="cx">
</span><ins>+// This is the old WTF::SpinLock class, included here so that we can still compare our new locks to a
+// spinlock baseline.
+class SpinLock {
+public:
+ SpinLock()
+ {
+ m_lock.store(0, std::memory_order_relaxed);
+ }
+
+ void lock()
+ {
+ while (!m_lock.compareExchangeWeak(0, 1, std::memory_order_acquire))
+ std::this_thread::yield();
+ }
+
+ void unlock()
+ {
+ m_lock.store(0, std::memory_order_release);
+ }
+
+ bool isLocked() const
+ {
+ return m_lock.load(std::memory_order_acquire);
+ }
+
+private:
+ Atomic<unsigned> m_lock;
+};
+
</ins><span class="cx"> unsigned numThreadGroups;
</span><span class="cx"> unsigned numThreadsPerGroup;
</span><span class="cx"> unsigned workPerCriticalSection;
</span></span></pre></div>
<a id="trunkSourceWTFwtfCMakeListstxt"></a>
<div class="modfile"><h4>Modified: trunk/Source/WTF/wtf/CMakeLists.txt (188676 => 188677)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WTF/wtf/CMakeLists.txt        2015-08-20 02:15:39 UTC (rev 188676)
+++ trunk/Source/WTF/wtf/CMakeLists.txt        2015-08-20 02:34:02 UTC (rev 188677)
</span><span class="lines">@@ -84,7 +84,6 @@
</span><span class="cx"> SHA1.h
</span><span class="cx"> SaturatedArithmetic.h
</span><span class="cx"> SegmentedVector.h
</span><del>- SpinLock.h
</del><span class="cx"> StackBounds.h
</span><span class="cx"> StackStats.h
</span><span class="cx"> StaticConstructors.h
</span></span></pre></div>
<a id="trunkSourceWTFwtfLockh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WTF/wtf/Lock.h (188676 => 188677)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WTF/wtf/Lock.h        2015-08-20 02:15:39 UTC (rev 188676)
+++ trunk/Source/WTF/wtf/Lock.h        2015-08-20 02:34:02 UTC (rev 188677)
</span><span class="lines">@@ -38,10 +38,10 @@
</span><span class="cx"> namespace WTF {
</span><span class="cx">
</span><span class="cx"> // This is a fully adaptive mutex that only requires 1 byte of storage. It has fast paths that are
</span><del>-// competetive to SpinLock (uncontended locking is inlined and is just a CAS, microcontention is
-// handled by spinning and yielding), and a slow path that is competetive to Mutex (if a lock cannot
-// be acquired in a short period of time, the thread is put to sleep until the lock is available
-// again). It uses less memory than either SpinLock or Mutex.
</del><ins>+// competetive to a spinlock (uncontended locking is inlined and is just a CAS, microcontention is
+// handled by spinning and yielding), and a slow path that is competetive to std::mutex (if a lock
+// cannot be acquired in a short period of time, the thread is put to sleep until the lock is available
+// again). It uses less memory than a std::mutex.
</ins><span class="cx">
</span><span class="cx"> // This is a struct without a constructor or destructor so that it can be statically initialized.
</span><span class="cx"> // Use Lock in instance variables.
</span></span></pre></div>
<a id="trunkSourceWTFwtfSpinLockh"></a>
<div class="delfile"><h4>Deleted: trunk/Source/WTF/wtf/SpinLock.h (188676 => 188677)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WTF/wtf/SpinLock.h        2015-08-20 02:15:39 UTC (rev 188676)
+++ trunk/Source/WTF/wtf/SpinLock.h        2015-08-20 02:34:02 UTC (rev 188677)
</span><span class="lines">@@ -1,87 +0,0 @@
</span><del>-/*
- * Copyright (C) 2015 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef SpinLock_h
-#define SpinLock_h
-
-#include <thread>
-#include <wtf/Atomics.h>
-#include <wtf/Locker.h>
-
-namespace WTF {
-
-// SpinLock is a very simple lock implementation that has extremely fast lock/unlock for very small
-// uncontended critical sections. However, it will exhibit bad performance degradation when the lock
-// becomes contended: the thread trying to acquire the lock will simply waste CPU cycles.
-//
-// For most (all?) locking use cases, it's better to use Lock (see wtf/Lock.h). That uses only a bit
-// more memory (8 bytes instead of 4 on 64-bit), and is only a bit slower in the uncontended case
-// (Lock needs CAS to unlock, while SpinLock doesn't), but will burn a lot less CPU time - for 10
-// threads acquiring a 50 microsecond critical section, Lock will use up to 100x less kernel CPU time
-// than SpinLock.
-
-// SpinLockBase is a struct without an explicitly defined constructors so that
-// it can be initialized at compile time. See StaticSpinLock below.
-struct SpinLockBase {
-
- void lock()
- {
- while (!m_lock.compareExchangeWeak(0, 1, std::memory_order_acquire))
- std::this_thread::yield();
- }
-
- void unlock()
- {
- m_lock.store(0, std::memory_order_release);
- }
-
- bool isLocked() const
- {
- return m_lock.load(std::memory_order_acquire);
- }
-
- Atomic<unsigned> m_lock;
-};
-
-// SpinLock is for use as instance variables in structs and classes, not as
-// statics and globals.
-struct SpinLock : public SpinLockBase {
- SpinLock()
- {
- m_lock.store(0, std::memory_order_relaxed);
- }
-};
-
-// StaticSpinLock is for use as statics and globals, not as instance variables.
-typedef SpinLockBase StaticSpinLock;
-typedef Locker<SpinLockBase> SpinLockHolder;
-
-} // namespace WTF
-
-using WTF::StaticSpinLock;
-using WTF::SpinLock;
-using WTF::SpinLockHolder;
-
-#endif // SpinLock_h
</del></span></pre></div>
<a id="trunkSourceWTFwtfWordLockh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WTF/wtf/WordLock.h (188676 => 188677)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WTF/wtf/WordLock.h        2015-08-20 02:15:39 UTC (rev 188676)
+++ trunk/Source/WTF/wtf/WordLock.h        2015-08-20 02:34:02 UTC (rev 188677)
</span><span class="lines">@@ -38,8 +38,8 @@
</span><span class="cx"> namespace WTF {
</span><span class="cx">
</span><span class="cx"> // A WordLock is a fully adaptive mutex that uses sizeof(void*) storage. It has a fast path that is
</span><del>-// similar to SpinLock, and a slow path that is similar to Mutex. In most cases, you should use Lock
-// instead. WordLock sits lower in the stack and is used to implement Lock, so Lock is the main
</del><ins>+// similar to a spinlock, and a slow path that is similar to std::mutex. In most cases, you should use
+// Lock instead. WordLock sits lower in the stack and is used to implement Lock, so Lock is the main
</ins><span class="cx"> // client of WordLock.
</span><span class="cx">
</span><span class="cx"> class WordLock {
</span></span></pre>
</div>
</div>
</body>
</html>