Bug 1534492 - Prevent RegAlloc from allocating an argument register for a temp used in passAbiArg base operand. r=sstangl a=pascalc
authorNicolas B. Pierron <nicolas.b.pierron@nbp.name>
Thu, 04 Apr 2019 13:33:34 +0000
changeset 526073 8d7c9a41c240c3577063cd4f34ef8c2647c54dd4
parent 526072 0c6cb165ba726b0987fbe1df7ffc65c714b4e562
child 526074 721460c8631ce01b7b475394c446b1d07486df9b
push id2032
push userffxbld-merge
push dateMon, 13 May 2019 09:36:57 +0000
treeherdermozilla-release@455c1065dcbe [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssstangl, pascalc
bugs1534492
milestone67.0
Bug 1534492 - Prevent RegAlloc from allocating an argument register for a temp used in passAbiArg base operand. r=sstangl a=pascalc Differential Revision: https://phabricator.services.mozilla.com/D25944
js/src/jit-test/tests/ion/sincos-abi-args-bug1534492.js
js/src/jit/Lowering.cpp
js/src/jit/none/MacroAssembler-none.h
new file mode 100644
--- /dev/null
+++ b/js/src/jit-test/tests/ion/sincos-abi-args-bug1534492.js
@@ -0,0 +1,6 @@
+x = [0];
+for (let i = 0; i < 1; ++i) {
+    try {
+        Math.cos(x[0])(Math.sin(x[0]));
+    } catch (e) {}
+}
--- a/js/src/jit/Lowering.cpp
+++ b/js/src/jit/Lowering.cpp
@@ -3421,17 +3421,18 @@ void LIRGenerator::visitArrayJoin(MArray
 
 void LIRGenerator::visitSinCos(MSinCos* ins) {
   MOZ_ASSERT(ins->type() == MIRType::SinCosDouble);
   MOZ_ASSERT(ins->input()->type() == MIRType::Double ||
              ins->input()->type() == MIRType::Float32 ||
              ins->input()->type() == MIRType::Int32);
 
   LSinCos* lir = new (alloc()) LSinCos(useRegisterAtStart(ins->input()),
-                                       tempFixed(CallTempReg0), temp());
+                                       tempFixed(CallTempNonArgRegs[0]),
+                                       tempFixed(CallTempNonArgRegs[1]));
   defineSinCos(lir, ins);
 }
 
 void LIRGenerator::visitStringSplit(MStringSplit* ins) {
   MOZ_ASSERT(ins->type() == MIRType::Object);
   MOZ_ASSERT(ins->string()->type() == MIRType::String);
   MOZ_ASSERT(ins->separator()->type() == MIRType::String);
 
--- a/js/src/jit/none/MacroAssembler-none.h
+++ b/js/src/jit/none/MacroAssembler-none.h
@@ -39,16 +39,19 @@ static constexpr Register OsrFrameReg{Re
 static constexpr Register PreBarrierReg{Registers::invalid_reg};
 static constexpr Register CallTempReg0{Registers::invalid_reg};
 static constexpr Register CallTempReg1{Registers::invalid_reg};
 static constexpr Register CallTempReg2{Registers::invalid_reg};
 static constexpr Register CallTempReg3{Registers::invalid_reg};
 static constexpr Register CallTempReg4{Registers::invalid_reg};
 static constexpr Register CallTempReg5{Registers::invalid_reg};
 static constexpr Register InvalidReg{Registers::invalid_reg};
+  static constexpr Register CallTempNonArgRegs[] = {InvalidReg, InvalidReg};
+  static const uint32_t NumCallTempNonArgRegs =
+    mozilla::ArrayLength(CallTempNonArgRegs);
 
 static constexpr Register IntArgReg0{Registers::invalid_reg};
 static constexpr Register IntArgReg1{Registers::invalid_reg};
 static constexpr Register IntArgReg2{Registers::invalid_reg};
 static constexpr Register IntArgReg3{Registers::invalid_reg};
 static constexpr Register HeapReg{Registers::invalid_reg};
 
 static constexpr Register RegExpTesterRegExpReg{Registers::invalid_reg};