Index: src/arm/simulator-arm.cc |
diff --git a/src/arm/simulator-arm.cc b/src/arm/simulator-arm.cc |
index 2551e14e4905932a4ad5bd853307bb6c941fac68..731113e20f45ad7aee5688e1f16f8e050036b0aa 100644 |
--- a/src/arm/simulator-arm.cc |
+++ b/src/arm/simulator-arm.cc |
@@ -1647,10 +1647,25 @@ typedef int64_t (*SimulatorRuntimeCall)(int32_t arg0, |
int32_t arg3, |
int32_t arg4, |
int32_t arg5); |
+#if defined(V8_ARM_ON_X86_64) |
+// This prototype will handle calls with up to two double args |
+// and up to four integer args in any order. Note that arguments |
+// on x86_64 are passed in registers. With this prototype the |
+// six cited argument registers are loaded. Note that the callee |
+// will simply ignore any arguments it doesn't actually need. |
+// This prototype will fail for structures passed by value. |
+typedef double (*SimulatorRuntimeFPCall)(double darg0, |
+ double darg1, |
+ int32_t arg0, |
+ int32_t arg1, |
+ int32_t arg2, |
+ int32_t arg3); |
+#else |
typedef double (*SimulatorRuntimeFPCall)(int32_t arg0, |
int32_t arg1, |
int32_t arg2, |
int32_t arg3); |
+#endif |
// This signature supports direct call in to API function native callback |
// (refer to InvocationCallback in v8.h). |
@@ -1660,6 +1675,16 @@ typedef v8::Handle<v8::Value> (*SimulatorRuntimeDirectApiCall)(int32_t arg0); |
typedef v8::Handle<v8::Value> (*SimulatorRuntimeDirectGetterCall)(int32_t arg0, |
int32_t arg1); |
+ |
+#if defined(V8_ARM_ON_X86_64) |
+static double ArgAsDouble(uint32_t lo, uint32_t hi) { |
+ union { uint64_t i64; double d; } darg; |
+ darg.i64 = hi; |
+ darg.i64 = (darg.i64 << 32) | lo; |
+ return darg.d; |
+} |
+#endif |
+ |
// Software interrupt instructions are used by the simulator to call into the |
// C-based V8 runtime. |
void Simulator::SoftwareInterrupt(Instruction* instr) { |
@@ -1751,7 +1776,13 @@ void Simulator::SoftwareInterrupt(Instruction* instr) { |
if (redirection->type() != ExternalReference::BUILTIN_COMPARE_CALL) { |
SimulatorRuntimeFPCall target = |
reinterpret_cast<SimulatorRuntimeFPCall>(external); |
+#if defined(V8_ARM_ON_X86_64) |
+ double result = target(ArgAsDouble(arg0, arg1), |
+ ArgAsDouble(arg2, arg3), |
+ arg0, arg1, arg2, arg3); |
+#else |
double result = target(arg0, arg1, arg2, arg3); |
+#endif |
SetFpResult(result); |
} else { |
SimulatorRuntimeCall target = |