From 81023c7822de012ff948199cad4b08bfd1c42b9d Mon Sep 17 00:00:00 2001 From: Dragan Mladjenovic Date: Wed, 25 Apr 2018 02:25:00 -0400 Subject: [PATCH] Bug 1455028 - [MIPS64] Fix jit -> c++ int32 argument passing for simulator builds. r=bbouvier --HG-- extra : rebase_source : 171195511a6d7e6cd371bde37307b270027d83f8 --- js/src/jit/mips64/Simulator-mips64.cpp | 57 ++++++++++++++------------ 1 file changed, 31 insertions(+), 26 deletions(-) diff --git a/js/src/jit/mips64/Simulator-mips64.cpp b/js/src/jit/mips64/Simulator-mips64.cpp index 19ec33535c1d..933754cbe83b 100644 --- a/js/src/jit/mips64/Simulator-mips64.cpp +++ b/js/src/jit/mips64/Simulator-mips64.cpp @@ -2119,19 +2119,19 @@ typedef int32_t (*Prototype_Int_GeneralGeneralInt64Int64)(int64_t arg0, int64_t 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 float (*Prototype_Float32_IntInt)(int64_t arg0, int64_t arg1); -typedef double (*Prototype_Double_DoubleInt)(double arg0, int32_t arg1); -typedef double (*Prototype_Double_IntDouble)(int32_t arg0, double 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, @@ -2194,9 +2194,8 @@ Simulator::softwareInterrupt(SimInstruction* instr) case Args_General3: { Prototype_General3 target = reinterpret_cast(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; } @@ -2242,36 +2241,42 @@ Simulator::softwareInterrupt(SimInstruction* instr) case Args_Int_Double: { double dval0 = getFpuRegisterDouble(12); Prototype_Int_Double target = reinterpret_cast(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(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(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(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(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: { @@ -2301,20 +2306,20 @@ Simulator::softwareInterrupt(SimInstruction* instr) } case Args_Float32_IntInt: { Prototype_Float32_IntInt target = reinterpret_cast(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(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(external); - double dresult = target(dval0, int32_t(arg1)); + double dresult = target(dval0, arg1); setCallResultDouble(dresult); break; } @@ -2329,14 +2334,14 @@ Simulator::softwareInterrupt(SimInstruction* instr) case Args_Double_IntDouble: { double dval1 = getFpuRegisterDouble(13); Prototype_Double_IntDouble target = reinterpret_cast(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(external); - int32_t result = target(int32_t(arg0), dval1); + int64_t result = target(arg0, dval1); setRegister(v0, result); break; }