Bug 1595222 - Don't define an unused |AtomicReturnReg64| on x86. r=lth
authorJeff Walden <jwalden@mit.edu>
Tue, 12 Nov 2019 13:43:31 +0000
changeset 501596 283981b64bead149add4f1c730fe78b69968dd7d
parent 501595 71e2a5b608a5a1cb02597993cdc26d8166edc082
child 501597 e7b53d25d5d49ae470eaf3c8eeabeb2ca27808f7
push id114172
push userdluca@mozilla.com
push dateTue, 19 Nov 2019 11:31:10 +0000
treeherdermozilla-inbound@b5c5ba07d3db [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerslth
bugs1595222
milestone72.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 1595222 - Don't define an unused |AtomicReturnReg64| on x86. r=lth Differential Revision: https://phabricator.services.mozilla.com/D52424
js/src/jit/shared/AtomicOperations-shared-jit.cpp
--- a/js/src/jit/shared/AtomicOperations-shared-jit.cpp
+++ b/js/src/jit/shared/AtomicOperations-shared-jit.cpp
@@ -130,19 +130,17 @@ static constexpr Register AtomicVal2Reg 
 static constexpr Register AtomicTemp = edx;
 
 // 64-bit registers for cmpxchg8b.  ValReg/Val2Reg/Temp are not used in this
 // case.
 
 static constexpr Register64 AtomicValReg64(edx, eax);
 static constexpr Register64 AtomicVal2Reg64(ecx, ebx);
 
-// At the time of writing, ReturnReg64 is not edx:eax, but it is what our C/C++
-// compilers use.
-static constexpr Register64 AtomicReturnReg64(edx, eax);
+// AtomicReturnReg64 is unused on x86.
 
 #else
 #  error "Unsupported platform"
 #endif
 
 // These are useful shorthands and hide the meaningless uint/int distinction.
 
 static constexpr Scalar::Type SIZE8 = Scalar::Uint8;
@@ -427,19 +425,20 @@ static uint32_t GenCmpxchg(MacroAssemble
                            ReturnReg);
       break;
     case SIZE64:
       GenGpr64Arg(masm, &iter, AtomicValReg64);
       GenGpr64Arg(masm, &iter, AtomicVal2Reg64);
 #if defined(JS_CODEGEN_X86)
       MOZ_ASSERT(AtomicValReg64 == Register64(edx, eax));
       MOZ_ASSERT(AtomicVal2Reg64 == Register64(ecx, ebx));
+
+      // The return register edx:eax is a compiler/ABI assumption that is *not*
+      // the same as ReturnReg64, so it's correct not to use that here.
       masm.lock_cmpxchg8b(edx, eax, ecx, ebx, Operand(addr));
-
-      MOZ_ASSERT(AtomicReturnReg64 == Register64(edx, eax));
 #else
       masm.compareExchange64(sync, addr, AtomicValReg64, AtomicVal2Reg64,
                              AtomicReturnReg64);
 #endif
       break;
     default:
       MOZ_CRASH("Unknown size");
   }