Revision: 7722
Author:   [email protected]
Date:     Fri Apr 29 04:16:09 2011
Log: ARM: Fix handling of return value of compare_doubles in the simulator.

Review URL: http://codereview.chromium.org/6904124
http://code.google.com/p/v8/source/detail?r=7722

Modified:
 /branches/bleeding_edge/src/arm/simulator-arm.cc

=======================================
--- /branches/bleeding_edge/src/arm/simulator-arm.cc Fri Apr 29 01:50:38 2011 +++ /branches/bleeding_edge/src/arm/simulator-arm.cc Fri Apr 29 04:16:09 2011
@@ -1770,9 +1770,9 @@
       intptr_t external =
           reinterpret_cast<intptr_t>(redirection->external_function());
       if (fp_call) {
-        SimulatorRuntimeFPCall target =
-            reinterpret_cast<SimulatorRuntimeFPCall>(external);
         if (::v8::internal::FLAG_trace_sim || !stack_aligned) {
+          SimulatorRuntimeFPCall target =
+              reinterpret_cast<SimulatorRuntimeFPCall>(external);
           double dval0, dval1;
           int32_t ival;
           switch (redirection->type()) {
@@ -1785,7 +1785,7 @@
           case ExternalReference::BUILTIN_FP_CALL:
             GetFpArgs(&dval0);
             PrintF("Call to host function at %p with arg %f",
-                FUNCTION_ADDR(target), dval1);
+                FUNCTION_ADDR(target), dval0);
             break;
           case ExternalReference::BUILTIN_FP_INT_CALL:
             GetFpArgs(&dval0, &ival);
@@ -1802,9 +1802,22 @@
           PrintF("\n");
         }
         CHECK(stack_aligned);
-        double result = target(arg0, arg1, arg2, arg3);
if (redirection->type() != ExternalReference::BUILTIN_COMPARE_CALL) {
+          SimulatorRuntimeFPCall target =
+              reinterpret_cast<SimulatorRuntimeFPCall>(external);
+          double result = target(arg0, arg1, arg2, arg3);
           SetFpResult(result);
+        } else {
+          SimulatorRuntimeCall target =
+              reinterpret_cast<SimulatorRuntimeCall>(external);
+          int64_t result = target(arg0, arg1, arg2, arg3, arg4, arg5);
+          int32_t lo_res = static_cast<int32_t>(result);
+          int32_t hi_res = static_cast<int32_t>(result >> 32);
+          if (::v8::internal::FLAG_trace_sim) {
+            PrintF("Returned %08x\n", lo_res);
+          }
+          set_register(r0, lo_res);
+          set_register(r1, hi_res);
         }
} else if (redirection->type() == ExternalReference::DIRECT_API_CALL) {
         SimulatorRuntimeDirectApiCall target =

--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev

Reply via email to