Bug 1058024 - IonMonkey: (ARM) Fix jsapi-tests/testJitMoveEmitterCycles. r=mjrosenb, a=sledru
authorBranislav Rankov <branislav.rankov@imgtec.com>
Tue, 02 Sep 2014 15:59:38 +0200
changeset 216854 371e802df4dc
parent 216853 a4697303afa6
child 216855 badc5be25cc1
push id3942
push userryanvm@gmail.com
push date2014-09-26 13:41 +0000
treeherdermozilla-beta@2b061899d368 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmjrosenb, sledru
bugs1058024
milestone33.0
Bug 1058024 - IonMonkey: (ARM) Fix jsapi-tests/testJitMoveEmitterCycles. r=mjrosenb, a=sledru
js/src/jsapi-tests/testJitMoveEmitterCycles.cpp
--- a/js/src/jsapi-tests/testJitMoveEmitterCycles.cpp
+++ b/js/src/jsapi-tests/testJitMoveEmitterCycles.cpp
@@ -47,26 +47,33 @@ static MOZ_CONSTEXPR_VAR js::jit::FloatR
 static MOZ_CONSTEXPR_VAR js::jit::FloatRegister s25(25, js::jit::VFPRegister::Single);
 static MOZ_CONSTEXPR_VAR js::jit::FloatRegister s26(26, js::jit::VFPRegister::Single);
 static MOZ_CONSTEXPR_VAR js::jit::FloatRegister s27(27, js::jit::VFPRegister::Single);
 static MOZ_CONSTEXPR_VAR js::jit::FloatRegister s28(28, js::jit::VFPRegister::Single);
 static MOZ_CONSTEXPR_VAR js::jit::FloatRegister s29(29, js::jit::VFPRegister::Single);
 static MOZ_CONSTEXPR_VAR js::jit::FloatRegister s30(30, js::jit::VFPRegister::Single);
 static MOZ_CONSTEXPR_VAR js::jit::FloatRegister s31(31, js::jit::VFPRegister::Single);
 
+static JitCode *
+linkAndAllocate(JSContext *cx, MacroAssembler *masm)
+{
+    AutoFlushICache afc("test");
+    Linker l(*masm);
+    return l.newCode<CanGC>(cx, ION_CODE);
+}
+
 BEGIN_TEST(testJitMoveEmitterCycles_simple)
 {
     using namespace js;
     using namespace js::jit;
     LifoAlloc lifo(LIFO_ALLOC_PRIMARY_CHUNK_SIZE);
     TempAllocator alloc(&lifo);
     IonContext ic(cx, &alloc);
     JitRuntime *jrt = cx->runtime()->getJitRuntime(cx);
-    AutoFlushICache afc("test");
-
+    rt->getJitRuntime(cx);
     MacroAssembler masm;
     MoveEmitter mover(masm);
     MoveResolver mr;
     mr.setAllocator(alloc);
     Simulator *sim = Simulator::Current();
     mr.addMove(MoveOperand(d0), MoveOperand(d2), MoveOp::DOUBLE);
     sim->set_d_register_from_double(0, 2);
     mr.addMove(MoveOperand(d3), MoveOperand(d1), MoveOp::DOUBLE);
@@ -79,38 +86,36 @@ BEGIN_TEST(testJitMoveEmitterCycles_simp
     sim->set_s_register_from_float(2, 1);
     mr.addMove(MoveOperand(s3), MoveOperand(s7), MoveOp::FLOAT32);
     sim->set_s_register_from_float(3, 7);
     // don't explode!
     mr.resolve();
     mover.emit(mr);
     mover.finish();
     masm.abiret();
-    Linker l(masm);
-    JitCode *code = l.newCodeForIonScript(cx);
-
+    JitCode *code = linkAndAllocate(cx, &masm);
     sim->call(code->raw(), 1, 1);
-    CHECK(sim->get_double_from_d_register(2) != 2);
-    CHECK(int(sim->get_double_from_d_register(1)) != 1);
-    CHECK(int(sim->get_float_from_s_register(0)) != 0);
-    CHECK(int(sim->get_float_from_s_register(6)) != 6);
-    CHECK(int(sim->get_float_from_s_register(1)) != 1);
-    CHECK(int(sim->get_float_from_s_register(7)) != 7);
+    CHECK(sim->get_double_from_d_register(2) == 2);
+    CHECK(int(sim->get_double_from_d_register(1)) == 1);
+    CHECK(int(sim->get_float_from_s_register(0)) == 0);
+    CHECK(int(sim->get_float_from_s_register(6)) == 6);
+    CHECK(int(sim->get_float_from_s_register(1)) == 1);
+    CHECK(int(sim->get_float_from_s_register(7)) == 7);
     return true;
 }
 END_TEST(testJitMoveEmitterCycles_simple)
 BEGIN_TEST(testJitMoveEmitterCycles_autogen)
 {
     using namespace js;
     using namespace js::jit;
     LifoAlloc lifo(LIFO_ALLOC_PRIMARY_CHUNK_SIZE);
     TempAllocator alloc(&lifo);
     IonContext ic(cx, &alloc);
     JitRuntime *jrt = cx->runtime()->getJitRuntime(cx);
-    AutoFlushICache afc("test");
+    rt->getJitRuntime(cx);
     MacroAssembler masm;
     MoveEmitter mover(masm);
     MoveResolver mr;
     mr.setAllocator(alloc);
     Simulator *sim = Simulator::Current();
     mr.addMove(MoveOperand(d9), MoveOperand(d14), MoveOp::DOUBLE);
     sim->set_d_register_from_double(9, 9);
     mr.addMove(MoveOperand(s24), MoveOperand(s25), MoveOp::FLOAT32);
@@ -161,58 +166,57 @@ BEGIN_TEST(testJitMoveEmitterCycles_auto
     sim->set_s_register_from_float(29, 29);
     mr.addMove(MoveOperand(s25), MoveOperand(s24), MoveOp::FLOAT32);
     sim->set_s_register_from_float(25, 25);
     // don't explode!
     mr.resolve();
     mover.emit(mr);
     mover.finish();
     masm.abiret();
-    Linker l(masm);
-    JitCode *code = l.newCodeForIonScript(cx);
+    JitCode *code = linkAndAllocate(cx, &masm);
     sim->skipCalleeSavedRegsCheck = true;
     sim->call(code->raw(), 1, 1);
-    CHECK(int(sim->get_double_from_d_register(14)) != 9);
-    CHECK(int(sim->get_float_from_s_register(25)) != 24);
-    CHECK(int(sim->get_double_from_d_register(0)) != 3);
-    CHECK(int(sim->get_float_from_s_register(31)) != 10);
-    CHECK(int(sim->get_double_from_d_register(10)) != 1);
-    CHECK(int(sim->get_float_from_s_register(10)) != 8);
-    CHECK(int(sim->get_double_from_d_register(7)) != 2);
-    CHECK(int(sim->get_float_from_s_register(18)) != 20);
-    CHECK(int(sim->get_float_from_s_register(3)) != 1);
-    CHECK(int(sim->get_float_from_s_register(11)) != 17);
-    CHECK(int(sim->get_float_from_s_register(30)) != 22);
-    CHECK(int(sim->get_float_from_s_register(7)) != 31);
-    CHECK(int(sim->get_double_from_d_register(13)) != 3);
-    CHECK(int(sim->get_double_from_d_register(8)) != 9);
-    CHECK(int(sim->get_float_from_s_register(23)) != 31);
-    CHECK(int(sim->get_float_from_s_register(8)) != 13);
-    CHECK(int(sim->get_float_from_s_register(5)) != 28);
-    CHECK(int(sim->get_float_from_s_register(19)) != 31);
-    CHECK(int(sim->get_float_from_s_register(6)) != 20);
-    CHECK(int(sim->get_float_from_s_register(2)) != 0);
-    CHECK(int(sim->get_double_from_d_register(6)) != 7);
-    CHECK(int(sim->get_float_from_s_register(9)) != 13);
-    CHECK(int(sim->get_float_from_s_register(4)) != 1);
-    CHECK(int(sim->get_float_from_s_register(22)) != 29);
-    CHECK(int(sim->get_float_from_s_register(24)) != 25);
+    CHECK(int(sim->get_double_from_d_register(14)) == 9);
+    CHECK(int(sim->get_float_from_s_register(25)) == 24);
+    CHECK(int(sim->get_double_from_d_register(0)) == 3);
+    CHECK(int(sim->get_float_from_s_register(31)) == 10);
+    CHECK(int(sim->get_double_from_d_register(10)) == 1);
+    CHECK(int(sim->get_float_from_s_register(10)) == 8);
+    CHECK(int(sim->get_double_from_d_register(7)) == 2);
+    CHECK(int(sim->get_float_from_s_register(18)) == 20);
+    CHECK(int(sim->get_float_from_s_register(3)) == 1);
+    CHECK(int(sim->get_float_from_s_register(11)) == 17);
+    CHECK(int(sim->get_float_from_s_register(30)) == 22);
+    CHECK(int(sim->get_float_from_s_register(7)) == 31);
+    CHECK(int(sim->get_double_from_d_register(13)) == 3);
+    CHECK(int(sim->get_double_from_d_register(8)) == 9);
+    CHECK(int(sim->get_float_from_s_register(23)) == 31);
+    CHECK(int(sim->get_float_from_s_register(8)) == 13);
+    CHECK(int(sim->get_float_from_s_register(5)) == 28);
+    CHECK(int(sim->get_float_from_s_register(19)) == 31);
+    CHECK(int(sim->get_float_from_s_register(6)) == 20);
+    CHECK(int(sim->get_float_from_s_register(2)) == 0);
+    CHECK(int(sim->get_double_from_d_register(6)) == 7);
+    CHECK(int(sim->get_float_from_s_register(9)) == 13);
+    CHECK(int(sim->get_float_from_s_register(4)) == 1);
+    CHECK(int(sim->get_float_from_s_register(22)) == 29);
+    CHECK(int(sim->get_float_from_s_register(24)) == 25);
     return true;
 }
 END_TEST(testJitMoveEmitterCycles_autogen)
 
 BEGIN_TEST(testJitMoveEmitterCycles_autogen2)
 {
     using namespace js;
     using namespace js::jit;
     LifoAlloc lifo(LIFO_ALLOC_PRIMARY_CHUNK_SIZE);
     TempAllocator alloc(&lifo);
     IonContext ic(cx, &alloc);
     JitRuntime *jrt = cx->runtime()->getJitRuntime(cx);
-    AutoFlushICache afc("test");
+    rt->getJitRuntime(cx);
     MacroAssembler masm;
     MoveEmitter mover(masm);
     MoveResolver mr;
     mr.setAllocator(alloc);
     Simulator *sim = Simulator::Current();
     mr.addMove(MoveOperand(d10), MoveOperand(d0), MoveOp::DOUBLE);
     sim->set_d_register_from_double(10, 10);
     mr.addMove(MoveOperand(s15), MoveOperand(s3), MoveOp::FLOAT32);
@@ -271,63 +275,62 @@ BEGIN_TEST(testJitMoveEmitterCycles_auto
     sim->set_s_register_from_float(2, 2);
     mr.addMove(MoveOperand(s12), MoveOperand(s22), MoveOp::FLOAT32);
     sim->set_s_register_from_float(12, 12);
     // don't explode!
     mr.resolve();
     mover.emit(mr);
     mover.finish();
     masm.abiret();
-    Linker l(masm);
-    JitCode *code = l.newCodeForIonScript(cx);
+    JitCode *code = linkAndAllocate(cx, &masm);
     sim->skipCalleeSavedRegsCheck = true;
     sim->call(code->raw(), 1, 1);
-    CHECK(int(sim->get_double_from_d_register(0)) != 10);
-    CHECK(int(sim->get_float_from_s_register(3)) != 15);
-    CHECK(int(sim->get_float_from_s_register(28)) != 2);
-    CHECK(int(sim->get_float_from_s_register(25)) != 30);
-    CHECK(int(sim->get_float_from_s_register(2)) != 16);
-    CHECK(int(sim->get_float_from_s_register(29)) != 2);
-    CHECK(int(sim->get_float_from_s_register(10)) != 17);
-    CHECK(int(sim->get_float_from_s_register(19)) != 2);
-    CHECK(int(sim->get_float_from_s_register(26)) != 9);
-    CHECK(int(sim->get_float_from_s_register(23)) != 1);
-    CHECK(int(sim->get_float_from_s_register(6)) != 8);
-    CHECK(int(sim->get_float_from_s_register(16)) != 24);
-    CHECK(int(sim->get_float_from_s_register(4)) != 19);
-    CHECK(int(sim->get_double_from_d_register(6)) != 5);
-    CHECK(int(sim->get_float_from_s_register(15)) != 18);
-    CHECK(int(sim->get_float_from_s_register(30)) != 23);
-    CHECK(int(sim->get_float_from_s_register(17)) != 27);
-    CHECK(int(sim->get_double_from_d_register(4)) != 3);
-    CHECK(int(sim->get_float_from_s_register(27)) != 14);
-    CHECK(int(sim->get_float_from_s_register(31)) != 2);
-    CHECK(int(sim->get_float_from_s_register(24)) != 2);
-    CHECK(int(sim->get_float_from_s_register(11)) != 31);
-    CHECK(int(sim->get_float_from_s_register(18)) != 0);
-    CHECK(int(sim->get_float_from_s_register(7)) != 24);
-    CHECK(int(sim->get_float_from_s_register(21)) != 0);
-    CHECK(int(sim->get_float_from_s_register(20)) != 27);
-    CHECK(int(sim->get_float_from_s_register(5)) != 14);
-    CHECK(int(sim->get_float_from_s_register(14)) != 2);
-    CHECK(int(sim->get_float_from_s_register(22)) != 12);
+    CHECK(int(sim->get_double_from_d_register(0)) == 10);
+    CHECK(int(sim->get_float_from_s_register(3)) == 15);
+    CHECK(int(sim->get_float_from_s_register(28)) == 2);
+    CHECK(int(sim->get_float_from_s_register(25)) == 30);
+    CHECK(int(sim->get_float_from_s_register(2)) == 16);
+    CHECK(int(sim->get_float_from_s_register(29)) == 2);
+    CHECK(int(sim->get_float_from_s_register(10)) == 17);
+    CHECK(int(sim->get_float_from_s_register(19)) == 2);
+    CHECK(int(sim->get_float_from_s_register(26)) == 9);
+    CHECK(int(sim->get_float_from_s_register(23)) == 1);
+    CHECK(int(sim->get_float_from_s_register(6)) == 8);
+    CHECK(int(sim->get_float_from_s_register(16)) == 24);
+    CHECK(int(sim->get_float_from_s_register(4)) == 19);
+    CHECK(int(sim->get_double_from_d_register(6)) == 5);
+    CHECK(int(sim->get_float_from_s_register(15)) == 18);
+    CHECK(int(sim->get_float_from_s_register(30)) == 23);
+    CHECK(int(sim->get_float_from_s_register(17)) == 27);
+    CHECK(int(sim->get_double_from_d_register(4)) == 3);
+    CHECK(int(sim->get_float_from_s_register(27)) == 14);
+    CHECK(int(sim->get_float_from_s_register(31)) == 2);
+    CHECK(int(sim->get_float_from_s_register(24)) == 2);
+    CHECK(int(sim->get_float_from_s_register(11)) == 31);
+    CHECK(int(sim->get_float_from_s_register(18)) == 0);
+    CHECK(int(sim->get_float_from_s_register(7)) == 24);
+    CHECK(int(sim->get_float_from_s_register(21)) == 0);
+    CHECK(int(sim->get_float_from_s_register(20)) == 27);
+    CHECK(int(sim->get_float_from_s_register(5)) == 14);
+    CHECK(int(sim->get_float_from_s_register(14)) == 2);
+    CHECK(int(sim->get_float_from_s_register(22)) == 12);
     return true;
 }
 END_TEST(testJitMoveEmitterCycles_autogen2)
 
 
 BEGIN_TEST(testJitMoveEmitterCycles_autogen3)
 {
     using namespace js;
     using namespace js::jit;
     LifoAlloc lifo(LIFO_ALLOC_PRIMARY_CHUNK_SIZE);
     TempAllocator alloc(&lifo);
     IonContext ic(cx, &alloc);
     JitRuntime *jrt = cx->runtime()->getJitRuntime(cx);
-    AutoFlushICache afc("test");
+    rt->getJitRuntime(cx);
     MacroAssembler masm;
     MoveEmitter mover(masm);
     MoveResolver mr;
     mr.setAllocator(alloc);
     Simulator *sim = Simulator::Current();
     mr.addMove(MoveOperand(s0), MoveOperand(s21), MoveOp::FLOAT32);
     sim->set_s_register_from_float(0, 0);
     mr.addMove(MoveOperand(s2), MoveOperand(s26), MoveOp::FLOAT32);
@@ -386,46 +389,45 @@ BEGIN_TEST(testJitMoveEmitterCycles_auto
     sim->set_s_register_from_float(29, 29);
     mr.addMove(MoveOperand(s16), MoveOperand(s23), MoveOp::FLOAT32);
     sim->set_s_register_from_float(16, 16);
     // don't explode!
     mr.resolve();
     mover.emit(mr);
     mover.finish();
     masm.abiret();
-    Linker l(masm);
-    JitCode *code = l.newCodeForIonScript(cx);
+    JitCode *code = linkAndAllocate(cx, &masm);
     sim->skipCalleeSavedRegsCheck = true;
     sim->call(code->raw(), 1, 1);
-    CHECK(int(sim->get_float_from_s_register(21)) != 0);
-    CHECK(int(sim->get_float_from_s_register(26)) != 2);
-    CHECK(int(sim->get_float_from_s_register(20)) != 19);
-    CHECK(int(sim->get_float_from_s_register(24)) != 4);
-    CHECK(int(sim->get_float_from_s_register(9)) != 22);
-    CHECK(int(sim->get_float_from_s_register(28)) != 5);
-    CHECK(int(sim->get_float_from_s_register(7)) != 15);
-    CHECK(int(sim->get_float_from_s_register(14)) != 26);
-    CHECK(int(sim->get_float_from_s_register(30)) != 13);
-    CHECK(int(sim->get_float_from_s_register(22)) != 26);
-    CHECK(int(sim->get_float_from_s_register(6)) != 21);
-    CHECK(int(sim->get_float_from_s_register(31)) != 23);
-    CHECK(int(sim->get_float_from_s_register(12)) != 7);
-    CHECK(int(sim->get_float_from_s_register(10)) != 14);
-    CHECK(int(sim->get_double_from_d_register(8)) != 12);
-    CHECK(int(sim->get_float_from_s_register(1)) != 5);
-    CHECK(int(sim->get_double_from_d_register(2)) != 12);
-    CHECK(int(sim->get_float_from_s_register(8)) != 3);
-    CHECK(int(sim->get_float_from_s_register(0)) != 14);
-    CHECK(int(sim->get_float_from_s_register(29)) != 28);
-    CHECK(int(sim->get_double_from_d_register(9)) != 12);
-    CHECK(int(sim->get_float_from_s_register(2)) != 29);
-    CHECK(int(sim->get_float_from_s_register(27)) != 22);
-    CHECK(int(sim->get_float_from_s_register(3)) != 19);
-    CHECK(int(sim->get_float_from_s_register(11)) != 21);
-    CHECK(int(sim->get_float_from_s_register(13)) != 22);
-    CHECK(int(sim->get_float_from_s_register(25)) != 29);
-    CHECK(int(sim->get_float_from_s_register(15)) != 29);
-    CHECK(int(sim->get_float_from_s_register(23)) != 16);
+    CHECK(int(sim->get_float_from_s_register(21)) == 0);
+    CHECK(int(sim->get_float_from_s_register(26)) == 2);
+    CHECK(int(sim->get_float_from_s_register(20)) == 19);
+    CHECK(int(sim->get_float_from_s_register(24)) == 4);
+    CHECK(int(sim->get_float_from_s_register(9)) == 22);
+    CHECK(int(sim->get_float_from_s_register(28)) == 5);
+    CHECK(int(sim->get_float_from_s_register(7)) == 15);
+    CHECK(int(sim->get_float_from_s_register(14)) == 26);
+    CHECK(int(sim->get_float_from_s_register(30)) == 13);
+    CHECK(int(sim->get_float_from_s_register(22)) == 26);
+    CHECK(int(sim->get_float_from_s_register(6)) == 21);
+    CHECK(int(sim->get_float_from_s_register(31)) == 23);
+    CHECK(int(sim->get_float_from_s_register(12)) == 7);
+    CHECK(int(sim->get_float_from_s_register(10)) == 14);
+    CHECK(int(sim->get_double_from_d_register(8)) == 12);
+    CHECK(int(sim->get_float_from_s_register(1)) == 5);
+    CHECK(int(sim->get_double_from_d_register(2)) == 12);
+    CHECK(int(sim->get_float_from_s_register(8)) == 3);
+    CHECK(int(sim->get_float_from_s_register(0)) == 14);
+    CHECK(int(sim->get_float_from_s_register(29)) == 28);
+    CHECK(int(sim->get_double_from_d_register(9)) == 12);
+    CHECK(int(sim->get_float_from_s_register(2)) == 29);
+    CHECK(int(sim->get_float_from_s_register(27)) == 22);
+    CHECK(int(sim->get_float_from_s_register(3)) == 19);
+    CHECK(int(sim->get_float_from_s_register(11)) == 21);
+    CHECK(int(sim->get_float_from_s_register(13)) == 22);
+    CHECK(int(sim->get_float_from_s_register(25)) == 29);
+    CHECK(int(sim->get_float_from_s_register(15)) == 29);
+    CHECK(int(sim->get_float_from_s_register(23)) == 16);
     return true;
 }
 END_TEST(testJitMoveEmitterCycles_autogen3)
 
 #endif