Bug 1397052 - Don't update |result| after the acquire fence in nsThreadSafeRefCnt::operator--. r=froydnj
☠☠ backed out by 6169c1d97aab ☠ ☠
authorBobby Holley <bobbyholley@gmail.com>
Wed, 06 Sep 2017 10:57:19 -0700
changeset 428707 80e9cd4126b49eedcbd9310407997ec429bdc769
parent 428706 fe6a8ed3e4078a3364b1c1318d7ccb797d7d8bdd
child 428708 5f3d4bed0b45019f04aa44e2d353c2d22987185c
push id7761
push userjlund@mozilla.com
push dateFri, 15 Sep 2017 00:19:52 +0000
treeherdermozilla-beta@c38455951db4 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersfroydnj
bugs1397052
milestone57.0a1
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
Bug 1397052 - Don't update |result| after the acquire fence in nsThreadSafeRefCnt::operator--. r=froydnj MozReview-Commit-ID: 1Yp4kFXA5gV
xpcom/base/nsISupportsImpl.h
--- a/xpcom/base/nsISupportsImpl.h
+++ b/xpcom/base/nsISupportsImpl.h
@@ -352,17 +352,17 @@ public:
     // to the thread that destroys the object when it reads mValue with
     // acquire semantics.
     nsrefcnt result = mValue.fetch_sub(1, std::memory_order_release) - 1;
     if (result == 0) {
       // We're going to destroy the object on this thread, so we need
       // acquire semantics to synchronize with the memory released by
       // the last release on other threads, that is, to ensure that
       // writes prior to that release are now visible on this thread.
-      result = mValue.load(std::memory_order_acquire);
+      std::atomic_thread_fence(std::memory_order_acquire);
     }
     return result;
   }
 
   MOZ_ALWAYS_INLINE nsrefcnt operator=(nsrefcnt aValue)
   {
     // Use release semantics since we're not sure what the caller is
     // doing.