<!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>[163752] trunk/Source/JavaScriptCore</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/163752">163752</a></dd>
<dt>Author</dt> <dd>andersca@apple.com</dd>
<dt>Date</dt> <dd>2014-02-09 10:47:28 -0800 (Sun, 09 Feb 2014)</dd>
</dl>

<h3>Log Message</h3>
<pre>Convert some JSC code over to std::mutex
https://bugs.webkit.org/show_bug.cgi?id=128500

Reviewed by Dan Bernstein.

* API/JSVirtualMachine.mm:
(wrapperCacheMutex):
(+[JSVMWrapperCache addWrapper:forJSContextGroupRef:]):
(+[JSVMWrapperCache wrapperForJSContextGroupRef:]):
* heap/GCThreadSharedData.h:
* heap/SlotVisitor.cpp:
(JSC::SlotVisitor::mergeOpaqueRoots):
* heap/SlotVisitorInlines.h:
(JSC::SlotVisitor::containsOpaqueRootTriState):
* inspector/remote/RemoteInspector.h:
* inspector/remote/RemoteInspector.mm:
(Inspector::RemoteInspector::registerDebuggable):
(Inspector::RemoteInspector::unregisterDebuggable):
(Inspector::RemoteInspector::updateDebuggable):
(Inspector::RemoteInspector::sendMessageToRemoteFrontend):
(Inspector::RemoteInspector::start):
(Inspector::RemoteInspector::stop):
(Inspector::RemoteInspector::setupXPCConnectionIfNeeded):
(Inspector::RemoteInspector::xpcConnectionReceivedMessage):
(Inspector::RemoteInspector::xpcConnectionFailed):
(Inspector::RemoteInspector::pushListingSoon):
(Inspector::RemoteInspector::receivedIndicateMessage):
* inspector/remote/RemoteInspectorDebuggableConnection.h:
* inspector/remote/RemoteInspectorDebuggableConnection.mm:
(Inspector::RemoteInspectorDebuggableConnection::setup):
(Inspector::RemoteInspectorDebuggableConnection::closeFromDebuggable):
(Inspector::RemoteInspectorDebuggableConnection::close):
(Inspector::RemoteInspectorDebuggableConnection::sendMessageToBackend):
* jit/ExecutableAllocator.cpp:
(JSC::DemandExecutableAllocator::DemandExecutableAllocator):
(JSC::DemandExecutableAllocator::~DemandExecutableAllocator):
(JSC::DemandExecutableAllocator::bytesAllocatedByAllAllocators):
(JSC::DemandExecutableAllocator::bytesCommittedByAllocactors):
(JSC::DemandExecutableAllocator::dumpProfileFromAllAllocators):
(JSC::DemandExecutableAllocator::allocatorsMutex):</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceJavaScriptCoreAPIJSVirtualMachinemm">trunk/Source/JavaScriptCore/API/JSVirtualMachine.mm</a></li>
<li><a href="#trunkSourceJavaScriptCoreChangeLog">trunk/Source/JavaScriptCore/ChangeLog</a></li>
<li><a href="#trunkSourceJavaScriptCoreheapGCThreadSharedDatah">trunk/Source/JavaScriptCore/heap/GCThreadSharedData.h</a></li>
<li><a href="#trunkSourceJavaScriptCoreheapSlotVisitorcpp">trunk/Source/JavaScriptCore/heap/SlotVisitor.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCoreheapSlotVisitorInlinesh">trunk/Source/JavaScriptCore/heap/SlotVisitorInlines.h</a></li>
<li><a href="#trunkSourceJavaScriptCoreinspectorremoteRemoteInspectorh">trunk/Source/JavaScriptCore/inspector/remote/RemoteInspector.h</a></li>
<li><a href="#trunkSourceJavaScriptCoreinspectorremoteRemoteInspectormm">trunk/Source/JavaScriptCore/inspector/remote/RemoteInspector.mm</a></li>
<li><a href="#trunkSourceJavaScriptCoreinspectorremoteRemoteInspectorDebuggableConnectionh">trunk/Source/JavaScriptCore/inspector/remote/RemoteInspectorDebuggableConnection.h</a></li>
<li><a href="#trunkSourceJavaScriptCoreinspectorremoteRemoteInspectorDebuggableConnectionmm">trunk/Source/JavaScriptCore/inspector/remote/RemoteInspectorDebuggableConnection.mm</a></li>
<li><a href="#trunkSourceJavaScriptCorejitExecutableAllocatorcpp">trunk/Source/JavaScriptCore/jit/ExecutableAllocator.cpp</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceJavaScriptCoreAPIJSVirtualMachinemm"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/API/JSVirtualMachine.mm (163751 => 163752)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/API/JSVirtualMachine.mm        2014-02-09 12:11:01 UTC (rev 163751)
+++ trunk/Source/JavaScriptCore/API/JSVirtualMachine.mm        2014-02-09 18:47:28 UTC (rev 163752)
</span><span class="lines">@@ -36,12 +36,15 @@
</span><span class="cx"> #import &quot;JSVirtualMachineInternal.h&quot;
</span><span class="cx"> #import &quot;JSWrapperMap.h&quot;
</span><span class="cx"> #import &quot;SlotVisitorInlines.h&quot;
</span><ins>+#import &lt;mutex&gt;
+#import &lt;wtf/NeverDestroyed.h&gt;
</ins><span class="cx"> 
</span><span class="cx"> static NSMapTable *globalWrapperCache = 0;
</span><span class="cx"> 
</span><del>-static Mutex&amp; wrapperCacheLock()
</del><ins>+static std::mutex&amp; wrapperCacheMutex()
</ins><span class="cx"> {
</span><del>-    DEFINE_STATIC_LOCAL(Mutex, mutex, ());
</del><ins>+    static NeverDestroyed&lt;std::mutex&gt; mutex;
+
</ins><span class="cx">     return mutex;
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -69,13 +72,13 @@
</span><span class="cx"> 
</span><span class="cx"> + (void)addWrapper:(JSVirtualMachine *)wrapper forJSContextGroupRef:(JSContextGroupRef)group
</span><span class="cx"> {
</span><del>-    MutexLocker locker(wrapperCacheLock());
</del><ins>+    std::lock_guard&lt;std::mutex&gt; lock(wrapperCacheMutex());
</ins><span class="cx">     NSMapInsert(wrapperCache(), group, wrapper);
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> + (JSVirtualMachine *)wrapperForJSContextGroupRef:(JSContextGroupRef)group
</span><span class="cx"> {
</span><del>-    MutexLocker locker(wrapperCacheLock());
</del><ins>+    std::lock_guard&lt;std::mutex&gt; lock(wrapperCacheMutex());
</ins><span class="cx">     return static_cast&lt;JSVirtualMachine *&gt;(NSMapGet(wrapperCache(), group));
</span><span class="cx"> }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/ChangeLog (163751 => 163752)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/ChangeLog        2014-02-09 12:11:01 UTC (rev 163751)
+++ trunk/Source/JavaScriptCore/ChangeLog        2014-02-09 18:47:28 UTC (rev 163752)
</span><span class="lines">@@ -1,3 +1,46 @@
</span><ins>+2014-02-09  Anders Carlsson  &lt;andersca@apple.com&gt;
+
+        Convert some JSC code over to std::mutex
+        https://bugs.webkit.org/show_bug.cgi?id=128500
+
+        Reviewed by Dan Bernstein.
+
+        * API/JSVirtualMachine.mm:
+        (wrapperCacheMutex):
+        (+[JSVMWrapperCache addWrapper:forJSContextGroupRef:]):
+        (+[JSVMWrapperCache wrapperForJSContextGroupRef:]):
+        * heap/GCThreadSharedData.h:
+        * heap/SlotVisitor.cpp:
+        (JSC::SlotVisitor::mergeOpaqueRoots):
+        * heap/SlotVisitorInlines.h:
+        (JSC::SlotVisitor::containsOpaqueRootTriState):
+        * inspector/remote/RemoteInspector.h:
+        * inspector/remote/RemoteInspector.mm:
+        (Inspector::RemoteInspector::registerDebuggable):
+        (Inspector::RemoteInspector::unregisterDebuggable):
+        (Inspector::RemoteInspector::updateDebuggable):
+        (Inspector::RemoteInspector::sendMessageToRemoteFrontend):
+        (Inspector::RemoteInspector::start):
+        (Inspector::RemoteInspector::stop):
+        (Inspector::RemoteInspector::setupXPCConnectionIfNeeded):
+        (Inspector::RemoteInspector::xpcConnectionReceivedMessage):
+        (Inspector::RemoteInspector::xpcConnectionFailed):
+        (Inspector::RemoteInspector::pushListingSoon):
+        (Inspector::RemoteInspector::receivedIndicateMessage):
+        * inspector/remote/RemoteInspectorDebuggableConnection.h:
+        * inspector/remote/RemoteInspectorDebuggableConnection.mm:
+        (Inspector::RemoteInspectorDebuggableConnection::setup):
+        (Inspector::RemoteInspectorDebuggableConnection::closeFromDebuggable):
+        (Inspector::RemoteInspectorDebuggableConnection::close):
+        (Inspector::RemoteInspectorDebuggableConnection::sendMessageToBackend):
+        * jit/ExecutableAllocator.cpp:
+        (JSC::DemandExecutableAllocator::DemandExecutableAllocator):
+        (JSC::DemandExecutableAllocator::~DemandExecutableAllocator):
+        (JSC::DemandExecutableAllocator::bytesAllocatedByAllAllocators):
+        (JSC::DemandExecutableAllocator::bytesCommittedByAllocactors):
+        (JSC::DemandExecutableAllocator::dumpProfileFromAllAllocators):
+        (JSC::DemandExecutableAllocator::allocatorsMutex):
+
</ins><span class="cx"> 2014-02-09  Commit Queue  &lt;commit-queue@webkit.org&gt;
</span><span class="cx"> 
</span><span class="cx">         Unreviewed, rolling out r163737.
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreheapGCThreadSharedDatah"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/heap/GCThreadSharedData.h (163751 => 163752)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/heap/GCThreadSharedData.h        2014-02-09 12:11:01 UTC (rev 163751)
+++ trunk/Source/JavaScriptCore/heap/GCThreadSharedData.h        2014-02-09 18:47:28 UTC (rev 163752)
</span><span class="lines">@@ -92,7 +92,7 @@
</span><span class="cx">     unsigned m_numberOfActiveParallelMarkers;
</span><span class="cx">     bool m_parallelMarkersShouldExit;
</span><span class="cx"> 
</span><del>-    Mutex m_opaqueRootsLock;
</del><ins>+    std::mutex m_opaqueRootsMutex;
</ins><span class="cx">     HashSet&lt;void*&gt; m_opaqueRoots;
</span><span class="cx"> 
</span><span class="cx">     SpinLock m_copyLock;
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreheapSlotVisitorcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/heap/SlotVisitor.cpp (163751 => 163752)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/heap/SlotVisitor.cpp        2014-02-09 12:11:01 UTC (rev 163751)
+++ trunk/Source/JavaScriptCore/heap/SlotVisitor.cpp        2014-02-09 18:47:28 UTC (rev 163752)
</span><span class="lines">@@ -240,11 +240,9 @@
</span><span class="cx">     StackStats::probe();
</span><span class="cx">     ASSERT(!m_opaqueRoots.isEmpty()); // Should only be called when opaque roots are non-empty.
</span><span class="cx">     {
</span><del>-        MutexLocker locker(m_shared.m_opaqueRootsLock);
-        HashSet&lt;void*&gt;::iterator begin = m_opaqueRoots.begin();
-        HashSet&lt;void*&gt;::iterator end = m_opaqueRoots.end();
-        for (HashSet&lt;void*&gt;::iterator iter = begin; iter != end; ++iter)
-            m_shared.m_opaqueRoots.add(*iter);
</del><ins>+        std::lock_guard&lt;std::mutex&gt; lock(m_shared.m_opaqueRootsMutex);
+        for (auto* root : m_opaqueRoots)
+            m_shared.m_opaqueRoots.add(root);
</ins><span class="cx">     }
</span><span class="cx">     m_opaqueRoots.clear();
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreheapSlotVisitorInlinesh"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/heap/SlotVisitorInlines.h (163751 => 163752)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/heap/SlotVisitorInlines.h        2014-02-09 12:11:01 UTC (rev 163751)
+++ trunk/Source/JavaScriptCore/heap/SlotVisitorInlines.h        2014-02-09 18:47:28 UTC (rev 163752)
</span><span class="lines">@@ -176,7 +176,7 @@
</span><span class="cx"> {
</span><span class="cx">     if (m_opaqueRoots.contains(root))
</span><span class="cx">         return TrueTriState;
</span><del>-    MutexLocker locker(m_shared.m_opaqueRootsLock);
</del><ins>+    std::lock_guard&lt;std::mutex&gt; lock(m_shared.m_opaqueRootsMutex);
</ins><span class="cx">     if (m_shared.m_opaqueRoots.contains(root))
</span><span class="cx">         return TrueTriState;
</span><span class="cx">     return MixedTriState;
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreinspectorremoteRemoteInspectorh"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/inspector/remote/RemoteInspector.h (163751 => 163752)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/inspector/remote/RemoteInspector.h        2014-02-09 12:11:01 UTC (rev 163751)
+++ trunk/Source/JavaScriptCore/inspector/remote/RemoteInspector.h        2014-02-09 18:47:28 UTC (rev 163752)
</span><span class="lines">@@ -31,8 +31,7 @@
</span><span class="cx"> #import &quot;RemoteInspectorXPCConnection.h&quot;
</span><span class="cx"> #import &lt;wtf/Forward.h&gt;
</span><span class="cx"> #import &lt;wtf/HashMap.h&gt;
</span><del>-#import &lt;wtf/NeverDestroyed.h&gt;
-#import &lt;wtf/Threading.h&gt;
</del><ins>+#import &lt;wtf/Forward.h&gt;
</ins><span class="cx"> 
</span><span class="cx"> OBJC_CLASS NSDictionary;
</span><span class="cx"> OBJC_CLASS NSString;
</span><span class="lines">@@ -90,7 +89,7 @@
</span><span class="cx">     // Any debuggable can send messages over the XPC connection.
</span><span class="cx">     // So lock access to all maps and state as they can change
</span><span class="cx">     // from any thread.
</span><del>-    Mutex m_lock;
</del><ins>+    std::mutex m_mutex;
</ins><span class="cx"> 
</span><span class="cx">     HashMap&lt;unsigned, std::pair&lt;RemoteInspectorDebuggable*, RemoteInspectorDebuggableInfo&gt;&gt; m_debuggableMap;
</span><span class="cx">     HashMap&lt;unsigned, RefPtr&lt;RemoteInspectorDebuggableConnection&gt;&gt; m_connectionMap;
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreinspectorremoteRemoteInspectormm"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/inspector/remote/RemoteInspector.mm (163751 => 163752)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/inspector/remote/RemoteInspector.mm        2014-02-09 12:11:01 UTC (rev 163751)
+++ trunk/Source/JavaScriptCore/inspector/remote/RemoteInspector.mm        2014-02-09 18:47:28 UTC (rev 163752)
</span><span class="lines">@@ -34,6 +34,7 @@
</span><span class="cx"> #import &quot;RemoteInspectorDebuggableConnection.h&quot;
</span><span class="cx"> #import &lt;Foundation/Foundation.h&gt;
</span><span class="cx"> #import &lt;notify.h&gt;
</span><ins>+#import &lt;wtf/NeverDestroyed.h&gt;
</ins><span class="cx"> #import &lt;wtf/Assertions.h&gt;
</span><span class="cx"> #import &lt;wtf/MainThread.h&gt;
</span><span class="cx"> #import &lt;wtf/text/WTFString.h&gt;
</span><span class="lines">@@ -100,7 +101,7 @@
</span><span class="cx"> 
</span><span class="cx"> void RemoteInspector::registerDebuggable(RemoteInspectorDebuggable* debuggable)
</span><span class="cx"> {
</span><del>-    MutexLocker locker(m_lock);
</del><ins>+    std::lock_guard&lt;std::mutex&gt; lock(m_mutex);
</ins><span class="cx"> 
</span><span class="cx">     unsigned identifier = nextAvailableIdentifier();
</span><span class="cx">     debuggable-&gt;setIdentifier(identifier);
</span><span class="lines">@@ -114,7 +115,7 @@
</span><span class="cx"> 
</span><span class="cx"> void RemoteInspector::unregisterDebuggable(RemoteInspectorDebuggable* debuggable)
</span><span class="cx"> {
</span><del>-    MutexLocker locker(m_lock);
</del><ins>+    std::lock_guard&lt;std::mutex&gt; lock(m_mutex);
</ins><span class="cx"> 
</span><span class="cx">     unsigned identifier = debuggable-&gt;identifier();
</span><span class="cx">     if (!identifier)
</span><span class="lines">@@ -132,7 +133,7 @@
</span><span class="cx"> 
</span><span class="cx"> void RemoteInspector::updateDebuggable(RemoteInspectorDebuggable* debuggable)
</span><span class="cx"> {
</span><del>-    MutexLocker locker(m_lock);
</del><ins>+    std::lock_guard&lt;std::mutex&gt; lock(m_mutex);
</ins><span class="cx"> 
</span><span class="cx">     unsigned identifier = debuggable-&gt;identifier();
</span><span class="cx">     if (!identifier)
</span><span class="lines">@@ -146,7 +147,7 @@
</span><span class="cx"> 
</span><span class="cx"> void RemoteInspector::sendMessageToRemoteFrontend(unsigned identifier, const String&amp; message)
</span><span class="cx"> {
</span><del>-    MutexLocker locker(m_lock);
</del><ins>+    std::lock_guard&lt;std::mutex&gt; lock(m_mutex);
</ins><span class="cx"> 
</span><span class="cx">     if (!m_xpcConnection)
</span><span class="cx">         return;
</span><span class="lines">@@ -166,7 +167,7 @@
</span><span class="cx"> 
</span><span class="cx"> void RemoteInspector::start()
</span><span class="cx"> {
</span><del>-    MutexLocker locker(m_lock);
</del><ins>+    std::lock_guard&lt;std::mutex&gt; lock(m_mutex);
</ins><span class="cx"> 
</span><span class="cx">     if (m_enabled)
</span><span class="cx">         return;
</span><span class="lines">@@ -182,7 +183,7 @@
</span><span class="cx"> 
</span><span class="cx"> void RemoteInspector::stop()
</span><span class="cx"> {
</span><del>-    MutexLocker locker(m_lock);
</del><ins>+    std::lock_guard&lt;std::mutex&gt; lock(m_mutex);
</ins><span class="cx"> 
</span><span class="cx">     if (!m_enabled)
</span><span class="cx">         return;
</span><span class="lines">@@ -207,7 +208,7 @@
</span><span class="cx"> 
</span><span class="cx"> void RemoteInspector::setupXPCConnectionIfNeeded()
</span><span class="cx"> {
</span><del>-    MutexLocker locker(m_lock);
</del><ins>+    std::lock_guard&lt;std::mutex&gt; lock(m_mutex);
</ins><span class="cx"> 
</span><span class="cx">     if (m_xpcConnection)
</span><span class="cx">         return;
</span><span class="lines">@@ -227,7 +228,7 @@
</span><span class="cx"> 
</span><span class="cx"> void RemoteInspector::xpcConnectionReceivedMessage(RemoteInspectorXPCConnection*, NSString *messageName, NSDictionary *userInfo)
</span><span class="cx"> {
</span><del>-    MutexLocker locker(m_lock);
</del><ins>+    std::lock_guard&lt;std::mutex&gt; lock(m_mutex);
</ins><span class="cx"> 
</span><span class="cx">     if ([messageName isEqualToString:WIRPermissionDenied]) {
</span><span class="cx">         stop();
</span><span class="lines">@@ -252,7 +253,7 @@
</span><span class="cx"> 
</span><span class="cx"> void RemoteInspector::xpcConnectionFailed(RemoteInspectorXPCConnection* connection)
</span><span class="cx"> {
</span><del>-    MutexLocker locker(m_lock);
</del><ins>+    std::lock_guard&lt;std::mutex&gt; lock(m_mutex);
</ins><span class="cx">     if (connection != m_xpcConnection)
</span><span class="cx">         return;
</span><span class="cx"> 
</span><span class="lines">@@ -350,7 +351,7 @@
</span><span class="cx"> 
</span><span class="cx">     m_pushScheduled = true;
</span><span class="cx">     dispatch_after(dispatch_time(DISPATCH_TIME_NOW, 0.02 * NSEC_PER_SEC), dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
</span><del>-        MutexLocker locker(m_lock);
</del><ins>+        std::lock_guard&lt;std::mutex&gt; lock(m_mutex);
</ins><span class="cx">         if (m_pushScheduled)
</span><span class="cx">             pushListingNow();
</span><span class="cx">     });
</span><span class="lines">@@ -467,7 +468,7 @@
</span><span class="cx">     BOOL indicateEnabled = [[userInfo objectForKey:WIRIndicateEnabledKey] boolValue];
</span><span class="cx"> 
</span><span class="cx">     dispatchAsyncOnQueueSafeForAnyDebuggable(^{
</span><del>-        MutexLocker locker(m_lock);
</del><ins>+        std::lock_guard&lt;std::mutex&gt; lock(m_mutex);
</ins><span class="cx"> 
</span><span class="cx">         auto it = m_debuggableMap.find(identifier);
</span><span class="cx">         if (it == m_debuggableMap.end())
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreinspectorremoteRemoteInspectorDebuggableConnectionh"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/inspector/remote/RemoteInspectorDebuggableConnection.h (163751 => 163752)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/inspector/remote/RemoteInspectorDebuggableConnection.h        2014-02-09 12:11:01 UTC (rev 163751)
+++ trunk/Source/JavaScriptCore/inspector/remote/RemoteInspectorDebuggableConnection.h        2014-02-09 18:47:28 UTC (rev 163752)
</span><span class="lines">@@ -31,8 +31,8 @@
</span><span class="cx"> #import &quot;InspectorFrontendChannel.h&quot;
</span><span class="cx"> #import &quot;RemoteInspectorDebuggable.h&quot;
</span><span class="cx"> #import &lt;dispatch/dispatch.h&gt;
</span><ins>+#import &lt;mutex&gt;
</ins><span class="cx"> #import &lt;wtf/RetainPtr.h&gt;
</span><del>-#import &lt;wtf/Threading.h&gt;
</del><span class="cx"> #import &lt;wtf/ThreadSafeRefCounted.h&gt;
</span><span class="cx"> 
</span><span class="cx"> OBJC_CLASS NSString;
</span><span class="lines">@@ -62,8 +62,8 @@
</span><span class="cx"> 
</span><span class="cx">     // This connection from the RemoteInspector singleton to the Debuggable
</span><span class="cx">     // can be used on multiple threads. So any access to the debuggable
</span><del>-    // itself must take this lock to ensure m_debuggable is valid.
-    Mutex m_debuggableLock;
</del><ins>+    // itself must take this mutex to ensure m_debuggable is valid.
+    std::mutex m_debuggableMutex;
</ins><span class="cx"> 
</span><span class="cx">     RemoteInspectorDebuggable* m_debuggable;
</span><span class="cx">     dispatch_queue_t m_queueForDebuggable;
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreinspectorremoteRemoteInspectorDebuggableConnectionmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/inspector/remote/RemoteInspectorDebuggableConnection.mm (163751 => 163752)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/inspector/remote/RemoteInspectorDebuggableConnection.mm        2014-02-09 12:11:01 UTC (rev 163751)
+++ trunk/Source/JavaScriptCore/inspector/remote/RemoteInspectorDebuggableConnection.mm        2014-02-09 18:47:28 UTC (rev 163752)
</span><span class="lines">@@ -94,7 +94,7 @@
</span><span class="cx"> 
</span><span class="cx"> bool RemoteInspectorDebuggableConnection::setup()
</span><span class="cx"> {
</span><del>-    MutexLocker locker(m_debuggableLock);
</del><ins>+    std::lock_guard&lt;std::mutex&gt; lock(m_debuggableMutex);
</ins><span class="cx"> 
</span><span class="cx">     if (!m_debuggable)
</span><span class="cx">         return false;
</span><span class="lines">@@ -115,7 +115,7 @@
</span><span class="cx"> 
</span><span class="cx"> void RemoteInspectorDebuggableConnection::closeFromDebuggable()
</span><span class="cx"> {
</span><del>-    MutexLocker locker(m_debuggableLock);
</del><ins>+    std::lock_guard&lt;std::mutex&gt; lock(m_debuggableMutex);
</ins><span class="cx"> 
</span><span class="cx">     m_debuggable = nullptr;
</span><span class="cx"> }
</span><span class="lines">@@ -125,7 +125,7 @@
</span><span class="cx">     ref();
</span><span class="cx">     dispatchAsyncOnDebuggable(^{
</span><span class="cx">         {
</span><del>-            MutexLocker locker(m_debuggableLock);
</del><ins>+            std::lock_guard&lt;std::mutex&gt; lock(m_debuggableMutex);
</ins><span class="cx"> 
</span><span class="cx">             if (m_debuggable) {
</span><span class="cx">                 if (m_connected)
</span><span class="lines">@@ -143,7 +143,7 @@
</span><span class="cx">     ref();
</span><span class="cx">     dispatchAsyncOnDebuggable(^{
</span><span class="cx">         {
</span><del>-            MutexLocker locker(m_debuggableLock);
</del><ins>+            std::lock_guard&lt;std::mutex&gt; lock(m_debuggableMutex);
</ins><span class="cx"> 
</span><span class="cx">             if (m_debuggable)
</span><span class="cx">                 m_debuggable-&gt;dispatchMessageFromRemoteFrontend(message);
</span></span></pre></div>
<a id="trunkSourceJavaScriptCorejitExecutableAllocatorcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/jit/ExecutableAllocator.cpp (163751 => 163752)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/jit/ExecutableAllocator.cpp        2014-02-09 12:11:01 UTC (rev 163751)
+++ trunk/Source/JavaScriptCore/jit/ExecutableAllocator.cpp        2014-02-09 18:47:28 UTC (rev 163752)
</span><span class="lines">@@ -31,6 +31,7 @@
</span><span class="cx"> #include &quot;CodeProfiling.h&quot;
</span><span class="cx"> #include &lt;wtf/HashSet.h&gt;
</span><span class="cx"> #include &lt;wtf/MetaAllocator.h&gt;
</span><ins>+#include &lt;wtf/NeverDestroyed.h&gt;
</ins><span class="cx"> #include &lt;wtf/PageReservation.h&gt;
</span><span class="cx"> #if ENABLE(ASSEMBLER_WX_EXCLUSIVE)
</span><span class="cx"> #include &lt;wtf/PassOwnPtr.h&gt;
</span><span class="lines">@@ -57,7 +58,7 @@
</span><span class="cx">     DemandExecutableAllocator()
</span><span class="cx">         : MetaAllocator(jitAllocationGranule)
</span><span class="cx">     {
</span><del>-        MutexLocker lock(allocatorsMutex());
</del><ins>+        std::lock_guard&lt;std::mutex&gt; lock(allocatorsMutex());
</ins><span class="cx">         allocators().add(this);
</span><span class="cx">         // Don't preallocate any memory here.
</span><span class="cx">     }
</span><span class="lines">@@ -65,7 +66,7 @@
</span><span class="cx">     virtual ~DemandExecutableAllocator()
</span><span class="cx">     {
</span><span class="cx">         {
</span><del>-            MutexLocker lock(allocatorsMutex());
</del><ins>+            std::lock_guard&lt;std::mutex&gt; lock(allocatorsMutex());
</ins><span class="cx">             allocators().remove(this);
</span><span class="cx">         }
</span><span class="cx">         for (unsigned i = 0; i &lt; reservations.size(); ++i)
</span><span class="lines">@@ -75,7 +76,7 @@
</span><span class="cx">     static size_t bytesAllocatedByAllAllocators()
</span><span class="cx">     {
</span><span class="cx">         size_t total = 0;
</span><del>-        MutexLocker lock(allocatorsMutex());
</del><ins>+        std::lock_guard&lt;std::mutex&gt; lock(allocatorsMutex());
</ins><span class="cx">         for (HashSet&lt;DemandExecutableAllocator*&gt;::const_iterator allocator = allocators().begin(); allocator != allocators().end(); ++allocator)
</span><span class="cx">             total += (*allocator)-&gt;bytesAllocated();
</span><span class="cx">         return total;
</span><span class="lines">@@ -84,7 +85,7 @@
</span><span class="cx">     static size_t bytesCommittedByAllocactors()
</span><span class="cx">     {
</span><span class="cx">         size_t total = 0;
</span><del>-        MutexLocker lock(allocatorsMutex());
</del><ins>+        std::lock_guard&lt;std::mutex&gt; lock(allocatorsMutex());
</ins><span class="cx">         for (HashSet&lt;DemandExecutableAllocator*&gt;::const_iterator allocator = allocators().begin(); allocator != allocators().end(); ++allocator)
</span><span class="cx">             total += (*allocator)-&gt;bytesCommitted();
</span><span class="cx">         return total;
</span><span class="lines">@@ -93,7 +94,7 @@
</span><span class="cx"> #if ENABLE(META_ALLOCATOR_PROFILE)
</span><span class="cx">     static void dumpProfileFromAllAllocators()
</span><span class="cx">     {
</span><del>-        MutexLocker lock(allocatorsMutex());
</del><ins>+        std::lock_guard&lt;std::mutex&gt; lock(allocatorsMutex());
</ins><span class="cx">         for (HashSet&lt;DemandExecutableAllocator*&gt;::const_iterator allocator = allocators().begin(); allocator != allocators().end(); ++allocator)
</span><span class="cx">             (*allocator)-&gt;dumpProfile();
</span><span class="cx">     }
</span><span class="lines">@@ -138,9 +139,11 @@
</span><span class="cx">         DEFINE_STATIC_LOCAL(HashSet&lt;DemandExecutableAllocator*&gt;, sAllocators, ());
</span><span class="cx">         return sAllocators;
</span><span class="cx">     }
</span><del>-    static Mutex&amp; allocatorsMutex()
</del><ins>+
+    static std::mutex&amp; allocatorsMutex()
</ins><span class="cx">     {
</span><del>-        DEFINE_STATIC_LOCAL(Mutex, mutex, ());
</del><ins>+        static NeverDestroyed&lt;std::mutex&gt; mutex;
+
</ins><span class="cx">         return mutex;
</span><span class="cx">     }
</span><span class="cx"> };
</span></span></pre>
</div>
</div>

</body>
</html>