<!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>[188499] 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/188499">188499</a></dd>
<dt>Author</dt> <dd>fpizlo@apple.com</dd>
<dt>Date</dt> <dd>2015-08-14 17:14:52 -0700 (Fri, 14 Aug 2015)</dd>
</dl>
<h3>Log Message</h3>
<pre>Use WTF::Lock and WTF::Condition instead of WTF::Mutex, WTF::ThreadCondition, std::mutex, and std::condition_variable
https://bugs.webkit.org/show_bug.cgi?id=147999
Reviewed by Geoffrey Garen.
Source/JavaScriptCore:
* API/JSVirtualMachine.mm:
(initWrapperCache):
(+[JSVMWrapperCache addWrapper:forJSContextGroupRef:]):
(+[JSVMWrapperCache wrapperForJSContextGroupRef:]):
(wrapperCacheMutex): Deleted.
* bytecode/SamplingTool.cpp:
(JSC::SamplingTool::doRun):
(JSC::SamplingTool::notifyOfScope):
* bytecode/SamplingTool.h:
* dfg/DFGThreadData.h:
* dfg/DFGWorklist.cpp:
(JSC::DFG::Worklist::~Worklist):
(JSC::DFG::Worklist::isActiveForVM):
(JSC::DFG::Worklist::enqueue):
(JSC::DFG::Worklist::compilationState):
(JSC::DFG::Worklist::waitUntilAllPlansForVMAreReady):
(JSC::DFG::Worklist::removeAllReadyPlansForVM):
(JSC::DFG::Worklist::completeAllReadyPlansForVM):
(JSC::DFG::Worklist::visitWeakReferences):
(JSC::DFG::Worklist::removeDeadPlans):
(JSC::DFG::Worklist::queueLength):
(JSC::DFG::Worklist::dump):
(JSC::DFG::Worklist::runThread):
* dfg/DFGWorklist.h:
* disassembler/Disassembler.cpp:
* heap/CopiedSpace.cpp:
(JSC::CopiedSpace::doneFillingBlock):
(JSC::CopiedSpace::doneCopying):
* heap/CopiedSpace.h:
* heap/CopiedSpaceInlines.h:
(JSC::CopiedSpace::recycleBorrowedBlock):
(JSC::CopiedSpace::allocateBlockForCopyingPhase):
* heap/GCThread.cpp:
(JSC::GCThread::waitForNextPhase):
(JSC::GCThread::gcThreadMain):
* heap/GCThreadSharedData.cpp:
(JSC::GCThreadSharedData::GCThreadSharedData):
(JSC::GCThreadSharedData::~GCThreadSharedData):
(JSC::GCThreadSharedData::startNextPhase):
(JSC::GCThreadSharedData::endCurrentPhase):
(JSC::GCThreadSharedData::didStartMarking):
(JSC::GCThreadSharedData::didFinishMarking):
* heap/GCThreadSharedData.h:
* heap/HeapTimer.h:
* heap/MachineStackMarker.cpp:
(JSC::ActiveMachineThreadsManager::Locker::Locker):
(JSC::ActiveMachineThreadsManager::add):
(JSC::ActiveMachineThreadsManager::remove):
(JSC::ActiveMachineThreadsManager::ActiveMachineThreadsManager):
(JSC::MachineThreads::~MachineThreads):
(JSC::MachineThreads::addCurrentThread):
(JSC::MachineThreads::removeThreadIfFound):
(JSC::MachineThreads::tryCopyOtherThreadStack):
(JSC::MachineThreads::tryCopyOtherThreadStacks):
(JSC::MachineThreads::gatherConservativeRoots):
* heap/MachineStackMarker.h:
* heap/SlotVisitor.cpp:
(JSC::SlotVisitor::donateKnownParallel):
(JSC::SlotVisitor::drain):
(JSC::SlotVisitor::drainFromShared):
(JSC::SlotVisitor::mergeOpaqueRoots):
* heap/SlotVisitorInlines.h:
(JSC::SlotVisitor::containsOpaqueRootTriState):
* inspector/remote/RemoteInspectorDebuggableConnection.h:
* inspector/remote/RemoteInspectorDebuggableConnection.mm:
(Inspector::RemoteInspectorHandleRunSourceGlobal):
(Inspector::RemoteInspectorQueueTaskOnGlobalQueue):
(Inspector::RemoteInspectorInitializeGlobalQueue):
(Inspector::RemoteInspectorHandleRunSourceWithInfo):
(Inspector::RemoteInspectorDebuggableConnection::setup):
(Inspector::RemoteInspectorDebuggableConnection::closeFromDebuggable):
(Inspector::RemoteInspectorDebuggableConnection::close):
(Inspector::RemoteInspectorDebuggableConnection::sendMessageToBackend):
(Inspector::RemoteInspectorDebuggableConnection::queueTaskOnPrivateRunLoop):
* interpreter/JSStack.cpp:
(JSC::JSStack::JSStack):
(JSC::JSStack::releaseExcessCapacity):
(JSC::JSStack::addToCommittedByteCount):
(JSC::JSStack::committedByteCount):
(JSC::stackStatisticsMutex): Deleted.
(JSC::JSStack::initializeThreading): Deleted.
* interpreter/JSStack.h:
(JSC::JSStack::gatherConservativeRoots):
(JSC::JSStack::sanitizeStack):
(JSC::JSStack::size):
(JSC::JSStack::initializeThreading): Deleted.
* jit/ExecutableAllocator.cpp:
(JSC::DemandExecutableAllocator::DemandExecutableAllocator):
(JSC::DemandExecutableAllocator::~DemandExecutableAllocator):
(JSC::DemandExecutableAllocator::bytesAllocatedByAllAllocators):
(JSC::DemandExecutableAllocator::bytesCommittedByAllocactors):
(JSC::DemandExecutableAllocator::dumpProfileFromAllAllocators):
(JSC::DemandExecutableAllocator::allocators):
(JSC::DemandExecutableAllocator::allocatorsMutex):
* jit/JITThunks.cpp:
(JSC::JITThunks::ctiStub):
* jit/JITThunks.h:
* profiler/ProfilerDatabase.cpp:
(JSC::Profiler::Database::ensureBytecodesFor):
(JSC::Profiler::Database::notifyDestruction):
* profiler/ProfilerDatabase.h:
* runtime/InitializeThreading.cpp:
(JSC::initializeThreading):
* runtime/JSLock.cpp:
(JSC::GlobalJSLock::GlobalJSLock):
(JSC::GlobalJSLock::~GlobalJSLock):
(JSC::JSLockHolder::JSLockHolder):
(JSC::GlobalJSLock::initialize): Deleted.
* runtime/JSLock.h:
Source/WTF:
Relanding after fixing a deadlock on Linux.
* wtf/Condition.h: "using WTF::Condition".
* wtf/Lock.h:
(WTF::LockBase::lock):
(WTF::LockBase::tryLock): Add tryLock() because it turns out that we use it sometimes.
(WTF::LockBase::try_lock): unique_lock needs this.
(WTF::LockBase::unlock):
* wtf/ParkingLot.cpp:
(WTF::ParkingLot::parkConditionally): Work around a Linux C++ bug where wait_until with time_point::max() immediately returns and doesn't flash the lock.</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="#trunkSourceJavaScriptCorebytecodeSamplingToolcpp">trunk/Source/JavaScriptCore/bytecode/SamplingTool.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCorebytecodeSamplingToolh">trunk/Source/JavaScriptCore/bytecode/SamplingTool.h</a></li>
<li><a href="#trunkSourceJavaScriptCoredfgDFGThreadDatah">trunk/Source/JavaScriptCore/dfg/DFGThreadData.h</a></li>
<li><a href="#trunkSourceJavaScriptCoredfgDFGWorklistcpp">trunk/Source/JavaScriptCore/dfg/DFGWorklist.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCoredfgDFGWorklisth">trunk/Source/JavaScriptCore/dfg/DFGWorklist.h</a></li>
<li><a href="#trunkSourceJavaScriptCoredisassemblerDisassemblercpp">trunk/Source/JavaScriptCore/disassembler/Disassembler.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCoreheapCopiedSpacecpp">trunk/Source/JavaScriptCore/heap/CopiedSpace.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCoreheapCopiedSpaceh">trunk/Source/JavaScriptCore/heap/CopiedSpace.h</a></li>
<li><a href="#trunkSourceJavaScriptCoreheapCopiedSpaceInlinesh">trunk/Source/JavaScriptCore/heap/CopiedSpaceInlines.h</a></li>
<li><a href="#trunkSourceJavaScriptCoreheapGCThreadcpp">trunk/Source/JavaScriptCore/heap/GCThread.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCoreheapGCThreadSharedDatacpp">trunk/Source/JavaScriptCore/heap/GCThreadSharedData.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCoreheapGCThreadSharedDatah">trunk/Source/JavaScriptCore/heap/GCThreadSharedData.h</a></li>
<li><a href="#trunkSourceJavaScriptCoreheapHeapTimerh">trunk/Source/JavaScriptCore/heap/HeapTimer.h</a></li>
<li><a href="#trunkSourceJavaScriptCoreheapMachineStackMarkercpp">trunk/Source/JavaScriptCore/heap/MachineStackMarker.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCoreheapMachineStackMarkerh">trunk/Source/JavaScriptCore/heap/MachineStackMarker.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="#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="#trunkSourceJavaScriptCoreinterpreterJSStackcpp">trunk/Source/JavaScriptCore/interpreter/JSStack.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCoreinterpreterJSStackh">trunk/Source/JavaScriptCore/interpreter/JSStack.h</a></li>
<li><a href="#trunkSourceJavaScriptCorejitExecutableAllocatorcpp">trunk/Source/JavaScriptCore/jit/ExecutableAllocator.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCorejitJITThunkscpp">trunk/Source/JavaScriptCore/jit/JITThunks.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCorejitJITThunksh">trunk/Source/JavaScriptCore/jit/JITThunks.h</a></li>
<li><a href="#trunkSourceJavaScriptCoreprofilerProfilerDatabasecpp">trunk/Source/JavaScriptCore/profiler/ProfilerDatabase.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCoreprofilerProfilerDatabaseh">trunk/Source/JavaScriptCore/profiler/ProfilerDatabase.h</a></li>
<li><a href="#trunkSourceJavaScriptCoreruntimeInitializeThreadingcpp">trunk/Source/JavaScriptCore/runtime/InitializeThreading.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCoreruntimeJSLockcpp">trunk/Source/JavaScriptCore/runtime/JSLock.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCoreruntimeJSLockh">trunk/Source/JavaScriptCore/runtime/JSLock.h</a></li>
<li><a href="#trunkSourceWTFChangeLog">trunk/Source/WTF/ChangeLog</a></li>
<li><a href="#trunkSourceWTFwtfConditionh">trunk/Source/WTF/wtf/Condition.h</a></li>
<li><a href="#trunkSourceWTFwtfLockh">trunk/Source/WTF/wtf/Lock.h</a></li>
<li><a href="#trunkSourceWTFwtfParkingLotcpp">trunk/Source/WTF/wtf/ParkingLot.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 (188498 => 188499)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/API/JSVirtualMachine.mm        2015-08-14 23:50:25 UTC (rev 188498)
+++ trunk/Source/JavaScriptCore/API/JSVirtualMachine.mm        2015-08-15 00:14:52 UTC (rev 188499)
</span><span class="lines">@@ -1,5 +1,5 @@
</span><span class="cx"> /*
</span><del>- * Copyright (C) 2013 Apple Inc. All rights reserved.
</del><ins>+ * Copyright (C) 2013, 2015 Apple Inc. All rights reserved.
</ins><span class="cx"> *
</span><span class="cx"> * Redistribution and use in source and binary forms, with or without
</span><span class="cx"> * modification, are permitted provided that the following conditions
</span><span class="lines">@@ -36,18 +36,14 @@
</span><span class="cx"> #import "JSWrapperMap.h"
</span><span class="cx"> #import "SlotVisitorInlines.h"
</span><span class="cx"> #import <mutex>
</span><ins>+#import <wtf/Lock.h>
</ins><span class="cx"> #import <wtf/NeverDestroyed.h>
</span><span class="cx"> #import <wtf/spi/cocoa/NSMapTableSPI.h>
</span><span class="cx">
</span><span class="cx"> static NSMapTable *globalWrapperCache = 0;
</span><span class="cx">
</span><del>-static std::mutex& wrapperCacheMutex()
-{
- static NeverDestroyed<std::mutex> mutex;
</del><ins>+static StaticLock wrapperCacheMutex;
</ins><span class="cx">
</span><del>- return mutex;
-}
-
</del><span class="cx"> static void initWrapperCache()
</span><span class="cx"> {
</span><span class="cx"> ASSERT(!globalWrapperCache);
</span><span class="lines">@@ -72,13 +68,13 @@
</span><span class="cx">
</span><span class="cx"> + (void)addWrapper:(JSVirtualMachine *)wrapper forJSContextGroupRef:(JSContextGroupRef)group
</span><span class="cx"> {
</span><del>- std::lock_guard<std::mutex> lock(wrapperCacheMutex());
</del><ins>+ std::lock_guard<StaticLock> 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>- std::lock_guard<std::mutex> lock(wrapperCacheMutex());
</del><ins>+ std::lock_guard<StaticLock> lock(wrapperCacheMutex);
</ins><span class="cx"> return static_cast<JSVirtualMachine *>(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 (188498 => 188499)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/ChangeLog        2015-08-14 23:50:25 UTC (rev 188498)
+++ trunk/Source/JavaScriptCore/ChangeLog        2015-08-15 00:14:52 UTC (rev 188499)
</span><span class="lines">@@ -1,3 +1,120 @@
</span><ins>+2015-08-14 Filip Pizlo <fpizlo@apple.com>
+
+ Use WTF::Lock and WTF::Condition instead of WTF::Mutex, WTF::ThreadCondition, std::mutex, and std::condition_variable
+ https://bugs.webkit.org/show_bug.cgi?id=147999
+
+ Reviewed by Geoffrey Garen.
+
+ * API/JSVirtualMachine.mm:
+ (initWrapperCache):
+ (+[JSVMWrapperCache addWrapper:forJSContextGroupRef:]):
+ (+[JSVMWrapperCache wrapperForJSContextGroupRef:]):
+ (wrapperCacheMutex): Deleted.
+ * bytecode/SamplingTool.cpp:
+ (JSC::SamplingTool::doRun):
+ (JSC::SamplingTool::notifyOfScope):
+ * bytecode/SamplingTool.h:
+ * dfg/DFGThreadData.h:
+ * dfg/DFGWorklist.cpp:
+ (JSC::DFG::Worklist::~Worklist):
+ (JSC::DFG::Worklist::isActiveForVM):
+ (JSC::DFG::Worklist::enqueue):
+ (JSC::DFG::Worklist::compilationState):
+ (JSC::DFG::Worklist::waitUntilAllPlansForVMAreReady):
+ (JSC::DFG::Worklist::removeAllReadyPlansForVM):
+ (JSC::DFG::Worklist::completeAllReadyPlansForVM):
+ (JSC::DFG::Worklist::visitWeakReferences):
+ (JSC::DFG::Worklist::removeDeadPlans):
+ (JSC::DFG::Worklist::queueLength):
+ (JSC::DFG::Worklist::dump):
+ (JSC::DFG::Worklist::runThread):
+ * dfg/DFGWorklist.h:
+ * disassembler/Disassembler.cpp:
+ * heap/CopiedSpace.cpp:
+ (JSC::CopiedSpace::doneFillingBlock):
+ (JSC::CopiedSpace::doneCopying):
+ * heap/CopiedSpace.h:
+ * heap/CopiedSpaceInlines.h:
+ (JSC::CopiedSpace::recycleBorrowedBlock):
+ (JSC::CopiedSpace::allocateBlockForCopyingPhase):
+ * heap/GCThread.cpp:
+ (JSC::GCThread::waitForNextPhase):
+ (JSC::GCThread::gcThreadMain):
+ * heap/GCThreadSharedData.cpp:
+ (JSC::GCThreadSharedData::GCThreadSharedData):
+ (JSC::GCThreadSharedData::~GCThreadSharedData):
+ (JSC::GCThreadSharedData::startNextPhase):
+ (JSC::GCThreadSharedData::endCurrentPhase):
+ (JSC::GCThreadSharedData::didStartMarking):
+ (JSC::GCThreadSharedData::didFinishMarking):
+ * heap/GCThreadSharedData.h:
+ * heap/HeapTimer.h:
+ * heap/MachineStackMarker.cpp:
+ (JSC::ActiveMachineThreadsManager::Locker::Locker):
+ (JSC::ActiveMachineThreadsManager::add):
+ (JSC::ActiveMachineThreadsManager::remove):
+ (JSC::ActiveMachineThreadsManager::ActiveMachineThreadsManager):
+ (JSC::MachineThreads::~MachineThreads):
+ (JSC::MachineThreads::addCurrentThread):
+ (JSC::MachineThreads::removeThreadIfFound):
+ (JSC::MachineThreads::tryCopyOtherThreadStack):
+ (JSC::MachineThreads::tryCopyOtherThreadStacks):
+ (JSC::MachineThreads::gatherConservativeRoots):
+ * heap/MachineStackMarker.h:
+ * heap/SlotVisitor.cpp:
+ (JSC::SlotVisitor::donateKnownParallel):
+ (JSC::SlotVisitor::drain):
+ (JSC::SlotVisitor::drainFromShared):
+ (JSC::SlotVisitor::mergeOpaqueRoots):
+ * heap/SlotVisitorInlines.h:
+ (JSC::SlotVisitor::containsOpaqueRootTriState):
+ * inspector/remote/RemoteInspectorDebuggableConnection.h:
+ * inspector/remote/RemoteInspectorDebuggableConnection.mm:
+ (Inspector::RemoteInspectorHandleRunSourceGlobal):
+ (Inspector::RemoteInspectorQueueTaskOnGlobalQueue):
+ (Inspector::RemoteInspectorInitializeGlobalQueue):
+ (Inspector::RemoteInspectorHandleRunSourceWithInfo):
+ (Inspector::RemoteInspectorDebuggableConnection::setup):
+ (Inspector::RemoteInspectorDebuggableConnection::closeFromDebuggable):
+ (Inspector::RemoteInspectorDebuggableConnection::close):
+ (Inspector::RemoteInspectorDebuggableConnection::sendMessageToBackend):
+ (Inspector::RemoteInspectorDebuggableConnection::queueTaskOnPrivateRunLoop):
+ * interpreter/JSStack.cpp:
+ (JSC::JSStack::JSStack):
+ (JSC::JSStack::releaseExcessCapacity):
+ (JSC::JSStack::addToCommittedByteCount):
+ (JSC::JSStack::committedByteCount):
+ (JSC::stackStatisticsMutex): Deleted.
+ (JSC::JSStack::initializeThreading): Deleted.
+ * interpreter/JSStack.h:
+ (JSC::JSStack::gatherConservativeRoots):
+ (JSC::JSStack::sanitizeStack):
+ (JSC::JSStack::size):
+ (JSC::JSStack::initializeThreading): Deleted.
+ * jit/ExecutableAllocator.cpp:
+ (JSC::DemandExecutableAllocator::DemandExecutableAllocator):
+ (JSC::DemandExecutableAllocator::~DemandExecutableAllocator):
+ (JSC::DemandExecutableAllocator::bytesAllocatedByAllAllocators):
+ (JSC::DemandExecutableAllocator::bytesCommittedByAllocactors):
+ (JSC::DemandExecutableAllocator::dumpProfileFromAllAllocators):
+ (JSC::DemandExecutableAllocator::allocators):
+ (JSC::DemandExecutableAllocator::allocatorsMutex):
+ * jit/JITThunks.cpp:
+ (JSC::JITThunks::ctiStub):
+ * jit/JITThunks.h:
+ * profiler/ProfilerDatabase.cpp:
+ (JSC::Profiler::Database::ensureBytecodesFor):
+ (JSC::Profiler::Database::notifyDestruction):
+ * profiler/ProfilerDatabase.h:
+ * runtime/InitializeThreading.cpp:
+ (JSC::initializeThreading):
+ * runtime/JSLock.cpp:
+ (JSC::GlobalJSLock::GlobalJSLock):
+ (JSC::GlobalJSLock::~GlobalJSLock):
+ (JSC::JSLockHolder::JSLockHolder):
+ (JSC::GlobalJSLock::initialize): Deleted.
+ * runtime/JSLock.h:
+
</ins><span class="cx"> 2015-08-14 Ryosuke Niwa <rniwa@webkit.org>
</span><span class="cx">
</span><span class="cx"> ES6 class syntax should allow computed name method
</span></span></pre></div>
<a id="trunkSourceJavaScriptCorebytecodeSamplingToolcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/bytecode/SamplingTool.cpp (188498 => 188499)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/bytecode/SamplingTool.cpp        2015-08-14 23:50:25 UTC (rev 188498)
+++ trunk/Source/JavaScriptCore/bytecode/SamplingTool.cpp        2015-08-15 00:14:52 UTC (rev 188499)
</span><span class="lines">@@ -1,5 +1,5 @@
</span><span class="cx"> /*
</span><del>- * Copyright (C) 2008, 2009 Apple Inc. All rights reserved.
</del><ins>+ * Copyright (C) 2008, 2009, 2015 Apple Inc. All rights reserved.
</ins><span class="cx"> *
</span><span class="cx"> * Redistribution and use in source and binary forms, with or without
</span><span class="cx"> * modification, are permitted provided that the following conditions
</span><span class="lines">@@ -285,7 +285,7 @@
</span><span class="cx">
</span><span class="cx"> #if ENABLE(CODEBLOCK_SAMPLING)
</span><span class="cx"> if (CodeBlock* codeBlock = sample.codeBlock()) {
</span><del>- MutexLocker locker(m_scriptSampleMapMutex);
</del><ins>+ LockHolder locker(m_scriptSampleMapMutex);
</ins><span class="cx"> ScriptSampleRecord* record = m_scopeSampleMap->get(codeBlock->ownerExecutable());
</span><span class="cx"> ASSERT(record);
</span><span class="cx"> record->sample(codeBlock, sample.vPC());
</span><span class="lines">@@ -301,7 +301,7 @@
</span><span class="cx"> void SamplingTool::notifyOfScope(VM& vm, ScriptExecutable* script)
</span><span class="cx"> {
</span><span class="cx"> #if ENABLE(CODEBLOCK_SAMPLING)
</span><del>- MutexLocker locker(m_scriptSampleMapMutex);
</del><ins>+ LockHolder locker(m_scriptSampleMapMutex);
</ins><span class="cx"> m_scopeSampleMap->set(script, adoptPtr(new ScriptSampleRecord(vm, script)));
</span><span class="cx"> #else
</span><span class="cx"> UNUSED_PARAM(vm);
</span></span></pre></div>
<a id="trunkSourceJavaScriptCorebytecodeSamplingToolh"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/bytecode/SamplingTool.h (188498 => 188499)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/bytecode/SamplingTool.h        2015-08-14 23:50:25 UTC (rev 188498)
+++ trunk/Source/JavaScriptCore/bytecode/SamplingTool.h        2015-08-15 00:14:52 UTC (rev 188499)
</span><span class="lines">@@ -1,5 +1,5 @@
</span><span class="cx"> /*
</span><del>- * Copyright (C) 2008, 2013 Apple Inc. All rights reserved.
</del><ins>+ * Copyright (C) 2008, 2013, 2015 Apple Inc. All rights reserved.
</ins><span class="cx"> *
</span><span class="cx"> * Redistribution and use in source and binary forms, with or without
</span><span class="cx"> * modification, are permitted provided that the following conditions
</span><span class="lines">@@ -35,6 +35,7 @@
</span><span class="cx"> #include <wtf/Assertions.h>
</span><span class="cx"> #include <wtf/Atomics.h>
</span><span class="cx"> #include <wtf/HashMap.h>
</span><ins>+#include <wtf/Lock.h>
</ins><span class="cx"> #include <wtf/MainThread.h>
</span><span class="cx"> #include <wtf/Spectrum.h>
</span><span class="cx"> #include <wtf/Threading.h>
</span><span class="lines">@@ -338,7 +339,7 @@
</span><span class="cx"> unsigned m_opcodeSamplesInCTIFunctions[numOpcodeIDs];
</span><span class="cx">
</span><span class="cx"> #if ENABLE(CODEBLOCK_SAMPLING)
</span><del>- Mutex m_scriptSampleMapMutex;
</del><ins>+ Lock m_scriptSampleMapMutex;
</ins><span class="cx"> std::unique_ptr<ScriptSampleRecordMap> m_scopeSampleMap;
</span><span class="cx"> #endif
</span><span class="cx"> };
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoredfgDFGThreadDatah"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/dfg/DFGThreadData.h (188498 => 188499)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/dfg/DFGThreadData.h        2015-08-14 23:50:25 UTC (rev 188498)
+++ trunk/Source/JavaScriptCore/dfg/DFGThreadData.h        2015-08-15 00:14:52 UTC (rev 188499)
</span><span class="lines">@@ -1,5 +1,5 @@
</span><span class="cx"> /*
</span><del>- * Copyright (C) 2014 Apple Inc. All rights reserved.
</del><ins>+ * Copyright (C) 2014, 2015 Apple Inc. All rights reserved.
</ins><span class="cx"> *
</span><span class="cx"> * Redistribution and use in source and binary forms, with or without
</span><span class="cx"> * modification, are permitted provided that the following conditions
</span><span class="lines">@@ -28,8 +28,8 @@
</span><span class="cx">
</span><span class="cx"> #if ENABLE(DFG_JIT)
</span><span class="cx">
</span><ins>+#include <wtf/Lock.h>
</ins><span class="cx"> #include <wtf/Threading.h>
</span><del>-#include <wtf/ThreadingPrimitives.h>
</del><span class="cx">
</span><span class="cx"> namespace JSC { namespace DFG {
</span><span class="cx">
</span><span class="lines">@@ -48,7 +48,7 @@
</span><span class="cx">
</span><span class="cx"> Worklist* m_worklist;
</span><span class="cx"> ThreadIdentifier m_identifier;
</span><del>- Mutex m_rightToRun;
</del><ins>+ Lock m_rightToRun;
</ins><span class="cx"> Safepoint* m_safepoint;
</span><span class="cx"> };
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoredfgDFGWorklistcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/dfg/DFGWorklist.cpp (188498 => 188499)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/dfg/DFGWorklist.cpp        2015-08-14 23:50:25 UTC (rev 188498)
+++ trunk/Source/JavaScriptCore/dfg/DFGWorklist.cpp        2015-08-15 00:14:52 UTC (rev 188499)
</span><span class="lines">@@ -46,10 +46,10 @@
</span><span class="cx"> Worklist::~Worklist()
</span><span class="cx"> {
</span><span class="cx"> {
</span><del>- MutexLocker locker(m_lock);
</del><ins>+ LockHolder locker(m_lock);
</ins><span class="cx"> for (unsigned i = m_threads.size(); i--;)
</span><span class="cx"> m_queue.append(nullptr); // Use null plan to indicate that we want the thread to terminate.
</span><del>- m_planEnqueued.broadcast();
</del><ins>+ m_planEnqueued.notifyAll();
</ins><span class="cx"> }
</span><span class="cx"> for (unsigned i = m_threads.size(); i--;)
</span><span class="cx"> waitForThreadCompletion(m_threads[i]->m_identifier);
</span><span class="lines">@@ -77,7 +77,7 @@
</span><span class="cx">
</span><span class="cx"> bool Worklist::isActiveForVM(VM& vm) const
</span><span class="cx"> {
</span><del>- MutexLocker locker(m_lock);
</del><ins>+ LockHolder locker(m_lock);
</ins><span class="cx"> PlanMap::const_iterator end = m_plans.end();
</span><span class="cx"> for (PlanMap::const_iterator iter = m_plans.begin(); iter != end; ++iter) {
</span><span class="cx"> if (&iter->value->vm == &vm)
</span><span class="lines">@@ -89,7 +89,7 @@
</span><span class="cx"> void Worklist::enqueue(PassRefPtr<Plan> passedPlan)
</span><span class="cx"> {
</span><span class="cx"> RefPtr<Plan> plan = passedPlan;
</span><del>- MutexLocker locker(m_lock);
</del><ins>+ LockHolder locker(m_lock);
</ins><span class="cx"> if (Options::verboseCompilationQueue()) {
</span><span class="cx"> dump(locker, WTF::dataFile());
</span><span class="cx"> dataLog(": Enqueueing plan to optimize ", plan->key(), "\n");
</span><span class="lines">@@ -97,12 +97,12 @@
</span><span class="cx"> ASSERT(m_plans.find(plan->key()) == m_plans.end());
</span><span class="cx"> m_plans.add(plan->key(), plan);
</span><span class="cx"> m_queue.append(plan);
</span><del>- m_planEnqueued.signal();
</del><ins>+ m_planEnqueued.notifyOne();
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> Worklist::State Worklist::compilationState(CompilationKey key)
</span><span class="cx"> {
</span><del>- MutexLocker locker(m_lock);
</del><ins>+ LockHolder locker(m_lock);
</ins><span class="cx"> PlanMap::iterator iter = m_plans.find(key);
</span><span class="cx"> if (iter == m_plans.end())
</span><span class="cx"> return NotKnown;
</span><span class="lines">@@ -118,7 +118,7 @@
</span><span class="cx"> // After we release this lock, we know that although other VMs may still
</span><span class="cx"> // be adding plans, our VM will not be.
</span><span class="cx">
</span><del>- MutexLocker locker(m_lock);
</del><ins>+ LockHolder locker(m_lock);
</ins><span class="cx">
</span><span class="cx"> if (Options::verboseCompilationQueue()) {
</span><span class="cx"> dump(locker, WTF::dataFile());
</span><span class="lines">@@ -147,7 +147,7 @@
</span><span class="cx"> void Worklist::removeAllReadyPlansForVM(VM& vm, Vector<RefPtr<Plan>, 8>& myReadyPlans)
</span><span class="cx"> {
</span><span class="cx"> DeferGC deferGC(vm.heap);
</span><del>- MutexLocker locker(m_lock);
</del><ins>+ LockHolder locker(m_lock);
</ins><span class="cx"> for (size_t i = 0; i < m_readyPlans.size(); ++i) {
</span><span class="cx"> RefPtr<Plan> plan = m_readyPlans[i];
</span><span class="cx"> if (&plan->vm != &vm)
</span><span class="lines">@@ -192,7 +192,7 @@
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> if (!!requestedKey && resultingState == NotKnown) {
</span><del>- MutexLocker locker(m_lock);
</del><ins>+ LockHolder locker(m_lock);
</ins><span class="cx"> if (m_plans.contains(requestedKey))
</span><span class="cx"> resultingState = Compiling;
</span><span class="cx"> }
</span><span class="lines">@@ -225,7 +225,7 @@
</span><span class="cx"> {
</span><span class="cx"> VM* vm = visitor.heap()->vm();
</span><span class="cx"> {
</span><del>- MutexLocker locker(m_lock);
</del><ins>+ LockHolder locker(m_lock);
</ins><span class="cx"> for (PlanMap::iterator iter = m_plans.begin(); iter != m_plans.end(); ++iter) {
</span><span class="cx"> Plan* plan = iter->value.get();
</span><span class="cx"> if (&plan->vm != vm)
</span><span class="lines">@@ -248,7 +248,7 @@
</span><span class="cx"> void Worklist::removeDeadPlans(VM& vm)
</span><span class="cx"> {
</span><span class="cx"> {
</span><del>- MutexLocker locker(m_lock);
</del><ins>+ LockHolder locker(m_lock);
</ins><span class="cx"> HashSet<CompilationKey> deadPlanKeys;
</span><span class="cx"> for (PlanMap::iterator iter = m_plans.begin(); iter != m_plans.end(); ++iter) {
</span><span class="cx"> Plan* plan = iter->value.get();
</span><span class="lines">@@ -295,17 +295,17 @@
</span><span class="cx">
</span><span class="cx"> size_t Worklist::queueLength()
</span><span class="cx"> {
</span><del>- MutexLocker locker(m_lock);
</del><ins>+ LockHolder locker(m_lock);
</ins><span class="cx"> return m_queue.size();
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void Worklist::dump(PrintStream& out) const
</span><span class="cx"> {
</span><del>- MutexLocker locker(m_lock);
</del><ins>+ LockHolder locker(m_lock);
</ins><span class="cx"> dump(locker, out);
</span><span class="cx"> }
</span><span class="cx">
</span><del>-void Worklist::dump(const MutexLocker&, PrintStream& out) const
</del><ins>+void Worklist::dump(const LockHolder&, PrintStream& out) const
</ins><span class="cx"> {
</span><span class="cx"> out.print(
</span><span class="cx"> "Worklist(", RawPointer(this), ")[Queue Length = ", m_queue.size(),
</span><span class="lines">@@ -325,7 +325,7 @@
</span><span class="cx"> for (;;) {
</span><span class="cx"> RefPtr<Plan> plan;
</span><span class="cx"> {
</span><del>- MutexLocker locker(m_lock);
</del><ins>+ LockHolder locker(m_lock);
</ins><span class="cx"> while (m_queue.isEmpty())
</span><span class="cx"> m_planEnqueued.wait(m_lock);
</span><span class="cx">
</span><span class="lines">@@ -341,9 +341,9 @@
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> {
</span><del>- MutexLocker locker(data->m_rightToRun);
</del><ins>+ LockHolder locker(data->m_rightToRun);
</ins><span class="cx"> {
</span><del>- MutexLocker locker(m_lock);
</del><ins>+ LockHolder locker(m_lock);
</ins><span class="cx"> if (plan->stage == Plan::Cancelled) {
</span><span class="cx"> m_numberOfActiveThreads--;
</span><span class="cx"> continue;
</span><span class="lines">@@ -359,7 +359,7 @@
</span><span class="cx"> RELEASE_ASSERT(!plan->vm.heap.isCollecting());
</span><span class="cx">
</span><span class="cx"> {
</span><del>- MutexLocker locker(m_lock);
</del><ins>+ LockHolder locker(m_lock);
</ins><span class="cx"> if (plan->stage == Plan::Cancelled) {
</span><span class="cx"> m_numberOfActiveThreads--;
</span><span class="cx"> continue;
</span><span class="lines">@@ -370,7 +370,7 @@
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> {
</span><del>- MutexLocker locker(m_lock);
</del><ins>+ LockHolder locker(m_lock);
</ins><span class="cx">
</span><span class="cx"> // We could have been cancelled between releasing rightToRun and acquiring m_lock.
</span><span class="cx"> // This would mean that we might be in the middle of GC right now.
</span><span class="lines">@@ -388,7 +388,7 @@
</span><span class="cx">
</span><span class="cx"> m_readyPlans.append(plan);
</span><span class="cx">
</span><del>- m_planCompiled.broadcast();
</del><ins>+ m_planCompiled.notifyAll();
</ins><span class="cx"> m_numberOfActiveThreads--;
</span><span class="cx"> }
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoredfgDFGWorklisth"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/dfg/DFGWorklist.h (188498 => 188499)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/dfg/DFGWorklist.h        2015-08-14 23:50:25 UTC (rev 188498)
+++ trunk/Source/JavaScriptCore/dfg/DFGWorklist.h        2015-08-15 00:14:52 UTC (rev 188499)
</span><span class="lines">@@ -30,10 +30,11 @@
</span><span class="cx">
</span><span class="cx"> #include "DFGPlan.h"
</span><span class="cx"> #include "DFGThreadData.h"
</span><ins>+#include <wtf/Condition.h>
</ins><span class="cx"> #include <wtf/Deque.h>
</span><span class="cx"> #include <wtf/HashMap.h>
</span><ins>+#include <wtf/Lock.h>
</ins><span class="cx"> #include <wtf/Noncopyable.h>
</span><del>-#include <wtf/ThreadingPrimitives.h>
</del><span class="cx">
</span><span class="cx"> namespace JSC {
</span><span class="cx">
</span><span class="lines">@@ -85,7 +86,7 @@
</span><span class="cx">
</span><span class="cx"> void removeAllReadyPlansForVM(VM&, Vector<RefPtr<Plan>, 8>&);
</span><span class="cx">
</span><del>- void dump(const MutexLocker&, PrintStream&) const;
</del><ins>+ void dump(const LockHolder&, PrintStream&) const;
</ins><span class="cx">
</span><span class="cx"> CString m_threadName;
</span><span class="cx">
</span><span class="lines">@@ -103,11 +104,11 @@
</span><span class="cx"> // be completed.
</span><span class="cx"> Vector<RefPtr<Plan>, 16> m_readyPlans;
</span><span class="cx">
</span><del>- Mutex m_suspensionLock;
</del><ins>+ Lock m_suspensionLock;
</ins><span class="cx">
</span><del>- mutable Mutex m_lock;
- ThreadCondition m_planEnqueued;
- ThreadCondition m_planCompiled;
</del><ins>+ mutable Lock m_lock;
+ Condition m_planEnqueued;
+ Condition m_planCompiled;
</ins><span class="cx">
</span><span class="cx"> Vector<std::unique_ptr<ThreadData>> m_threads;
</span><span class="cx"> unsigned m_numberOfActiveThreads;
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoredisassemblerDisassemblercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/disassembler/Disassembler.cpp (188498 => 188499)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/disassembler/Disassembler.cpp        2015-08-14 23:50:25 UTC (rev 188498)
+++ trunk/Source/JavaScriptCore/disassembler/Disassembler.cpp        2015-08-15 00:14:52 UTC (rev 188499)
</span><span class="lines">@@ -27,12 +27,13 @@
</span><span class="cx"> #include "Disassembler.h"
</span><span class="cx">
</span><span class="cx"> #include "MacroAssemblerCodeRef.h"
</span><ins>+#include <wtf/Condition.h>
</ins><span class="cx"> #include <wtf/DataLog.h>
</span><span class="cx"> #include <wtf/Deque.h>
</span><ins>+#include <wtf/Lock.h>
</ins><span class="cx"> #include <wtf/NeverDestroyed.h>
</span><span class="cx"> #include <wtf/StringPrintStream.h>
</span><span class="cx"> #include <wtf/Threading.h>
</span><del>-#include <wtf/ThreadingPrimitives.h>
</del><span class="cx">
</span><span class="cx"> namespace JSC {
</span><span class="cx">
</span><span class="lines">@@ -78,14 +79,14 @@
</span><span class="cx">
</span><span class="cx"> void enqueue(std::unique_ptr<DisassemblyTask> task)
</span><span class="cx"> {
</span><del>- MutexLocker locker(m_lock);
</del><ins>+ LockHolder locker(m_lock);
</ins><span class="cx"> m_queue.append(WTF::move(task));
</span><del>- m_condition.broadcast();
</del><ins>+ m_condition.notifyAll();
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void waitUntilEmpty()
</span><span class="cx"> {
</span><del>- MutexLocker locker(m_lock);
</del><ins>+ LockHolder locker(m_lock);
</ins><span class="cx"> while (!m_queue.isEmpty() || m_working)
</span><span class="cx"> m_condition.wait(m_lock);
</span><span class="cx"> }
</span><span class="lines">@@ -96,9 +97,9 @@
</span><span class="cx"> for (;;) {
</span><span class="cx"> std::unique_ptr<DisassemblyTask> task;
</span><span class="cx"> {
</span><del>- MutexLocker locker(m_lock);
</del><ins>+ LockHolder locker(m_lock);
</ins><span class="cx"> m_working = false;
</span><del>- m_condition.broadcast();
</del><ins>+ m_condition.notifyAll();
</ins><span class="cx"> while (m_queue.isEmpty())
</span><span class="cx"> m_condition.wait(m_lock);
</span><span class="cx"> task = m_queue.takeFirst();
</span><span class="lines">@@ -112,8 +113,8 @@
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span><del>- Mutex m_lock;
- ThreadCondition m_condition;
</del><ins>+ Lock m_lock;
+ Condition m_condition;
</ins><span class="cx"> Deque<std::unique_ptr<DisassemblyTask>> m_queue;
</span><span class="cx"> bool m_working { false };
</span><span class="cx"> };
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreheapCopiedSpacecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/heap/CopiedSpace.cpp (188498 => 188499)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/heap/CopiedSpace.cpp        2015-08-14 23:50:25 UTC (rev 188498)
+++ trunk/Source/JavaScriptCore/heap/CopiedSpace.cpp        2015-08-15 00:14:52 UTC (rev 188499)
</span><span class="lines">@@ -198,12 +198,12 @@
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> {
</span><del>- MutexLocker locker(m_loanedBlocksLock);
</del><ins>+ LockHolder locker(m_loanedBlocksLock);
</ins><span class="cx"> ASSERT(m_numberOfLoanedBlocks > 0);
</span><span class="cx"> ASSERT(m_inCopyingPhase);
</span><span class="cx"> m_numberOfLoanedBlocks--;
</span><span class="cx"> if (!m_numberOfLoanedBlocks)
</span><del>- m_loanedBlocksCondition.signal();
</del><ins>+ m_loanedBlocksCondition.notifyOne();
</ins><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -231,7 +231,7 @@
</span><span class="cx"> void CopiedSpace::doneCopying()
</span><span class="cx"> {
</span><span class="cx"> {
</span><del>- MutexLocker locker(m_loanedBlocksLock);
</del><ins>+ LockHolder locker(m_loanedBlocksLock);
</ins><span class="cx"> while (m_numberOfLoanedBlocks > 0)
</span><span class="cx"> m_loanedBlocksCondition.wait(m_loanedBlocksLock);
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreheapCopiedSpaceh"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/heap/CopiedSpace.h (188498 => 188499)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/heap/CopiedSpace.h        2015-08-14 23:50:25 UTC (rev 188498)
+++ trunk/Source/JavaScriptCore/heap/CopiedSpace.h        2015-08-15 00:14:52 UTC (rev 188499)
</span><span class="lines">@@ -31,13 +31,13 @@
</span><span class="cx"> #include "TinyBloomFilter.h"
</span><span class="cx"> #include <wtf/Assertions.h>
</span><span class="cx"> #include <wtf/CheckedBoolean.h>
</span><ins>+#include <wtf/Condition.h>
</ins><span class="cx"> #include <wtf/DoublyLinkedList.h>
</span><span class="cx"> #include <wtf/HashSet.h>
</span><span class="cx"> #include <wtf/Lock.h>
</span><span class="cx"> #include <wtf/OSAllocator.h>
</span><span class="cx"> #include <wtf/PageBlock.h>
</span><span class="cx"> #include <wtf/StdLibExtras.h>
</span><del>-#include <wtf/ThreadingPrimitives.h>
</del><span class="cx">
</span><span class="cx"> namespace JSC {
</span><span class="cx">
</span><span class="lines">@@ -138,8 +138,8 @@
</span><span class="cx"> bool m_inCopyingPhase;
</span><span class="cx"> bool m_shouldDoCopyPhase;
</span><span class="cx">
</span><del>- Mutex m_loanedBlocksLock;
- ThreadCondition m_loanedBlocksCondition;
</del><ins>+ Lock m_loanedBlocksLock;
+ Condition m_loanedBlocksCondition;
</ins><span class="cx"> size_t m_numberOfLoanedBlocks;
</span><span class="cx">
</span><span class="cx"> size_t m_bytesRemovedFromOldSpaceDueToReallocation;
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreheapCopiedSpaceInlinesh"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/heap/CopiedSpaceInlines.h (188498 => 188499)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/heap/CopiedSpaceInlines.h        2015-08-14 23:50:25 UTC (rev 188498)
+++ trunk/Source/JavaScriptCore/heap/CopiedSpaceInlines.h        2015-08-15 00:14:52 UTC (rev 188499)
</span><span class="lines">@@ -113,12 +113,12 @@
</span><span class="cx"> CopiedBlock::destroy(block);
</span><span class="cx">
</span><span class="cx"> {
</span><del>- MutexLocker locker(m_loanedBlocksLock);
</del><ins>+ LockHolder locker(m_loanedBlocksLock);
</ins><span class="cx"> ASSERT(m_numberOfLoanedBlocks > 0);
</span><span class="cx"> ASSERT(m_inCopyingPhase);
</span><span class="cx"> m_numberOfLoanedBlocks--;
</span><span class="cx"> if (!m_numberOfLoanedBlocks)
</span><del>- m_loanedBlocksCondition.signal();
</del><ins>+ m_loanedBlocksCondition.notifyOne();
</ins><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -128,7 +128,7 @@
</span><span class="cx"> CopiedBlock* block = CopiedBlock::createNoZeroFill();
</span><span class="cx">
</span><span class="cx"> {
</span><del>- MutexLocker locker(m_loanedBlocksLock);
</del><ins>+ LockHolder locker(m_loanedBlocksLock);
</ins><span class="cx"> m_numberOfLoanedBlocks++;
</span><span class="cx"> }
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreheapGCThreadcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/heap/GCThread.cpp (188498 => 188499)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/heap/GCThread.cpp        2015-08-14 23:50:25 UTC (rev 188498)
+++ trunk/Source/JavaScriptCore/heap/GCThread.cpp        2015-08-15 00:14:52 UTC (rev 188499)
</span><span class="lines">@@ -69,12 +69,12 @@
</span><span class="cx">
</span><span class="cx"> GCPhase GCThread::waitForNextPhase()
</span><span class="cx"> {
</span><del>- std::unique_lock<std::mutex> lock(m_shared.m_phaseMutex);
</del><ins>+ std::unique_lock<Lock> lock(m_shared.m_phaseMutex);
</ins><span class="cx"> m_shared.m_phaseConditionVariable.wait(lock, [this] { return !m_shared.m_gcThreadsShouldWait; });
</span><span class="cx">
</span><span class="cx"> m_shared.m_numberOfActiveGCThreads--;
</span><span class="cx"> if (!m_shared.m_numberOfActiveGCThreads)
</span><del>- m_shared.m_activityConditionVariable.notify_one();
</del><ins>+ m_shared.m_activityConditionVariable.notifyOne();
</ins><span class="cx">
</span><span class="cx"> m_shared.m_phaseConditionVariable.wait(lock, [this] { return m_shared.m_currentPhase != NoPhase; });
</span><span class="cx"> m_shared.m_numberOfActiveGCThreads++;
</span><span class="lines">@@ -90,7 +90,7 @@
</span><span class="cx"> // Wait for the main thread to finish creating and initializing us. The main thread grabs this lock before
</span><span class="cx"> // creating this thread. We aren't guaranteed to have a valid threadID until the main thread releases this lock.
</span><span class="cx"> {
</span><del>- std::lock_guard<std::mutex> lock(m_shared.m_phaseMutex);
</del><ins>+ std::lock_guard<Lock> lock(m_shared.m_phaseMutex);
</ins><span class="cx"> }
</span><span class="cx"> {
</span><span class="cx"> ParallelModeEnabler enabler(*m_slotVisitor);
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreheapGCThreadSharedDatacpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/heap/GCThreadSharedData.cpp (188498 => 188499)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/heap/GCThreadSharedData.cpp        2015-08-14 23:50:25 UTC (rev 188498)
+++ trunk/Source/JavaScriptCore/heap/GCThreadSharedData.cpp        2015-08-15 00:14:52 UTC (rev 188499)
</span><span class="lines">@@ -1,5 +1,5 @@
</span><span class="cx"> /*
</span><del>- * Copyright (C) 2009, 2011 Apple Inc. All rights reserved.
</del><ins>+ * Copyright (C) 2009, 2011, 2015 Apple Inc. All rights reserved.
</ins><span class="cx"> *
</span><span class="cx"> * Redistribution and use in source and binary forms, with or without
</span><span class="cx"> * modification, are permitted provided that the following conditions
</span><span class="lines">@@ -83,7 +83,7 @@
</span><span class="cx"> {
</span><span class="cx"> #if ENABLE(PARALLEL_GC)
</span><span class="cx"> // Grab the lock so the new GC threads can be properly initialized before they start running.
</span><del>- std::unique_lock<std::mutex> lock(m_phaseMutex);
</del><ins>+ std::unique_lock<Lock> lock(m_phaseMutex);
</ins><span class="cx"> for (unsigned i = 1; i < Options::numberOfGCMarkers(); ++i) {
</span><span class="cx"> m_numberOfActiveGCThreads++;
</span><span class="cx"> GCThread* newThread = new GCThread(*this, std::make_unique<SlotVisitor>(*this), std::make_unique<CopyVisitor>(*this));
</span><span class="lines">@@ -102,13 +102,13 @@
</span><span class="cx"> #if ENABLE(PARALLEL_GC)
</span><span class="cx"> // Destroy our marking threads.
</span><span class="cx"> {
</span><del>- std::lock_guard<std::mutex> markingLock(m_markingMutex);
- std::lock_guard<std::mutex> phaseLock(m_phaseMutex);
</del><ins>+ std::lock_guard<Lock> markingLock(m_markingMutex);
+ std::lock_guard<Lock> phaseLock(m_phaseMutex);
</ins><span class="cx"> ASSERT(m_currentPhase == NoPhase);
</span><span class="cx"> m_parallelMarkersShouldExit = true;
</span><span class="cx"> m_gcThreadsShouldWait = false;
</span><span class="cx"> m_currentPhase = Exit;
</span><del>- m_phaseConditionVariable.notify_all();
</del><ins>+ m_phaseConditionVariable.notifyAll();
</ins><span class="cx"> }
</span><span class="cx"> for (unsigned i = 0; i < m_gcThreads.size(); ++i) {
</span><span class="cx"> waitForThreadCompletion(m_gcThreads[i]->threadID());
</span><span class="lines">@@ -131,21 +131,21 @@
</span><span class="cx">
</span><span class="cx"> void GCThreadSharedData::startNextPhase(GCPhase phase)
</span><span class="cx"> {
</span><del>- std::lock_guard<std::mutex> lock(m_phaseMutex);
</del><ins>+ std::lock_guard<Lock> lock(m_phaseMutex);
</ins><span class="cx"> ASSERT(!m_gcThreadsShouldWait);
</span><span class="cx"> ASSERT(m_currentPhase == NoPhase);
</span><span class="cx"> m_gcThreadsShouldWait = true;
</span><span class="cx"> m_currentPhase = phase;
</span><del>- m_phaseConditionVariable.notify_all();
</del><ins>+ m_phaseConditionVariable.notifyAll();
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void GCThreadSharedData::endCurrentPhase()
</span><span class="cx"> {
</span><span class="cx"> ASSERT(m_gcThreadsShouldWait);
</span><del>- std::unique_lock<std::mutex> lock(m_phaseMutex);
</del><ins>+ std::unique_lock<Lock> lock(m_phaseMutex);
</ins><span class="cx"> m_currentPhase = NoPhase;
</span><span class="cx"> m_gcThreadsShouldWait = false;
</span><del>- m_phaseConditionVariable.notify_all();
</del><ins>+ m_phaseConditionVariable.notifyAll();
</ins><span class="cx"> m_activityConditionVariable.wait(lock, [this] { return !m_numberOfActiveGCThreads; });
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -158,7 +158,7 @@
</span><span class="cx"> ASSERT(m_opaqueRoots.isEmpty());
</span><span class="cx"> #endif
</span><span class="cx"> }
</span><del>- std::lock_guard<std::mutex> lock(m_markingMutex);
</del><ins>+ std::lock_guard<Lock> lock(m_markingMutex);
</ins><span class="cx"> m_parallelMarkersShouldExit = false;
</span><span class="cx"> startNextPhase(Mark);
</span><span class="cx"> }
</span><span class="lines">@@ -166,9 +166,9 @@
</span><span class="cx"> void GCThreadSharedData::didFinishMarking()
</span><span class="cx"> {
</span><span class="cx"> {
</span><del>- std::lock_guard<std::mutex> lock(m_markingMutex);
</del><ins>+ std::lock_guard<Lock> lock(m_markingMutex);
</ins><span class="cx"> m_parallelMarkersShouldExit = true;
</span><del>- m_markingConditionVariable.notify_all();
</del><ins>+ m_markingConditionVariable.notifyAll();
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> ASSERT(m_currentPhase == Mark);
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreheapGCThreadSharedDatah"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/heap/GCThreadSharedData.h (188498 => 188499)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/heap/GCThreadSharedData.h        2015-08-14 23:50:25 UTC (rev 188498)
+++ trunk/Source/JavaScriptCore/heap/GCThreadSharedData.h        2015-08-15 00:14:52 UTC (rev 188499)
</span><span class="lines">@@ -1,5 +1,5 @@
</span><span class="cx"> /*
</span><del>- * Copyright (C) 2009, 2011 Apple Inc. All rights reserved.
</del><ins>+ * Copyright (C) 2009, 2011, 2015 Apple Inc. All rights reserved.
</ins><span class="cx"> *
</span><span class="cx"> * Redistribution and use in source and binary forms, with or without
</span><span class="cx"> * modification, are permitted provided that the following conditions
</span><span class="lines">@@ -32,6 +32,7 @@
</span><span class="cx"> #include "UnconditionalFinalizer.h"
</span><span class="cx"> #include "WeakReferenceHarvester.h"
</span><span class="cx"> #include <condition_variable>
</span><ins>+#include <wtf/Condition.h>
</ins><span class="cx"> #include <wtf/HashSet.h>
</span><span class="cx"> #include <wtf/Lock.h>
</span><span class="cx"> #include <wtf/Vector.h>
</span><span class="lines">@@ -88,13 +89,13 @@
</span><span class="cx">
</span><span class="cx"> Vector<GCThread*> m_gcThreads;
</span><span class="cx">
</span><del>- std::mutex m_markingMutex;
- std::condition_variable m_markingConditionVariable;
</del><ins>+ Lock m_markingMutex;
+ Condition m_markingConditionVariable;
</ins><span class="cx"> MarkStackArray m_sharedMarkStack;
</span><span class="cx"> unsigned m_numberOfActiveParallelMarkers;
</span><span class="cx"> bool m_parallelMarkersShouldExit;
</span><span class="cx">
</span><del>- std::mutex m_opaqueRootsMutex;
</del><ins>+ Lock m_opaqueRootsMutex;
</ins><span class="cx"> HashSet<void*> m_opaqueRoots;
</span><span class="cx">
</span><span class="cx"> Lock m_copyLock;
</span><span class="lines">@@ -102,9 +103,9 @@
</span><span class="cx"> size_t m_copyIndex;
</span><span class="cx"> static const size_t s_blockFragmentLength = 32;
</span><span class="cx">
</span><del>- std::mutex m_phaseMutex;
- std::condition_variable m_phaseConditionVariable;
- std::condition_variable m_activityConditionVariable;
</del><ins>+ Lock m_phaseMutex;
+ Condition m_phaseConditionVariable;
+ Condition m_activityConditionVariable;
</ins><span class="cx"> unsigned m_numberOfActiveGCThreads;
</span><span class="cx"> bool m_gcThreadsShouldWait;
</span><span class="cx"> GCPhase m_currentPhase;
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreheapHeapTimerh"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/heap/HeapTimer.h (188498 => 188499)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/heap/HeapTimer.h        2015-08-14 23:50:25 UTC (rev 188498)
+++ trunk/Source/JavaScriptCore/heap/HeapTimer.h        2015-08-15 00:14:52 UTC (rev 188499)
</span><span class="lines">@@ -1,5 +1,5 @@
</span><span class="cx"> /*
</span><del>- * Copyright (C) 2012 Apple Inc. All rights reserved.
</del><ins>+ * Copyright (C) 2012, 2015 Apple Inc. All rights reserved.
</ins><span class="cx"> *
</span><span class="cx"> * Redistribution and use in source and binary forms, with or without
</span><span class="cx"> * modification, are permitted provided that the following conditions
</span><span class="lines">@@ -26,6 +26,7 @@
</span><span class="cx"> #ifndef HeapTimer_h
</span><span class="cx"> #define HeapTimer_h
</span><span class="cx">
</span><ins>+#include <wtf/Lock.h>
</ins><span class="cx"> #include <wtf/RetainPtr.h>
</span><span class="cx"> #include <wtf/Threading.h>
</span><span class="cx">
</span><span class="lines">@@ -59,7 +60,7 @@
</span><span class="cx"> RetainPtr<CFRunLoopRef> m_runLoop;
</span><span class="cx"> CFRunLoopTimerContext m_context;
</span><span class="cx">
</span><del>- Mutex m_shutdownMutex;
</del><ins>+ Lock m_shutdownMutex;
</ins><span class="cx"> #elif PLATFORM(EFL)
</span><span class="cx"> static bool timerEvent(void*);
</span><span class="cx"> Ecore_Timer* add(double delay, void* agent);
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreheapMachineStackMarkercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/heap/MachineStackMarker.cpp (188498 => 188499)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/heap/MachineStackMarker.cpp        2015-08-14 23:50:25 UTC (rev 188498)
+++ trunk/Source/JavaScriptCore/heap/MachineStackMarker.cpp        2015-08-15 00:14:52 UTC (rev 188499)
</span><span class="lines">@@ -103,18 +103,18 @@
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> private:
</span><del>- MutexLocker m_locker;
</del><ins>+ LockHolder m_locker;
</ins><span class="cx"> };
</span><span class="cx">
</span><span class="cx"> void add(MachineThreads* machineThreads)
</span><span class="cx"> {
</span><del>- MutexLocker managerLock(m_lock);
</del><ins>+ LockHolder managerLock(m_lock);
</ins><span class="cx"> m_set.add(machineThreads);
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void remove(MachineThreads* machineThreads)
</span><span class="cx"> {
</span><del>- MutexLocker managerLock(m_lock);
</del><ins>+ LockHolder managerLock(m_lock);
</ins><span class="cx"> auto recordedMachineThreads = m_set.take(machineThreads);
</span><span class="cx"> RELEASE_ASSERT(recordedMachineThreads = machineThreads);
</span><span class="cx"> }
</span><span class="lines">@@ -129,7 +129,7 @@
</span><span class="cx">
</span><span class="cx"> ActiveMachineThreadsManager() { }
</span><span class="cx">
</span><del>- Mutex m_lock;
</del><ins>+ Lock m_lock;
</ins><span class="cx"> MachineThreadsSet m_set;
</span><span class="cx">
</span><span class="cx"> friend ActiveMachineThreadsManager& activeMachineThreadsManager();
</span><span class="lines">@@ -263,7 +263,7 @@
</span><span class="cx"> activeMachineThreadsManager().remove(this);
</span><span class="cx"> threadSpecificKeyDelete(m_threadSpecific);
</span><span class="cx">
</span><del>- MutexLocker registeredThreadsLock(m_registeredThreadsMutex);
</del><ins>+ LockHolder registeredThreadsLock(m_registeredThreadsMutex);
</ins><span class="cx"> for (Thread* t = m_registeredThreads; t;) {
</span><span class="cx"> Thread* next = t->next;
</span><span class="cx"> delete t;
</span><span class="lines">@@ -294,7 +294,7 @@
</span><span class="cx"> threadSpecificSet(m_threadSpecific, this);
</span><span class="cx"> Thread* thread = Thread::createForCurrentThread();
</span><span class="cx">
</span><del>- MutexLocker lock(m_registeredThreadsMutex);
</del><ins>+ LockHolder lock(m_registeredThreadsMutex);
</ins><span class="cx">
</span><span class="cx"> thread->next = m_registeredThreads;
</span><span class="cx"> m_registeredThreads = thread;
</span><span class="lines">@@ -318,7 +318,7 @@
</span><span class="cx"> template<typename PlatformThread>
</span><span class="cx"> void MachineThreads::removeThreadIfFound(PlatformThread platformThread)
</span><span class="cx"> {
</span><del>- MutexLocker lock(m_registeredThreadsMutex);
</del><ins>+ LockHolder lock(m_registeredThreadsMutex);
</ins><span class="cx"> Thread* t = m_registeredThreads;
</span><span class="cx"> if (*t == platformThread) {
</span><span class="cx"> m_registeredThreads = m_registeredThreads->next;
</span><span class="lines">@@ -566,7 +566,7 @@
</span><span class="cx"> thread->freeRegisters(registers);
</span><span class="cx"> }
</span><span class="cx">
</span><del>-bool MachineThreads::tryCopyOtherThreadStacks(MutexLocker&, void* buffer, size_t capacity, size_t* size)
</del><ins>+bool MachineThreads::tryCopyOtherThreadStacks(LockHolder&, void* buffer, size_t capacity, size_t* size)
</ins><span class="cx"> {
</span><span class="cx"> // Prevent two VMs from suspending each other's threads at the same time,
</span><span class="cx"> // which can cause deadlock: <rdar://problem/20300842>.
</span><span class="lines">@@ -660,7 +660,7 @@
</span><span class="cx"> size_t size;
</span><span class="cx"> size_t capacity = 0;
</span><span class="cx"> void* buffer = nullptr;
</span><del>- MutexLocker lock(m_registeredThreadsMutex);
</del><ins>+ LockHolder lock(m_registeredThreadsMutex);
</ins><span class="cx"> while (!tryCopyOtherThreadStacks(lock, buffer, capacity, &size))
</span><span class="cx"> growBuffer(size, &buffer, &capacity);
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreheapMachineStackMarkerh"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/heap/MachineStackMarker.h (188498 => 188499)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/heap/MachineStackMarker.h        2015-08-14 23:50:25 UTC (rev 188498)
+++ trunk/Source/JavaScriptCore/heap/MachineStackMarker.h        2015-08-15 00:14:52 UTC (rev 188499)
</span><span class="lines">@@ -1,7 +1,7 @@
</span><span class="cx"> /*
</span><span class="cx"> * Copyright (C) 1999-2000 Harri Porten (porten@kde.org)
</span><span class="cx"> * Copyright (C) 2001 Peter Kelly (pmk@post.com)
</span><del>- * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
</del><ins>+ * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2015 Apple Inc. All rights reserved.
</ins><span class="cx"> *
</span><span class="cx"> * This library is free software; you can redistribute it and/or
</span><span class="cx"> * modify it under the terms of the GNU Lesser General Public
</span><span class="lines">@@ -23,9 +23,9 @@
</span><span class="cx"> #define MachineThreads_h
</span><span class="cx">
</span><span class="cx"> #include <setjmp.h>
</span><ins>+#include <wtf/Lock.h>
</ins><span class="cx"> #include <wtf/Noncopyable.h>
</span><span class="cx"> #include <wtf/ThreadSpecific.h>
</span><del>-#include <wtf/ThreadingPrimitives.h>
</del><span class="cx">
</span><span class="cx"> namespace JSC {
</span><span class="cx">
</span><span class="lines">@@ -52,14 +52,14 @@
</span><span class="cx"> void gatherFromCurrentThread(ConservativeRoots&, JITStubRoutineSet&, CodeBlockSet&, void* stackOrigin, void* stackTop, RegisterState& calleeSavedRegisters);
</span><span class="cx">
</span><span class="cx"> void tryCopyOtherThreadStack(Thread*, void*, size_t capacity, size_t*);
</span><del>- bool tryCopyOtherThreadStacks(MutexLocker&, void*, size_t capacity, size_t*);
</del><ins>+ bool tryCopyOtherThreadStacks(LockHolder&, void*, size_t capacity, size_t*);
</ins><span class="cx">
</span><span class="cx"> static void removeThread(void*);
</span><span class="cx">
</span><span class="cx"> template<typename PlatformThread>
</span><span class="cx"> void removeThreadIfFound(PlatformThread);
</span><span class="cx">
</span><del>- Mutex m_registeredThreadsMutex;
</del><ins>+ Lock m_registeredThreadsMutex;
</ins><span class="cx"> Thread* m_registeredThreads;
</span><span class="cx"> WTF::ThreadSpecificKey m_threadSpecific;
</span><span class="cx"> #if !ASSERT_DISABLED
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreheapSlotVisitorcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/heap/SlotVisitor.cpp (188498 => 188499)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/heap/SlotVisitor.cpp        2015-08-14 23:50:25 UTC (rev 188498)
+++ trunk/Source/JavaScriptCore/heap/SlotVisitor.cpp        2015-08-15 00:14:52 UTC (rev 188499)
</span><span class="lines">@@ -1,3 +1,28 @@
</span><ins>+/*
+ * Copyright (C) 2012, 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. AND ITS CONTRIBUTORS ``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 ITS 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.
+ */
+
</ins><span class="cx"> #include "config.h"
</span><span class="cx"> #include "SlotVisitor.h"
</span><span class="cx"> #include "SlotVisitorInlines.h"
</span><span class="lines">@@ -12,6 +37,7 @@
</span><span class="cx"> #include "JSObject.h"
</span><span class="cx"> #include "JSString.h"
</span><span class="cx"> #include "JSCInlines.h"
</span><ins>+#include <wtf/Lock.h>
</ins><span class="cx"> #include <wtf/StackStats.h>
</span><span class="cx">
</span><span class="cx"> namespace JSC {
</span><span class="lines">@@ -121,7 +147,7 @@
</span><span class="cx">
</span><span class="cx"> // If we're contending on the lock, be conservative and assume that another
</span><span class="cx"> // thread is already donating.
</span><del>- std::unique_lock<std::mutex> lock(m_shared.m_markingMutex, std::try_to_lock);
</del><ins>+ std::unique_lock<Lock> lock(m_shared.m_markingMutex, std::try_to_lock);
</ins><span class="cx"> if (!lock.owns_lock())
</span><span class="cx"> return;
</span><span class="cx">
</span><span class="lines">@@ -129,7 +155,7 @@
</span><span class="cx"> m_stack.donateSomeCellsTo(m_shared.m_sharedMarkStack);
</span><span class="cx">
</span><span class="cx"> if (m_shared.m_numberOfActiveParallelMarkers < Options::numberOfGCMarkers())
</span><del>- m_shared.m_markingConditionVariable.notify_all();
</del><ins>+ m_shared.m_markingConditionVariable.notifyAll();
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void SlotVisitor::drain()
</span><span class="lines">@@ -184,12 +210,12 @@
</span><span class="cx">
</span><span class="cx"> #if ENABLE(PARALLEL_GC)
</span><span class="cx"> {
</span><del>- std::lock_guard<std::mutex> lock(m_shared.m_markingMutex);
</del><ins>+ std::lock_guard<Lock> lock(m_shared.m_markingMutex);
</ins><span class="cx"> m_shared.m_numberOfActiveParallelMarkers++;
</span><span class="cx"> }
</span><span class="cx"> while (true) {
</span><span class="cx"> {
</span><del>- std::unique_lock<std::mutex> lock(m_shared.m_markingMutex);
</del><ins>+ std::unique_lock<Lock> lock(m_shared.m_markingMutex);
</ins><span class="cx"> m_shared.m_numberOfActiveParallelMarkers--;
</span><span class="cx">
</span><span class="cx"> // How we wait differs depending on drain mode.
</span><span class="lines">@@ -200,7 +226,7 @@
</span><span class="cx"> // Did we reach termination?
</span><span class="cx"> if (!m_shared.m_numberOfActiveParallelMarkers && m_shared.m_sharedMarkStack.isEmpty()) {
</span><span class="cx"> // Let any sleeping slaves know it's time for them to return;
</span><del>- m_shared.m_markingConditionVariable.notify_all();
</del><ins>+ m_shared.m_markingConditionVariable.notifyAll();
</ins><span class="cx"> return;
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -216,7 +242,7 @@
</span><span class="cx">
</span><span class="cx"> // Did we detect termination? If so, let the master know.
</span><span class="cx"> if (!m_shared.m_numberOfActiveParallelMarkers && m_shared.m_sharedMarkStack.isEmpty())
</span><del>- m_shared.m_markingConditionVariable.notify_all();
</del><ins>+ m_shared.m_markingConditionVariable.notifyAll();
</ins><span class="cx">
</span><span class="cx"> m_shared.m_markingConditionVariable.wait(lock, [this] { return !m_shared.m_sharedMarkStack.isEmpty() || m_shared.m_parallelMarkersShouldExit; });
</span><span class="cx">
</span><span class="lines">@@ -240,7 +266,7 @@
</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>- std::lock_guard<std::mutex> lock(m_shared.m_opaqueRootsMutex);
</del><ins>+ std::lock_guard<Lock> lock(m_shared.m_opaqueRootsMutex);
</ins><span class="cx"> for (auto* root : m_opaqueRoots)
</span><span class="cx"> m_shared.m_opaqueRoots.add(root);
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreheapSlotVisitorInlinesh"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/heap/SlotVisitorInlines.h (188498 => 188499)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/heap/SlotVisitorInlines.h        2015-08-14 23:50:25 UTC (rev 188498)
+++ trunk/Source/JavaScriptCore/heap/SlotVisitorInlines.h        2015-08-15 00:14:52 UTC (rev 188499)
</span><span class="lines">@@ -188,7 +188,7 @@
</span><span class="cx"> {
</span><span class="cx"> if (m_opaqueRoots.contains(root))
</span><span class="cx"> return TrueTriState;
</span><del>- std::lock_guard<std::mutex> lock(m_shared.m_opaqueRootsMutex);
</del><ins>+ std::lock_guard<Lock> 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="trunkSourceJavaScriptCoreinspectorremoteRemoteInspectorDebuggableConnectionh"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/inspector/remote/RemoteInspectorDebuggableConnection.h (188498 => 188499)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/inspector/remote/RemoteInspectorDebuggableConnection.h        2015-08-14 23:50:25 UTC (rev 188498)
+++ trunk/Source/JavaScriptCore/inspector/remote/RemoteInspectorDebuggableConnection.h        2015-08-15 00:14:52 UTC (rev 188499)
</span><span class="lines">@@ -31,6 +31,7 @@
</span><span class="cx"> #import "InspectorFrontendChannel.h"
</span><span class="cx"> #import "RemoteInspectorDebuggable.h"
</span><span class="cx"> #import <mutex>
</span><ins>+#import <wtf/Lock.h>
</ins><span class="cx"> #import <wtf/RetainPtr.h>
</span><span class="cx"> #import <wtf/ThreadSafeRefCounted.h>
</span><span class="cx">
</span><span class="lines">@@ -91,7 +92,7 @@
</span><span class="cx"> void sendMessageToBackend(NSString *);
</span><span class="cx"> virtual bool sendMessageToFrontend(const String&) override;
</span><span class="cx">
</span><del>- std::mutex& queueMutex() { return m_queueMutex; }
</del><ins>+ Lock& queueMutex() { return m_queueMutex; }
</ins><span class="cx"> RemoteInspectorQueue queue() const { return m_queue; }
</span><span class="cx"> void clearQueue() { m_queue.clear(); }
</span><span class="cx">
</span><span class="lines">@@ -105,14 +106,14 @@
</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><span class="cx"> // itself must take this mutex to ensure m_debuggable is valid.
</span><del>- std::mutex m_debuggableMutex;
</del><ins>+ Lock m_debuggableMutex;
</ins><span class="cx">
</span><span class="cx"> // If a debuggable has a specific run loop it wants to evaluate on
</span><span class="cx"> // we setup our run loop sources on that specific run loop.
</span><span class="cx"> RetainPtr<CFRunLoopRef> m_runLoop;
</span><span class="cx"> RetainPtr<CFRunLoopSourceRef> m_runLoopSource;
</span><span class="cx"> RemoteInspectorQueue m_queue;
</span><del>- std::mutex m_queueMutex;
</del><ins>+ Lock m_queueMutex;
</ins><span class="cx">
</span><span class="cx"> RemoteInspectorDebuggable* m_debuggable;
</span><span class="cx"> RetainPtr<NSString> m_connectionIdentifier;
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreinspectorremoteRemoteInspectorDebuggableConnectionmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/inspector/remote/RemoteInspectorDebuggableConnection.mm (188498 => 188499)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/inspector/remote/RemoteInspectorDebuggableConnection.mm        2015-08-14 23:50:25 UTC (rev 188498)
+++ trunk/Source/JavaScriptCore/inspector/remote/RemoteInspectorDebuggableConnection.mm        2015-08-15 00:14:52 UTC (rev 188499)
</span><span class="lines">@@ -1,5 +1,5 @@
</span><span class="cx"> /*
</span><del>- * Copyright (C) 2013 Apple Inc. All Rights Reserved.
</del><ins>+ * Copyright (C) 2013, 2015 Apple Inc. All Rights Reserved.
</ins><span class="cx"> *
</span><span class="cx"> * Redistribution and use in source and binary forms, with or without
</span><span class="cx"> * modification, are permitted provided that the following conditions
</span><span class="lines">@@ -39,20 +39,19 @@
</span><span class="cx">
</span><span class="cx"> namespace Inspector {
</span><span class="cx">
</span><del>-static std::mutex* rwiQueueMutex;
</del><ins>+static StaticLock rwiQueueMutex;
</ins><span class="cx"> static CFRunLoopSourceRef rwiRunLoopSource;
</span><span class="cx"> static RemoteInspectorQueue* rwiQueue;
</span><span class="cx">
</span><span class="cx"> static void RemoteInspectorHandleRunSourceGlobal(void*)
</span><span class="cx"> {
</span><span class="cx"> ASSERT(CFRunLoopGetCurrent() == CFRunLoopGetMain());
</span><del>- ASSERT(rwiQueueMutex);
</del><span class="cx"> ASSERT(rwiRunLoopSource);
</span><span class="cx"> ASSERT(rwiQueue);
</span><span class="cx">
</span><span class="cx"> RemoteInspectorQueue queueCopy;
</span><span class="cx"> {
</span><del>- std::lock_guard<std::mutex> lock(*rwiQueueMutex);
</del><ins>+ std::lock_guard<StaticLock> lock(rwiQueueMutex);
</ins><span class="cx"> queueCopy = *rwiQueue;
</span><span class="cx"> rwiQueue->clear();
</span><span class="cx"> }
</span><span class="lines">@@ -63,12 +62,11 @@
</span><span class="cx">
</span><span class="cx"> static void RemoteInspectorQueueTaskOnGlobalQueue(void (^task)())
</span><span class="cx"> {
</span><del>- ASSERT(rwiQueueMutex);
</del><span class="cx"> ASSERT(rwiRunLoopSource);
</span><span class="cx"> ASSERT(rwiQueue);
</span><span class="cx">
</span><span class="cx"> {
</span><del>- std::lock_guard<std::mutex> lock(*rwiQueueMutex);
</del><ins>+ std::lock_guard<StaticLock> lock(rwiQueueMutex);
</ins><span class="cx"> rwiQueue->append(RemoteInspectorBlock(task));
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -81,7 +79,6 @@
</span><span class="cx"> static dispatch_once_t pred;
</span><span class="cx"> dispatch_once(&pred, ^{
</span><span class="cx"> rwiQueue = new RemoteInspectorQueue;
</span><del>- rwiQueueMutex = std::make_unique<std::mutex>().release();
</del><span class="cx">
</span><span class="cx"> CFRunLoopSourceContext runLoopSourceContext = {0, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, RemoteInspectorHandleRunSourceGlobal};
</span><span class="cx"> rwiRunLoopSource = CFRunLoopSourceCreate(kCFAllocatorDefault, 1, &runLoopSourceContext);
</span><span class="lines">@@ -98,7 +95,7 @@
</span><span class="cx">
</span><span class="cx"> RemoteInspectorQueue queueCopy;
</span><span class="cx"> {
</span><del>- std::lock_guard<std::mutex> lock(debuggableConnection->queueMutex());
</del><ins>+ std::lock_guard<Lock> lock(debuggableConnection->queueMutex());
</ins><span class="cx"> queueCopy = debuggableConnection->queue();
</span><span class="cx"> debuggableConnection->clearQueue();
</span><span class="cx"> }
</span><span class="lines">@@ -152,7 +149,7 @@
</span><span class="cx">
</span><span class="cx"> bool RemoteInspectorDebuggableConnection::setup(bool isAutomaticInspection, bool automaticallyPause)
</span><span class="cx"> {
</span><del>- std::lock_guard<std::mutex> lock(m_debuggableMutex);
</del><ins>+ std::lock_guard<Lock> lock(m_debuggableMutex);
</ins><span class="cx">
</span><span class="cx"> if (!m_debuggable)
</span><span class="cx"> return false;
</span><span class="lines">@@ -160,7 +157,7 @@
</span><span class="cx"> ref();
</span><span class="cx"> dispatchAsyncOnDebuggable(^{
</span><span class="cx"> {
</span><del>- std::lock_guard<std::mutex> lock(m_debuggableMutex);
</del><ins>+ std::lock_guard<Lock> lock(m_debuggableMutex);
</ins><span class="cx"> if (!m_debuggable || !m_debuggable->remoteDebuggingAllowed() || m_debuggable->hasLocalDebugger()) {
</span><span class="cx"> RemoteInspector::singleton().setupFailed(identifier());
</span><span class="cx"> m_debuggable = nullptr;
</span><span class="lines">@@ -180,7 +177,7 @@
</span><span class="cx">
</span><span class="cx"> void RemoteInspectorDebuggableConnection::closeFromDebuggable()
</span><span class="cx"> {
</span><del>- std::lock_guard<std::mutex> lock(m_debuggableMutex);
</del><ins>+ std::lock_guard<Lock> lock(m_debuggableMutex);
</ins><span class="cx">
</span><span class="cx"> m_debuggable = nullptr;
</span><span class="cx"> }
</span><span class="lines">@@ -190,7 +187,7 @@
</span><span class="cx"> ref();
</span><span class="cx"> dispatchAsyncOnDebuggable(^{
</span><span class="cx"> {
</span><del>- std::lock_guard<std::mutex> lock(m_debuggableMutex);
</del><ins>+ std::lock_guard<Lock> 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">@@ -210,7 +207,7 @@
</span><span class="cx"> {
</span><span class="cx"> RemoteInspectorDebuggable* debuggable = nullptr;
</span><span class="cx"> {
</span><del>- std::lock_guard<std::mutex> lock(m_debuggableMutex);
</del><ins>+ std::lock_guard<Lock> lock(m_debuggableMutex);
</ins><span class="cx"> if (!m_debuggable)
</span><span class="cx"> return;
</span><span class="cx"> debuggable = m_debuggable;
</span><span class="lines">@@ -263,7 +260,7 @@
</span><span class="cx"> ASSERT(m_runLoop);
</span><span class="cx">
</span><span class="cx"> {
</span><del>- std::lock_guard<std::mutex> lock(m_queueMutex);
</del><ins>+ std::lock_guard<Lock> lock(m_queueMutex);
</ins><span class="cx"> m_queue.append(RemoteInspectorBlock(block));
</span><span class="cx"> }
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreinterpreterJSStackcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/interpreter/JSStack.cpp (188498 => 188499)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/interpreter/JSStack.cpp        2015-08-14 23:50:25 UTC (rev 188498)
+++ trunk/Source/JavaScriptCore/interpreter/JSStack.cpp        2015-08-15 00:14:52 UTC (rev 188499)
</span><span class="lines">@@ -1,5 +1,5 @@
</span><span class="cx"> /*
</span><del>- * Copyright (C) 2008, 2013, 2014 Apple Inc. All rights reserved.
</del><ins>+ * Copyright (C) 2008, 2013, 2014, 2015 Apple Inc. All rights reserved.
</ins><span class="cx"> *
</span><span class="cx"> * Redistribution and use in source and binary forms, with or without
</span><span class="cx"> * modification, are permitted provided that the following conditions
</span><span class="lines">@@ -33,17 +33,14 @@
</span><span class="cx"> #include "Interpreter.h"
</span><span class="cx"> #include "JSCInlines.h"
</span><span class="cx"> #include "Options.h"
</span><ins>+#include <wtf/Lock.h>
</ins><span class="cx">
</span><span class="cx"> namespace JSC {
</span><span class="cx">
</span><span class="cx"> #if !ENABLE(JIT)
</span><span class="cx"> static size_t committedBytesCount = 0;
</span><span class="cx">
</span><del>-static Mutex& stackStatisticsMutex()
-{
- DEPRECATED_DEFINE_STATIC_LOCAL(Mutex, staticMutex, ());
- return staticMutex;
-}
</del><ins>+static StaticLock stackStatisticsMutex;
</ins><span class="cx"> #endif // !ENABLE(JIT)
</span><span class="cx">
</span><span class="cx"> JSStack::JSStack(VM& vm)
</span><span class="lines">@@ -139,14 +136,9 @@
</span><span class="cx"> m_commitTop = highAddressWithReservedZone;
</span><span class="cx"> }
</span><span class="cx">
</span><del>-void JSStack::initializeThreading()
-{
- stackStatisticsMutex();
-}
-
</del><span class="cx"> void JSStack::addToCommittedByteCount(long byteCount)
</span><span class="cx"> {
</span><del>- MutexLocker locker(stackStatisticsMutex());
</del><ins>+ LockHolder locker(stackStatisticsMutex);
</ins><span class="cx"> ASSERT(static_cast<long>(committedBytesCount) + byteCount > -1);
</span><span class="cx"> committedBytesCount += byteCount;
</span><span class="cx"> }
</span><span class="lines">@@ -176,7 +168,7 @@
</span><span class="cx"> size_t JSStack::committedByteCount()
</span><span class="cx"> {
</span><span class="cx"> #if !ENABLE(JIT)
</span><del>- MutexLocker locker(stackStatisticsMutex());
</del><ins>+ LockHolder locker(stackStatisticsMutex);
</ins><span class="cx"> return committedBytesCount;
</span><span class="cx"> #else
</span><span class="cx"> // When using the C stack, we don't know how many stack pages are actually
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreinterpreterJSStackh"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/interpreter/JSStack.h (188498 => 188499)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/interpreter/JSStack.h        2015-08-14 23:50:25 UTC (rev 188498)
+++ trunk/Source/JavaScriptCore/interpreter/JSStack.h        2015-08-15 00:14:52 UTC (rev 188499)
</span><span class="lines">@@ -82,7 +82,6 @@
</span><span class="cx"> void gatherConservativeRoots(ConservativeRoots&) { }
</span><span class="cx"> void gatherConservativeRoots(ConservativeRoots&, JITStubRoutineSet&, CodeBlockSet&) { }
</span><span class="cx"> void sanitizeStack() { }
</span><del>- static void initializeThreading() { }
</del><span class="cx"> #else
</span><span class="cx"> ~JSStack();
</span><span class="cx">
</span><span class="lines">@@ -97,8 +96,6 @@
</span><span class="cx">
</span><span class="cx"> size_t size() const { return highAddress() - lowAddress(); }
</span><span class="cx">
</span><del>- static void initializeThreading();
-
</del><span class="cx"> void setReservedZoneSize(size_t);
</span><span class="cx">
</span><span class="cx"> inline Register* topOfStack();
</span></span></pre></div>
<a id="trunkSourceJavaScriptCorejitExecutableAllocatorcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/jit/ExecutableAllocator.cpp (188498 => 188499)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/jit/ExecutableAllocator.cpp        2015-08-14 23:50:25 UTC (rev 188498)
+++ trunk/Source/JavaScriptCore/jit/ExecutableAllocator.cpp        2015-08-15 00:14:52 UTC (rev 188499)
</span><span class="lines">@@ -31,10 +31,10 @@
</span><span class="cx"> #if ENABLE(EXECUTABLE_ALLOCATOR_DEMAND)
</span><span class="cx"> #include "CodeProfiling.h"
</span><span class="cx"> #include <wtf/HashSet.h>
</span><ins>+#include <wtf/Lock.h>
</ins><span class="cx"> #include <wtf/MetaAllocator.h>
</span><span class="cx"> #include <wtf/NeverDestroyed.h>
</span><span class="cx"> #include <wtf/PageReservation.h>
</span><del>-#include <wtf/ThreadingPrimitives.h>
</del><span class="cx"> #include <wtf/VMTags.h>
</span><span class="cx"> #endif
</span><span class="cx">
</span><span class="lines">@@ -56,7 +56,7 @@
</span><span class="cx"> DemandExecutableAllocator()
</span><span class="cx"> : MetaAllocator(jitAllocationGranule)
</span><span class="cx"> {
</span><del>- std::lock_guard<std::mutex> lock(allocatorsMutex());
</del><ins>+ std::lock_guard<StaticLock> 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">@@ -64,7 +64,7 @@
</span><span class="cx"> virtual ~DemandExecutableAllocator()
</span><span class="cx"> {
</span><span class="cx"> {
</span><del>- std::lock_guard<std::mutex> lock(allocatorsMutex());
</del><ins>+ std::lock_guard<StaticLock> lock(allocatorsMutex());
</ins><span class="cx"> allocators().remove(this);
</span><span class="cx"> }
</span><span class="cx"> for (unsigned i = 0; i < reservations.size(); ++i)
</span><span class="lines">@@ -74,7 +74,7 @@
</span><span class="cx"> static size_t bytesAllocatedByAllAllocators()
</span><span class="cx"> {
</span><span class="cx"> size_t total = 0;
</span><del>- std::lock_guard<std::mutex> lock(allocatorsMutex());
</del><ins>+ std::lock_guard<StaticLock> lock(allocatorsMutex());
</ins><span class="cx"> for (HashSet<DemandExecutableAllocator*>::const_iterator allocator = allocators().begin(); allocator != allocators().end(); ++allocator)
</span><span class="cx"> total += (*allocator)->bytesAllocated();
</span><span class="cx"> return total;
</span><span class="lines">@@ -83,7 +83,7 @@
</span><span class="cx"> static size_t bytesCommittedByAllocactors()
</span><span class="cx"> {
</span><span class="cx"> size_t total = 0;
</span><del>- std::lock_guard<std::mutex> lock(allocatorsMutex());
</del><ins>+ std::lock_guard<StaticLock> lock(allocatorsMutex());
</ins><span class="cx"> for (HashSet<DemandExecutableAllocator*>::const_iterator allocator = allocators().begin(); allocator != allocators().end(); ++allocator)
</span><span class="cx"> total += (*allocator)->bytesCommitted();
</span><span class="cx"> return total;
</span><span class="lines">@@ -92,7 +92,7 @@
</span><span class="cx"> #if ENABLE(META_ALLOCATOR_PROFILE)
</span><span class="cx"> static void dumpProfileFromAllAllocators()
</span><span class="cx"> {
</span><del>- std::lock_guard<std::mutex> lock(allocatorsMutex());
</del><ins>+ std::lock_guard<StaticLock> lock(allocatorsMutex());
</ins><span class="cx"> for (HashSet<DemandExecutableAllocator*>::const_iterator allocator = allocators().begin(); allocator != allocators().end(); ++allocator)
</span><span class="cx"> (*allocator)->dumpProfile();
</span><span class="cx"> }
</span><span class="lines">@@ -138,9 +138,9 @@
</span><span class="cx"> return sAllocators;
</span><span class="cx"> }
</span><span class="cx">
</span><del>- static std::mutex& allocatorsMutex()
</del><ins>+ static StaticLock& allocatorsMutex()
</ins><span class="cx"> {
</span><del>- static NeverDestroyed<std::mutex> mutex;
</del><ins>+ static StaticLock mutex;
</ins><span class="cx">
</span><span class="cx"> return mutex;
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceJavaScriptCorejitJITThunkscpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/jit/JITThunks.cpp (188498 => 188499)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/jit/JITThunks.cpp        2015-08-14 23:50:25 UTC (rev 188498)
+++ trunk/Source/JavaScriptCore/jit/JITThunks.cpp        2015-08-15 00:14:52 UTC (rev 188499)
</span><span class="lines">@@ -1,5 +1,5 @@
</span><span class="cx"> /*
</span><del>- * Copyright (C) 2012, 2013 Apple Inc. All rights reserved.
</del><ins>+ * Copyright (C) 2012, 2013, 2015 Apple Inc. All rights reserved.
</ins><span class="cx"> *
</span><span class="cx"> * Redistribution and use in source and binary forms, with or without
</span><span class="cx"> * modification, are permitted provided that the following conditions
</span><span class="lines">@@ -66,7 +66,7 @@
</span><span class="cx">
</span><span class="cx"> MacroAssemblerCodeRef JITThunks::ctiStub(VM* vm, ThunkGenerator generator)
</span><span class="cx"> {
</span><del>- Locker locker(m_lock);
</del><ins>+ LockHolder locker(m_lock);
</ins><span class="cx"> CTIStubMap::AddResult entry = m_ctiStubMap.add(generator, MacroAssemblerCodeRef());
</span><span class="cx"> if (entry.isNewEntry) {
</span><span class="cx"> // Compilation thread can only retrieve existing entries.
</span></span></pre></div>
<a id="trunkSourceJavaScriptCorejitJITThunksh"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/jit/JITThunks.h (188498 => 188499)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/jit/JITThunks.h        2015-08-14 23:50:25 UTC (rev 188498)
+++ trunk/Source/JavaScriptCore/jit/JITThunks.h        2015-08-15 00:14:52 UTC (rev 188499)
</span><span class="lines">@@ -63,10 +63,6 @@
</span><span class="cx"> void clearHostFunctionStubs();
</span><span class="cx">
</span><span class="cx"> private:
</span><del>- // Main thread can hold this lock for a while, so use an adaptive mutex.
- typedef Mutex Lock;
- typedef MutexLocker Locker;
-
</del><span class="cx"> void finalize(Handle<Unknown>, void* context) override;
</span><span class="cx">
</span><span class="cx"> typedef HashMap<ThunkGenerator, MacroAssemblerCodeRef> CTIStubMap;
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreprofilerProfilerDatabasecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/profiler/ProfilerDatabase.cpp (188498 => 188499)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/profiler/ProfilerDatabase.cpp        2015-08-14 23:50:25 UTC (rev 188498)
+++ trunk/Source/JavaScriptCore/profiler/ProfilerDatabase.cpp        2015-08-15 00:14:52 UTC (rev 188499)
</span><span class="lines">@@ -57,7 +57,7 @@
</span><span class="cx">
</span><span class="cx"> Bytecodes* Database::ensureBytecodesFor(CodeBlock* codeBlock)
</span><span class="cx"> {
</span><del>- Locker locker(m_lock);
</del><ins>+ LockHolder locker(m_lock);
</ins><span class="cx">
</span><span class="cx"> codeBlock = codeBlock->baselineVersion();
</span><span class="cx">
</span><span class="lines">@@ -75,7 +75,7 @@
</span><span class="cx">
</span><span class="cx"> void Database::notifyDestruction(CodeBlock* codeBlock)
</span><span class="cx"> {
</span><del>- Locker locker(m_lock);
</del><ins>+ LockHolder locker(m_lock);
</ins><span class="cx">
</span><span class="cx"> m_bytecodesMap.remove(codeBlock);
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreprofilerProfilerDatabaseh"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/profiler/ProfilerDatabase.h (188498 => 188499)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/profiler/ProfilerDatabase.h        2015-08-14 23:50:25 UTC (rev 188498)
+++ trunk/Source/JavaScriptCore/profiler/ProfilerDatabase.h        2015-08-15 00:14:52 UTC (rev 188499)
</span><span class="lines">@@ -32,6 +32,7 @@
</span><span class="cx"> #include "ProfilerCompilationKind.h"
</span><span class="cx"> #include <wtf/FastMalloc.h>
</span><span class="cx"> #include <wtf/HashMap.h>
</span><ins>+#include <wtf/Lock.h>
</ins><span class="cx"> #include <wtf/Noncopyable.h>
</span><span class="cx"> #include <wtf/PassRefPtr.h>
</span><span class="cx"> #include <wtf/SegmentedVector.h>
</span><span class="lines">@@ -70,21 +71,6 @@
</span><span class="cx"> void registerToSaveAtExit(const char* filename);
</span><span class="cx">
</span><span class="cx"> private:
</span><del>- // Use a full-blown adaptive mutex because:
- // - There is only one ProfilerDatabase per VM. The size overhead of the system's
- // mutex is negligible if you only have one of them.
- // - It's locked infrequently - once per bytecode generation, compilation, and
- // code block collection - so the fact that the fast path still requires a
- // function call is neglible.
- // - It tends to be held for a while. Currently, we hold it while generating
- // Profiler::Bytecodes for a CodeBlock. That's uncommon and shouldn't affect
- // performance, but if we did have contention, we would want a sensible,
- // power-aware backoff. An adaptive mutex will do this as a matter of course,
- // but a spinlock won't.
- typedef Mutex Lock;
- typedef MutexLocker Locker;
-
-
</del><span class="cx"> void addDatabaseToAtExit();
</span><span class="cx"> void removeDatabaseFromAtExit();
</span><span class="cx"> void performAtExitSave() const;
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreruntimeInitializeThreadingcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/runtime/InitializeThreading.cpp (188498 => 188499)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/runtime/InitializeThreading.cpp        2015-08-14 23:50:25 UTC (rev 188498)
+++ trunk/Source/JavaScriptCore/runtime/InitializeThreading.cpp        2015-08-15 00:14:52 UTC (rev 188499)
</span><span class="lines">@@ -1,5 +1,5 @@
</span><span class="cx"> /*
</span><del>- * Copyright (C) 2008 Apple Inc. All rights reserved.
</del><ins>+ * Copyright (C) 2008, 2015 Apple Inc. All rights reserved.
</ins><span class="cx"> *
</span><span class="cx"> * Redistribution and use in source and binary forms, with or without
</span><span class="cx"> * modification, are permitted provided that the following conditions
</span><span class="lines">@@ -56,7 +56,6 @@
</span><span class="cx"> std::call_once(initializeThreadingOnceFlag, []{
</span><span class="cx"> WTF::double_conversion::initialize();
</span><span class="cx"> WTF::initializeThreading();
</span><del>- GlobalJSLock::initialize();
</del><span class="cx"> Options::initialize();
</span><span class="cx"> if (Options::recordGCPauseTimes())
</span><span class="cx"> HeapStatistics::initialize();
</span><span class="lines">@@ -66,7 +65,6 @@
</span><span class="cx"> #if ENABLE(ASSEMBLER)
</span><span class="cx"> ExecutableAllocator::initializeAllocator();
</span><span class="cx"> #endif
</span><del>- JSStack::initializeThreading();
</del><span class="cx"> LLInt::initialize();
</span><span class="cx"> #ifndef NDEBUG
</span><span class="cx"> DisallowGC::initialize();
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreruntimeJSLockcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/runtime/JSLock.cpp (188498 => 188499)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/runtime/JSLock.cpp        2015-08-14 23:50:25 UTC (rev 188498)
+++ trunk/Source/JavaScriptCore/runtime/JSLock.cpp        2015-08-15 00:14:52 UTC (rev 188499)
</span><span class="lines">@@ -30,23 +30,18 @@
</span><span class="cx">
</span><span class="cx"> namespace JSC {
</span><span class="cx">
</span><del>-std::mutex* GlobalJSLock::s_sharedInstanceMutex;
</del><ins>+StaticLock GlobalJSLock::s_sharedInstanceMutex;
</ins><span class="cx">
</span><span class="cx"> GlobalJSLock::GlobalJSLock()
</span><span class="cx"> {
</span><del>- s_sharedInstanceMutex->lock();
</del><ins>+ s_sharedInstanceMutex.lock();
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> GlobalJSLock::~GlobalJSLock()
</span><span class="cx"> {
</span><del>- s_sharedInstanceMutex->unlock();
</del><ins>+ s_sharedInstanceMutex.unlock();
</ins><span class="cx"> }
</span><span class="cx">
</span><del>-void GlobalJSLock::initialize()
-{
- s_sharedInstanceMutex = new std::mutex();
-}
-
</del><span class="cx"> JSLockHolder::JSLockHolder(ExecState* exec)
</span><span class="cx"> : m_vm(&exec->vm())
</span><span class="cx"> {
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreruntimeJSLockh"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/runtime/JSLock.h (188498 => 188499)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/runtime/JSLock.h        2015-08-14 23:50:25 UTC (rev 188498)
+++ trunk/Source/JavaScriptCore/runtime/JSLock.h        2015-08-15 00:14:52 UTC (rev 188499)
</span><span class="lines">@@ -24,6 +24,7 @@
</span><span class="cx"> #include <mutex>
</span><span class="cx"> #include <thread>
</span><span class="cx"> #include <wtf/Assertions.h>
</span><ins>+#include <wtf/Lock.h>
</ins><span class="cx"> #include <wtf/Noncopyable.h>
</span><span class="cx"> #include <wtf/RefPtr.h>
</span><span class="cx"> #include <wtf/ThreadSafeRefCounted.h>
</span><span class="lines">@@ -60,10 +61,8 @@
</span><span class="cx"> public:
</span><span class="cx"> JS_EXPORT_PRIVATE GlobalJSLock();
</span><span class="cx"> JS_EXPORT_PRIVATE ~GlobalJSLock();
</span><del>-
- static void initialize();
</del><span class="cx"> private:
</span><del>- static std::mutex* s_sharedInstanceMutex;
</del><ins>+ static StaticLock s_sharedInstanceMutex;
</ins><span class="cx"> };
</span><span class="cx">
</span><span class="cx"> class JSLockHolder {
</span><span class="lines">@@ -133,7 +132,7 @@
</span><span class="cx"> unsigned dropAllLocks(DropAllLocks*);
</span><span class="cx"> void grabAllLocks(DropAllLocks*, unsigned lockCount);
</span><span class="cx">
</span><del>- std::mutex m_lock;
</del><ins>+ Lock m_lock;
</ins><span class="cx"> std::thread::id m_ownerThreadID;
</span><span class="cx"> intptr_t m_lockCount;
</span><span class="cx"> unsigned m_lockDropDepth;
</span></span></pre></div>
<a id="trunkSourceWTFChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WTF/ChangeLog (188498 => 188499)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WTF/ChangeLog        2015-08-14 23:50:25 UTC (rev 188498)
+++ trunk/Source/WTF/ChangeLog        2015-08-15 00:14:52 UTC (rev 188499)
</span><span class="lines">@@ -1,3 +1,21 @@
</span><ins>+2015-08-14 Filip Pizlo <fpizlo@apple.com>
+
+ Use WTF::Lock and WTF::Condition instead of WTF::Mutex, WTF::ThreadCondition, std::mutex, and std::condition_variable
+ https://bugs.webkit.org/show_bug.cgi?id=147999
+
+ Reviewed by Geoffrey Garen.
+
+ Relanding after fixing a deadlock on Linux.
+
+ * wtf/Condition.h: "using WTF::Condition".
+ * wtf/Lock.h:
+ (WTF::LockBase::lock):
+ (WTF::LockBase::tryLock): Add tryLock() because it turns out that we use it sometimes.
+ (WTF::LockBase::try_lock): unique_lock needs this.
+ (WTF::LockBase::unlock):
+ * wtf/ParkingLot.cpp:
+ (WTF::ParkingLot::parkConditionally): Work around a Linux C++ bug where wait_until with time_point::max() immediately returns and doesn't flash the lock.
+
</ins><span class="cx"> 2015-08-14 Keith Miller <keith_miller@apple.com>
</span><span class="cx">
</span><span class="cx"> cryptographicallyRandomValuesFromOS should use arc4random_buf on Darwin.
</span></span></pre></div>
<a id="trunkSourceWTFwtfConditionh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WTF/wtf/Condition.h (188498 => 188499)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WTF/wtf/Condition.h        2015-08-14 23:50:25 UTC (rev 188498)
+++ trunk/Source/WTF/wtf/Condition.h        2015-08-15 00:14:52 UTC (rev 188499)
</span><span class="lines">@@ -109,5 +109,7 @@
</span><span class="cx">
</span><span class="cx"> } // namespace WTF
</span><span class="cx">
</span><ins>+using WTF::Condition;
+
</ins><span class="cx"> #endif // WTF_Condition_h
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWTFwtfLockh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WTF/wtf/Lock.h (188498 => 188499)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WTF/wtf/Lock.h        2015-08-14 23:50:25 UTC (rev 188498)
+++ trunk/Source/WTF/wtf/Lock.h        2015-08-15 00:14:52 UTC (rev 188499)
</span><span class="lines">@@ -56,6 +56,23 @@
</span><span class="cx"> lockSlow();
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+ bool tryLock()
+ {
+ for (;;) {
+ uint8_t currentByteValue = m_byte.load();
+ if (currentByteValue & isHeldBit)
+ return false;
+ if (m_byte.compareExchangeWeak(currentByteValue, currentByteValue | isHeldBit))
+ return true;
+ }
+ }
+
+ // Need this version for std::unique_lock.
+ bool try_lock()
+ {
+ return tryLock();
+ }
+
</ins><span class="cx"> void unlock()
</span><span class="cx"> {
</span><span class="cx"> if (LIKELY(m_byte.compareExchangeWeak(isHeldBit, 0, std::memory_order_release))) {
</span></span></pre></div>
<a id="trunkSourceWTFwtfParkingLotcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WTF/wtf/ParkingLot.cpp (188498 => 188499)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WTF/wtf/ParkingLot.cpp        2015-08-14 23:50:25 UTC (rev 188498)
+++ trunk/Source/WTF/wtf/ParkingLot.cpp        2015-08-15 00:14:52 UTC (rev 188499)
</span><span class="lines">@@ -535,15 +535,28 @@
</span><span class="cx"> return false;
</span><span class="cx">
</span><span class="cx"> beforeSleep();
</span><del>-
</del><ins>+
</ins><span class="cx"> bool didGetDequeued;
</span><span class="cx"> {
</span><span class="cx"> std::unique_lock<std::mutex> locker(me->parkingLock);
</span><del>- while (me->address && std::chrono::steady_clock::now() < timeout)
- me->parkingCondition.wait_until(locker, timeout);
</del><ins>+ while (me->address && std::chrono::steady_clock::now() < timeout) {
+ // This is pretty funny. On Linux, if you wait until the max time, it immediately reports that you timed
+ // out. What's particularly bad about this is that it never releases the lock in that case. So, you loop
+ // forever without yielding to the thread that would wake you up.
+ if (timeout == std::chrono::steady_clock::time_point::max())
+ me->parkingCondition.wait(locker);
+ else
+ me->parkingCondition.wait_until(locker, timeout);
+
+ // Because of the above, we do this thing, which is hilariously awful, but ensures that the worst case is
+ // a CPU-eating spin but not a deadlock.
+ locker.unlock();
+ locker.lock();
+ }
</ins><span class="cx"> ASSERT(!me->address || me->address == address);
</span><span class="cx"> didGetDequeued = !me->address;
</span><span class="cx"> }
</span><ins>+
</ins><span class="cx"> if (didGetDequeued) {
</span><span class="cx"> // Great! We actually got dequeued rather than the timeout expiring.
</span><span class="cx"> return true;
</span></span></pre>
</div>
</div>
</body>
</html>