Bug 1301400: Baseline Wasm Compiler: Part 17: Implement Cmp64Set, r=lth
authorh4writer <hv1989@gmail.com>
Thu, 29 Sep 2016 22:33:23 +0200
changeset 315917 78cc9391941160535c0fe339d6563a75ad9007a7
parent 315916 ef547be7cb2f35d01bfffd9eaeeeacc1cdb98c17
child 315918 07ba0c152db6a8953dee68c8a7b76e2a61f65dba
push id20634
push usercbook@mozilla.com
push dateFri, 30 Sep 2016 10:10:13 +0000
treeherderfx-team@afe79b010d13 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerslth
bugs1301400
milestone52.0a1
Bug 1301400: Baseline Wasm Compiler: Part 17: Implement Cmp64Set, r=lth
js/src/asmjs/WasmBaselineCompile.cpp
--- a/js/src/asmjs/WasmBaselineCompile.cpp
+++ b/js/src/asmjs/WasmBaselineCompile.cpp
@@ -2833,16 +2833,24 @@ class BaseCompiler
         MOZ_CRASH("BaseCompiler platform hook: convertI32ToF64");
 #endif
     }
 
     void cmp64Set(Assembler::Condition cond, RegI64 lhs, RegI64 rhs, RegI32 dest) {
 #if defined(JS_CODEGEN_X64)
         masm.cmpq(rhs.reg.reg, lhs.reg.reg);
         masm.emitSet(cond, dest.reg);
+#elif defined(JS_CODEGEN_X86)
+        Label done, condTrue;
+        masm.branch64(cond, lhs.reg, rhs.reg, &condTrue);
+        masm.move32(Imm32(0), dest.reg);
+        masm.jump(&done);
+        masm.bind(&condTrue);
+        masm.move32(Imm32(1), dest.reg);
+        masm.bind(&done);
 #else
         MOZ_CRASH("BaseCompiler platform hook: cmp64Set");
 #endif
     }
 
     void unreachableTrap()
     {
         masm.jump(wasm::JumpTarget::Unreachable);
@@ -4166,16 +4174,17 @@ BaseCompiler::emitEqzI64()
     // TODO / OPTIMIZE: Boolean evaluation for control
     // TODO / OPTIMIZE: Avoid the temp register
     RegI64 r0 = popI64();
     RegI64 r1 = needI64();
     setI64(0, r1);
     RegI32 i0 = fromI64(r0);
     cmp64Set(Assembler::Equal, r0, r1, i0);
     freeI64(r1);
+    freeI64Except(r0, i0);
     pushI32(i0);
 }
 
 void
 BaseCompiler::emitClzI32()
 {
     RegI32 r0 = popI32();
     masm.clz32(r0.reg, r0.reg, IsKnownNotZero(false));
@@ -6048,16 +6057,17 @@ BaseCompiler::emitCompareI64(JSOp compar
         break;
       case JSOP_GT:
         cmp64Set(u ? Assembler::Above : Assembler::GreaterThan, r0, r1, i0);
         break;
       default:
         MOZ_CRASH("Compiler bug: Unexpected compare opcode");
     }
     freeI64(r1);
+    freeI64Except(r0, i0);
     pushI32(i0);
 }
 
 void
 BaseCompiler::emitCompareF32(JSOp compareOp, MCompare::CompareType compareType)
 {
     MOZ_ASSERT(compareType == MCompare::Compare_Float32);
     Label across;