Backed out changeset f434624463d9 (bug 965837) for bustage.
authorRyan VanderMeulen <ryanvm@gmail.com>
Thu, 30 Jan 2014 16:59:57 -0500
changeset 166115 09e27ba697c203f714be88702b65ff4ce4a8653e
parent 166114 f434624463d94a5ab14ad51ee4eed806e5a0dc40
child 166116 d890f0a4b6555a6b8343443154550a181e310438
push id39120
push userryanvm@gmail.com
push dateThu, 30 Jan 2014 22:00:02 +0000
treeherdermozilla-inbound@09e27ba697c2 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs965837
milestone29.0a1
backs outf434624463d94a5ab14ad51ee4eed806e5a0dc40
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Backed out changeset f434624463d9 (bug 965837) for bustage.
mfbt/Atomics.h
mfbt/tests/TestAtomics.cpp
--- a/mfbt/Atomics.h
+++ b/mfbt/Atomics.h
@@ -929,17 +929,17 @@ class Atomic;
  * Atomic<T> implementation for integral types.
  *
  * In addition to atomic store and load operations, compound assignment and
  * increment/decrement operators are implemented which perform the
  * corresponding read-modify-write operation atomically.  Finally, an atomic
  * swap method is provided.
  */
 template<typename T, MemoryOrdering Order>
-class Atomic<T, Order, typename EnableIf<IsIntegral<T>::value && !IsSame<T, bool>::value>::Type>
+class Atomic<T, Order, typename EnableIf<IsIntegral<T>::value>::Type>
   : public detail::AtomicBaseIncDec<T, Order>
 {
     typedef typename detail::AtomicBaseIncDec<T, Order> Base;
 
   public:
     MOZ_CONSTEXPR Atomic() : Base() {}
     MOZ_CONSTEXPR Atomic(T aInit) : Base(aInit) {}
 
@@ -1001,49 +1001,11 @@ class Atomic<T, Order, typename EnableIf
     MOZ_CONSTEXPR Atomic(T aInit) : Base(aInit) {}
 
     using Base::operator=;
 
   private:
     Atomic(Atomic<T, Order>& aOther) MOZ_DELETE;
 };
 
-/**
- * Atomic<T> implementation for boolean types.
- *
- * The atomic store and load operations and the atomic swap method is provided.
- *
- * Note:
- *
- * - sizeof(Atomic<bool>) != sizeof(bool) for some implementations of
- *   bool and/or some implementations of std::atomic. This is allowed in
- *   [atomic.types.generic]p9.
- *
- * - It's not obvious whether the 8-bit atomic functions on Windows are always
- *   inlined or not. If they are not inlined, the corresponding functions in the
- *   runtime library are not available on Windows XP. This is why we implement
- *   Atomic<bool> with an underlying type of uint32_t.
- */
-template<MemoryOrdering Order>
-class Atomic<bool, Order>
-  : protected detail::AtomicBase<uint32_t, Order>
-{
-    typedef typename detail::AtomicBase<uint32_t, Order> Base;
-
-  public:
-    MOZ_CONSTEXPR Atomic() : Base() {}
-    MOZ_CONSTEXPR Atomic(bool aInit) : Base(aInit) {}
-
-    // We provide boolean wrappers for the underlying AtomicBase methods.
-    operator bool() const { return Base::operator uint32_t(); }
-    bool operator=(bool aValue) { return Base::operator=(aValue); }
-    bool exchange(bool aValue) { return Base::exchange(aValue); }
-    bool compareExchange(bool aOldValue, bool aNewValue) {
-      return Base::compareExchange(aOldValue, aNewValue);
-    }
-
-  private:
-    Atomic(Atomic<bool, Order>& aOther) MOZ_DELETE;
-};
-
 } // namespace mozilla
 
 #endif /* mozilla_Atomics_h */
--- a/mfbt/tests/TestAtomics.cpp
+++ b/mfbt/tests/TestAtomics.cpp
@@ -160,46 +160,16 @@ TestEnumWithOrdering()
   MOZ_ASSERT(!boolResult, "CAS should have returned false.");
   MOZ_ASSERT(atomic == EnumType_1, "CAS shouldn't have done anything.");
 
   boolResult = atomic.compareExchange(EnumType_1, EnumType_3);
   MOZ_ASSERT(boolResult, "CAS should have succeeded.");
   MOZ_ASSERT(atomic == EnumType_3, "CAS should have changed atomic's value.");
 }
 
-template <MemoryOrdering Order>
-static void
-TestBoolWithOrdering()
-{
-  Atomic<bool, Order> atomic(false);
-  MOZ_ASSERT(atomic == false, "Atomic variable did not initialize");
-
-  // Test assignment
-  DebugOnly<bool> result;
-  result = (atomic = true);
-  MOZ_ASSERT(atomic == true, "Atomic assignment failed");
-  MOZ_ASSERT(result == true, "Atomic assignment returned the wrong value");
-
-  // Test exchange.
-  atomic = false;
-  result = atomic.exchange(true);
-  MOZ_ASSERT(atomic == true, "Atomic exchange did not work");
-  MOZ_ASSERT(result == false, "Atomic exchange returned the wrong value");
-
-  // Test CAS.
-  atomic = false;
-  DebugOnly<bool> boolResult = atomic.compareExchange(true, false);
-  MOZ_ASSERT(!boolResult, "CAS should have returned false.");
-  MOZ_ASSERT(atomic == false, "CAS shouldn't have done anything.");
-
-  boolResult = atomic.compareExchange(false, true);
-  MOZ_ASSERT(boolResult, "CAS should have succeeded.");
-  MOZ_ASSERT(atomic == true, "CAS should have changed atomic's value.");
-}
-
 template <typename T>
 static void
 TestType()
 {
   TestTypeWithOrdering<T, SequentiallyConsistent>();
   TestTypeWithOrdering<T, ReleaseAcquire>();
   TestTypeWithOrdering<T, Relaxed>();
 }
@@ -216,29 +186,20 @@ TestPointer()
 static void
 TestEnum()
 {
   TestEnumWithOrdering<SequentiallyConsistent>();
   TestEnumWithOrdering<ReleaseAcquire>();
   TestEnumWithOrdering<Relaxed>();
 }
 
-static void
-TestBool()
-{
-  TestBoolWithOrdering<SequentiallyConsistent>();
-  TestBoolWithOrdering<ReleaseAcquire>();
-  TestBoolWithOrdering<Relaxed>();
-}
-
 int main()
 {
   TestType<uint32_t>();
   TestType<int32_t>();
   TestType<intptr_t>();
   TestType<uintptr_t>();
   TestPointer<int>();
   TestPointer<float>();
   TestPointer<uint16_t*>();
   TestPointer<uint32_t*>();
   TestEnum();
-  TestBool();
 }