Change Atomic methods from using the_wrong_naming_conventions to using theRightNaming...
authorfpizlo@apple.com <fpizlo@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 25 Mar 2015 22:56:50 +0000 (22:56 +0000)
committerfpizlo@apple.com <fpizlo@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 25 Mar 2015 22:56:50 +0000 (22:56 +0000)
Rubber stamped by Geoffrey Garen.

Source/JavaScriptCore:

* bytecode/CodeBlock.cpp:
(JSC::CodeBlock::visitAggregate):

Source/WTF:

* wtf/Atomics.h:
(WTF::Atomic::load):
(WTF::Atomic::store):
(WTF::Atomic::compareExchangeWeak):
(WTF::Atomic::compareExchangeStrong):
(WTF::Atomic::compare_exchange_weak): Deleted.
(WTF::Atomic::compare_exchange_strong): Deleted.
* wtf/ByteSpinLock.h:
(WTF::ByteSpinLock::lock):
* wtf/SpinLock.h:
(WTF::SpinLockBase::lock):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@181979 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/JavaScriptCore/ChangeLog
Source/JavaScriptCore/bytecode/CodeBlock.cpp
Source/WTF/ChangeLog
Source/WTF/wtf/Atomics.h
Source/WTF/wtf/ByteSpinLock.h
Source/WTF/wtf/SpinLock.h

index a30ddc3..edca792 100644 (file)
@@ -1,3 +1,12 @@
+2015-03-25  Filip Pizlo  <fpizlo@apple.com>
+
+        Change Atomic methods from using the_wrong_naming_conventions to using theRightNamingConventions. Also make seq_cst the default.
+
+        Rubber stamped by Geoffrey Garen.
+
+        * bytecode/CodeBlock.cpp:
+        (JSC::CodeBlock::visitAggregate):
+
 2015-03-25  Joseph Pecoraro  <pecoraro@apple.com>
 
         Fix formatting in BuiltinExecutables
index 708b6e3..24bd405 100644 (file)
@@ -2203,7 +2203,7 @@ void CodeBlock::visitAggregate(SlotVisitor& visitor)
     // I may be asked to scan myself more than once, and it may even happen concurrently.
     // To this end, use an atomic operation to check (and set) if I've been called already.
     // Only one thread may proceed past this point - whichever one wins the atomic set race.
-    bool setByMe = m_visitAggregateHasBeenCalled.compare_exchange_strong(false, true, std::memory_order_acquire);
+    bool setByMe = m_visitAggregateHasBeenCalled.compareExchangeStrong(false, true);
     if (!setByMe)
         return;
 #endif // ENABLE(PARALLEL_GC)
index bad0152..f332bf9 100644 (file)
@@ -1,3 +1,21 @@
+2015-03-25  Filip Pizlo  <fpizlo@apple.com>
+
+        Change Atomic methods from using the_wrong_naming_conventions to using theRightNamingConventions. Also make seq_cst the default.
+
+        Rubber stamped by Geoffrey Garen.
+
+        * wtf/Atomics.h:
+        (WTF::Atomic::load):
+        (WTF::Atomic::store):
+        (WTF::Atomic::compareExchangeWeak):
+        (WTF::Atomic::compareExchangeStrong):
+        (WTF::Atomic::compare_exchange_weak): Deleted.
+        (WTF::Atomic::compare_exchange_strong): Deleted.
+        * wtf/ByteSpinLock.h:
+        (WTF::ByteSpinLock::lock):
+        * wtf/SpinLock.h:
+        (WTF::SpinLockBase::lock):
+
 2015-03-24  Beth Dakin  <bdakin@apple.com>
 
         Add events related to force click gesture
index d4a2f9d..c4d560e 100644 (file)
@@ -81,18 +81,21 @@ namespace WTF {
 
 template<typename T>
 struct Atomic {
+    // Don't pass a non-default value for the order parameter unless you really know
+    // what you are doing and have thought about it very hard. The cost of seq_cst
+    // is usually not high enough to justify the risk.
 
-    T load(std::memory_order order) const { return value.load(order); }
+    T load(std::memory_order order = std::memory_order_seq_cst) const { return value.load(order); }
 
-    void store(T desired, std::memory_order order) { value.store(desired, order); }
+    void store(T desired, std::memory_order order = std::memory_order_seq_cst) { value.store(desired, order); }
 
-    bool compare_exchange_weak(T expected, T desired, std::memory_order order)
+    bool compareExchangeWeak(T expected, T desired, std::memory_order order = std::memory_order_seq_cst)
     {
         T expectedOrActual = expected;
         return value.compare_exchange_weak(expectedOrActual, desired, order);
     }
 
-    bool compare_exchange_strong(T expected, T desired, std::memory_order order)
+    bool compareExchangeStrong(T expected, T desired, std::memory_order order = std::memory_order_seq_cst)
     {
         T expectedOrActual = expected;
         return value.compare_exchange_strong(expectedOrActual, desired, order);
index bea1b1b..9818e50 100644 (file)
@@ -44,7 +44,7 @@ public:
 
     void lock()
     {
-        while (!m_lock.compare_exchange_weak(false, true, std::memory_order_acquire))
+        while (!m_lock.compareExchangeWeak(false, true, std::memory_order_acquire))
             std::this_thread::yield();
     }
     
index 73fa286..90944e6 100644 (file)
@@ -38,7 +38,7 @@ struct SpinLockBase {
 
     void lock()
     {
-        while (!m_lock.compare_exchange_weak(0, 1, std::memory_order_acquire))
+        while (!m_lock.compareExchangeWeak(0, 1, std::memory_order_acquire))
             std::this_thread::yield();
     }