Bug 1455028 : [MIPS64] Fix jit -> c++ int32 argument passing for simulator builds; r=bbouvier
authorDragan Mladjenovic <dragan.mladjenovic>
Wed, 18 Apr 2018 18:08:24 +0200
changeset 471837 64b83e067db211768e1d9c0f086ec46513bac4cf
parent 471836 04e3c9e62313f1a8fb0d88089052bdcabd9a840b
child 471838 d50f31ee0a5bb8d04034cbd6451de327a6805517
push id1728
push userjlund@mozilla.com
push dateMon, 18 Jun 2018 21:12:27 +0000
treeherdermozilla-release@c296fde26f5f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbbouvier
bugs1455028
milestone61.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 1455028 : [MIPS64] Fix jit -> c++ int32 argument passing for simulator builds; r=bbouvier
js/src/jit/mips64/Simulator-mips64.cpp
--- a/js/src/jit/mips64/Simulator-mips64.cpp
+++ b/js/src/jit/mips64/Simulator-mips64.cpp
@@ -2114,29 +2114,29 @@ typedef int64_t (*Prototype_General7)(in
 typedef int64_t (*Prototype_General8)(int64_t arg0, int64_t arg1, int64_t arg2, int64_t arg3,
                                       int64_t arg4, int64_t arg5, int64_t arg6, int64_t arg7);
 typedef int32_t (*Prototype_Int_GeneralGeneralGeneralInt64)(int64_t arg0, int64_t arg1, int64_t arg2,
                                                         int64_t arg3);
 typedef int32_t (*Prototype_Int_GeneralGeneralInt64Int64)(int64_t arg0, int64_t arg1, int64_t arg2,
                                                       int64_t arg3);
 typedef double (*Prototype_Double_None)();
 typedef double (*Prototype_Double_Double)(double arg0);
-typedef double (*Prototype_Double_Int)(int32_t arg0);
-typedef int32_t (*Prototype_Int_Double)(double arg0);
-typedef int32_t (*Prototype_Int_DoubleIntInt)(double arg0, int32_t arg1, int32_t arg2);
-typedef int32_t (*Prototype_Int_IntDoubleIntInt)(int32_t arg0, double arg1, int32_t arg2,
-                                                 int32_t arg3);
+typedef double (*Prototype_Double_Int)(int64_t arg0);
+typedef int64_t (*Prototype_Int_Double)(double arg0);
+typedef int64_t (*Prototype_Int_DoubleIntInt)(double arg0, int64_t arg1, int64_t arg2);
+typedef int64_t (*Prototype_Int_IntDoubleIntInt)(int64_t arg0, double arg1, int64_t arg2,
+                                                 int64_t arg3);
 typedef float (*Prototype_Float32_Float32)(float arg0);
 typedef float (*Prototype_Float32_Float32Float32)(float arg0, float arg1);
-typedef float (*Prototype_Float32_IntInt)(int32_t arg0, int32_t arg1);
-
-typedef double (*Prototype_Double_DoubleInt)(double arg0, int32_t arg1);
-typedef double (*Prototype_Double_IntDouble)(int32_t arg0, double arg1);
+typedef float (*Prototype_Float32_IntInt)(int64_t arg0, int64_t arg1);
+
+typedef double (*Prototype_Double_DoubleInt)(double arg0, int64_t arg1);
+typedef double (*Prototype_Double_IntDouble)(int64_t arg0, double arg1);
 typedef double (*Prototype_Double_DoubleDouble)(double arg0, double arg1);
-typedef int32_t (*Prototype_Int_IntDouble)(int32_t arg0, double arg1);
+typedef int64_t (*Prototype_Int_IntDouble)(int64_t arg0, double arg1);
 
 typedef double (*Prototype_Double_DoubleDoubleDouble)(double arg0, double arg1, double arg2);
 typedef double (*Prototype_Double_DoubleDoubleDoubleDouble)(double arg0, double arg1,
                                                             double arg2, double arg3);
 
 // Software interrupt instructions are used by the simulator to call into C++.
 void
 Simulator::softwareInterrupt(SimInstruction* instr)
@@ -2189,19 +2189,18 @@ Simulator::softwareInterrupt(SimInstruct
             Prototype_General2 target = reinterpret_cast<Prototype_General2>(external);
             int64_t result = target(arg0, arg1);
             setCallResult(result);
             break;
           }
           case Args_General3: {
             Prototype_General3 target = reinterpret_cast<Prototype_General3>(external);
             int64_t result = target(arg0, arg1, arg2);
-            if(external == intptr_t(&js::wasm::Instance::wake)) {
+            if (external == intptr_t(&js::wasm::Instance::wake))
                 result = int32_t(result);
-            }
             setCallResult(result);
             break;
           }
           case Args_General4: {
             Prototype_General4 target = reinterpret_cast<Prototype_General4>(external);
             int64_t result = target(arg0, arg1, arg2, arg3);
             setCallResult(result);
             break;
@@ -2237,46 +2236,52 @@ Simulator::softwareInterrupt(SimInstruct
             Prototype_Double_None target = reinterpret_cast<Prototype_Double_None>(external);
             double dresult = target();
             setCallResultDouble(dresult);
             break;
           }
           case Args_Int_Double: {
             double dval0 = getFpuRegisterDouble(12);
             Prototype_Int_Double target = reinterpret_cast<Prototype_Int_Double>(external);
-            int32_t res = target(dval0);
-            setRegister(v0, res);
+            int64_t result = target(dval0);
+            if (external == intptr_t((int32_t(*)(double))JS::ToInt32))
+                result = int32_t(result);
+            setRegister(v0, result);
             break;
           }
           case Args_Int_GeneralGeneralGeneralInt64: {
             Prototype_Int_GeneralGeneralGeneralInt64 target =
                 reinterpret_cast<Prototype_Int_GeneralGeneralGeneralInt64>(external);
-            int32_t res = target(arg0, arg1, arg2, arg3);
-            setRegister(v0, res);
+            int64_t result = target(arg0, arg1, arg2, arg3);
+            if (external == intptr_t(&js::wasm::Instance::wait_i32))
+                result = int32_t(result);
+            setRegister(v0, result);
             break;
           }
           case Args_Int_GeneralGeneralInt64Int64: {
             Prototype_Int_GeneralGeneralInt64Int64 target =
                 reinterpret_cast<Prototype_Int_GeneralGeneralInt64Int64>(external);
-            int32_t res = target(arg0, arg1, arg2, arg3);
-            setRegister(v0, res);
+            int64_t result = target(arg0, arg1, arg2, arg3);
+            if (external == intptr_t(&js::wasm::Instance::wait_i64))
+                result = int32_t(result);
+            setRegister(v0, result);
             break;
           }
           case Args_Int_DoubleIntInt: {
             double dval = getFpuRegisterDouble(12);
             Prototype_Int_DoubleIntInt target = reinterpret_cast<Prototype_Int_DoubleIntInt>(external);
-            int32_t res = target(dval, int32_t(arg1), int32_t(arg2));
-            setRegister(v0, res);
+            int64_t result = target(dval, arg1, arg2);
+            setRegister(v0, result);
             break;
           }
           case Args_Int_IntDoubleIntInt: {
             double dval = getFpuRegisterDouble(13);
             Prototype_Int_IntDoubleIntInt target = reinterpret_cast<Prototype_Int_IntDoubleIntInt>(external);
-            int32_t res = target(int32_t(arg0), dval, int32_t(arg2), int32_t(arg3));
-            setRegister(v0, res);
+            int64_t result = target(arg0, dval, arg2, arg3);
+            setRegister(v0, result);
             break;
           }
           case Args_Double_Double: {
             double dval0 = getFpuRegisterDouble(12);
             Prototype_Double_Double target = reinterpret_cast<Prototype_Double_Double>(external);
             double dresult = target(dval0);
             setCallResultDouble(dresult);
             break;
@@ -2296,52 +2301,52 @@ Simulator::softwareInterrupt(SimInstruct
             fval1 = getFpuRegisterFloat(13);
             Prototype_Float32_Float32Float32 target = reinterpret_cast<Prototype_Float32_Float32Float32>(external);
             float fresult = target(fval0, fval1);
             setCallResultFloat(fresult);
             break;
           }
           case Args_Float32_IntInt: {
             Prototype_Float32_IntInt target = reinterpret_cast<Prototype_Float32_IntInt>(external);
-            float fresult = target(int32_t(arg0), int32_t(arg1));
+            float fresult = target(arg0, arg1);
             setCallResultFloat(fresult);
             break;
           }
           case Args_Double_Int: {
             Prototype_Double_Int target = reinterpret_cast<Prototype_Double_Int>(external);
-            double dresult = target(int32_t(arg0));
+            double dresult = target(arg0);
             setCallResultDouble(dresult);
             break;
           }
           case Args_Double_DoubleInt: {
             double dval0 = getFpuRegisterDouble(12);
             Prototype_Double_DoubleInt target = reinterpret_cast<Prototype_Double_DoubleInt>(external);
-            double dresult = target(dval0, int32_t(arg1));
+            double dresult = target(dval0, arg1);
             setCallResultDouble(dresult);
             break;
           }
           case Args_Double_DoubleDouble: {
             double dval0 = getFpuRegisterDouble(12);
             double dval1 = getFpuRegisterDouble(13);
             Prototype_Double_DoubleDouble target = reinterpret_cast<Prototype_Double_DoubleDouble>(external);
             double dresult = target(dval0, dval1);
             setCallResultDouble(dresult);
             break;
           }
           case Args_Double_IntDouble: {
             double dval1 = getFpuRegisterDouble(13);
             Prototype_Double_IntDouble target = reinterpret_cast<Prototype_Double_IntDouble>(external);
-            double dresult = target(int32_t(arg0), dval1);
+            double dresult = target(arg0, dval1);
             setCallResultDouble(dresult);
             break;
           }
           case Args_Int_IntDouble: {
             double dval1 = getFpuRegisterDouble(13);
             Prototype_Int_IntDouble target = reinterpret_cast<Prototype_Int_IntDouble>(external);
-            int32_t result = target(int32_t(arg0), dval1);
+            int64_t result = target(arg0, dval1);
             setRegister(v0, result);
             break;
           }
           case Args_Double_DoubleDoubleDouble: {
             double dval0 = getFpuRegisterDouble(12);
             double dval1 = getFpuRegisterDouble(13);
             double dval2 = getFpuRegisterDouble(14);
             Prototype_Double_DoubleDoubleDouble target =