Bug 917991 - Note a non-trivial implicit coupling. r=luke
authorDan Gohman <sunfish@google.com>
Tue, 24 Sep 2013 09:58:58 -0700
changeset 162279 b5d45a95d4ba33fc8d301ffd9a6720cbbce88c8a
parent 162278 b1439c3e38603f1fae0174ad83078e4e08567a97
child 162280 c7e4cab76ab8ae4ff5ac09e173b731ff62085f25
push id3066
push userakeybl@mozilla.com
push dateMon, 09 Dec 2013 19:58:46 +0000
treeherdermozilla-beta@a31a0dce83aa [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersluke
bugs917991
milestone27.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 917991 - Note a non-trivial implicit coupling. r=luke
js/src/jit/x64/MacroAssembler-x64.h
--- a/js/src/jit/x64/MacroAssembler-x64.h
+++ b/js/src/jit/x64/MacroAssembler-x64.h
@@ -939,16 +939,19 @@ class MacroAssemblerX64 : public MacroAs
 
     void notBoolean(const ValueOperand &val) {
         xorq(Imm32(1), val.valueReg());
     }
 
     // Unbox any non-double value into dest. Prefer unboxInt32 or unboxBoolean
     // instead if the source type is known.
     void unboxNonDouble(const ValueOperand &src, const Register &dest) {
+        // In a non-trivial coupling, we're not permitted to use ScratchReg when
+        // src and dest are different registers, because of how extractObject is
+        // implemented.
         if (src.valueReg() == dest) {
             movq(ImmWord(JSVAL_PAYLOAD_MASK), ScratchReg);
             andq(ScratchReg, dest);
         } else {
             movq(ImmWord(JSVAL_PAYLOAD_MASK), dest);
             andq(src.valueReg(), dest);
         }
     }
@@ -967,16 +970,18 @@ class MacroAssemblerX64 : public MacroAs
     void unboxObject(const Operand &src, const Register &dest) { unboxNonDouble(src, dest); }
 
     // Extended unboxing API. If the payload is already in a register, returns
     // that register. Otherwise, provides a move to the given scratch register,
     // and returns that.
     Register extractObject(const Address &address, Register scratch) {
         JS_ASSERT(scratch != ScratchReg);
         loadPtr(address, ScratchReg);
+        // We have a special coupling with unboxObject. As long as the registers
+        // aren't equal, it doesn't use ScratchReg.
         unboxObject(ValueOperand(ScratchReg), scratch);
         return scratch;
     }
     Register extractObject(const ValueOperand &value, Register scratch) {
         JS_ASSERT(scratch != ScratchReg);
         unboxObject(value, scratch);
         return scratch;
     }