зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1101356 mips part - MIPS Simulator: Support for calling functions that have three and four double parameters. r=rankov
This commit is contained in:
Родитель
1c83e49c5e
Коммит
659f621d17
|
@ -3472,6 +3472,8 @@ AssertValidABIFunctionType(uint32_t passedArgTypes)
|
|||
case Args_Double_DoubleDouble:
|
||||
case Args_Double_IntDouble:
|
||||
case Args_Int_IntDouble:
|
||||
case Args_Double_DoubleDoubleDouble:
|
||||
case Args_Double_DoubleDoubleDoubleDouble:
|
||||
break;
|
||||
default:
|
||||
MOZ_CRASH("Unexpected type");
|
||||
|
|
|
@ -1550,6 +1550,14 @@ Simulator::getFpArgs(double *x, double *y, int32_t *z)
|
|||
*z = getRegister(a2);
|
||||
}
|
||||
|
||||
void
|
||||
Simulator::getFpFromStack(int32_t *stack, double *x)
|
||||
{
|
||||
MOZ_ASSERT(stack);
|
||||
MOZ_ASSERT(x);
|
||||
memcpy(x, stack, sizeof(double));
|
||||
}
|
||||
|
||||
void
|
||||
Simulator::setCallResultDouble(double result)
|
||||
{
|
||||
|
@ -1857,6 +1865,10 @@ typedef double (*Prototype_Double_IntDouble)(int32_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 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)
|
||||
|
@ -2022,6 +2034,29 @@ Simulator::softwareInterrupt(SimInstruction *instr)
|
|||
setRegister(v0, result);
|
||||
break;
|
||||
}
|
||||
case Args_Double_DoubleDoubleDouble: {
|
||||
double dval0, dval1, dval2;
|
||||
int32_t ival;
|
||||
getFpArgs(&dval0, &dval1, &ival);
|
||||
// the last argument is on stack
|
||||
getFpFromStack(stack_pointer + 4, &dval2);
|
||||
Prototype_Double_DoubleDoubleDouble target = reinterpret_cast<Prototype_Double_DoubleDoubleDouble>(external);
|
||||
double dresult = target(dval0, dval1, dval2);
|
||||
setCallResultDouble(dresult);
|
||||
break;
|
||||
}
|
||||
case Args_Double_DoubleDoubleDoubleDouble: {
|
||||
double dval0, dval1, dval2, dval3;
|
||||
int32_t ival;
|
||||
getFpArgs(&dval0, &dval1, &ival);
|
||||
// the two last arguments are on stack
|
||||
getFpFromStack(stack_pointer + 4, &dval2);
|
||||
getFpFromStack(stack_pointer + 6, &dval3);
|
||||
Prototype_Double_DoubleDoubleDoubleDouble target = reinterpret_cast<Prototype_Double_DoubleDoubleDoubleDouble>(external);
|
||||
double dresult = target(dval0, dval1, dval2, dval3);
|
||||
setCallResultDouble(dresult);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
MOZ_CRASH("call");
|
||||
}
|
||||
|
|
|
@ -297,6 +297,7 @@ class Simulator {
|
|||
|
||||
// Handle arguments and return value for runtime FP functions.
|
||||
void getFpArgs(double *x, double *y, int32_t *z);
|
||||
void getFpFromStack(int32_t *stack, double *x);
|
||||
|
||||
void setCallResultDouble(double result);
|
||||
void setCallResultFloat(float result);
|
||||
|
|
Загрузка…
Ссылка в новой задаче