Follow-up nitss for bug 685707.
authorDavid Anderson <danderson@mozilla.com>
Sat, 10 Sep 2011 19:24:28 -0700
changeset 105252 997030f1b8e3258dc0198e5f155e8b030cb8ef01
parent 105251 e6f9d57d883664ff578f48eaebfb551bac9226a7
child 105253 61cd956864cc6514a23698a77c6629df88315e1e
push id14706
push usereakhgari@mozilla.com
push dateTue, 11 Sep 2012 20:39:52 +0000
treeherdermozilla-inbound@d50bf1edaabe [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs685707
milestone9.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
Follow-up nitss for bug 685707.
js/src/ion/MIR.cpp
js/src/ion/shared/CodeGenerator-x86-shared.cpp
js/src/ion/x64/Assembler-x64.h
js/src/jit-test/tests/sunspider/check-math-spectral-norm.js
--- a/js/src/ion/MIR.cpp
+++ b/js/src/ion/MIR.cpp
@@ -560,25 +560,23 @@ MBinaryArithInstruction::foldsTo(bool us
 }
 
 MDefinition *
 MDiv::foldsTo(bool useValueNumbers)
 {
     if (specialization_ == MIRType_None)
         return this;
 
-    MDefinition *lhs = getOperand(0);
-    MDefinition *rhs = getOperand(1);
     if (MDefinition *folded = EvaluateConstantOperands(this))
         return folded;
 
     // 0 / x -> 0
     // x / 1 -> x
-    if (IsConstant(lhs, 0) || IsConstant(rhs, 1))
-        return lhs;
+    if (IsConstant(lhs(), 0) || IsConstant(rhs(), 1))
+        return lhs();
 
     return this;
 }
 
 void
 MBinaryArithInstruction::infer(const TypeOracle::Binary &b)
 {
     if (b.lhs == MIRType_Int32 && b.rhs == MIRType_Int32) {
--- a/js/src/ion/shared/CodeGenerator-x86-shared.cpp
+++ b/js/src/ion/shared/CodeGenerator-x86-shared.cpp
@@ -450,16 +450,19 @@ CodeGeneratorX86Shared::visitMulI(LMulI 
 
 bool
 CodeGeneratorX86Shared::visitDivI(LDivI *ins)
 {
     Register remainder = ToRegister(ins->remainder());
     Register lhs = ToRegister(ins->lhs());
     Register rhs = ToRegister(ins->rhs());
 
+    JS_ASSERT(remainder == edx);
+    JS_ASSERT(lhs == eax);
+
     // Prevent divide by zero.
     masm.testl(rhs, rhs);
     if (!bailoutIf(Assembler::Zero, ins->snapshot()))
         return false;
 
     // Prevent an integer overflow exception from -2147483648 / -1.
     Label notmin;
     masm.cmpl(lhs, Imm32(INT_MIN));
--- a/js/src/ion/x64/Assembler-x64.h
+++ b/js/src/ion/x64/Assembler-x64.h
@@ -61,16 +61,20 @@ static const Register r13 = { JSC::X86Re
 static const Register r14 = { JSC::X86Registers::r14 };
 static const Register r15 = { JSC::X86Registers::r15 };
 static const Register rdi = { JSC::X86Registers::edi };
 static const Register rsi = { JSC::X86Registers::esi };
 static const Register rbx = { JSC::X86Registers::ebx };
 static const Register rbp = { JSC::X86Registers::ebp };
 static const Register rsp = { JSC::X86Registers::esp };
 
+// Aliased x86 registers for common assertions.
+static const Register eax = rax;
+static const Register edx = rdx;
+
 static const Register InvalidReg = { JSC::X86Registers::invalid_reg };
 static const FloatRegister InvalidFloatReg = { JSC::X86Registers::invalid_xmm };
 
 static const Register StackPointer = rsp;
 static const Register JSReturnReg = rcx;
 static const Register ReturnReg = rax;
 static const Register ScratchReg = r11;
 static const FloatRegister ScratchFloatReg = { JSC::X86Registers::xmm15 };
--- a/js/src/jit-test/tests/sunspider/check-math-spectral-norm.js
+++ b/js/src/jit-test/tests/sunspider/check-math-spectral-norm.js
@@ -1,16 +1,14 @@
 // The Great Computer Language Shootout
 // http://shootout.alioth.debian.org/
 //
 // contributed by Ian Osgood
 
 function A(i,j) {
-  //var t = (i+j)*(i+j+1);
-  //var k = 2+i+1;
   return 1/((i+j)*(i+j+1)/2+i+1);
 }
 
 function Au(u,v) {
   for (var i=0; i<u.length; ++i) {
     var t = 0;
     for (var j=0; j<u.length; ++j)
       t += A(i,j) * u[j];