Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(65)

Unified Diff: src/arm/simulator-arm.cc

Issue 13520004: [NOT FOR COMMIT] Native Client builds of V8 on ia32 and x64. (Closed) Base URL: git://github.com/v8/v8.git@master
Patch Set: A couple minor cleanups Created 7 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/arm/code-stubs-arm.cc ('k') | src/atomicops_internals_x86_gcc.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 =
« no previous file with comments | « src/arm/code-stubs-arm.cc ('k') | src/atomicops_internals_x86_gcc.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698