Index: src/ppc/simulator-ppc.cc |
diff --git a/src/ppc/simulator-ppc.cc b/src/ppc/simulator-ppc.cc |
index 0efa6605d58a82089bf0271a94b3f4be13aca780..a4088a6b1e75816d9aa17fc41a04199f5c548267 100644 |
--- a/src/ppc/simulator-ppc.cc |
+++ b/src/ppc/simulator-ppc.cc |
@@ -15,6 +15,7 @@ |
#include "src/ppc/constants-ppc.h" |
#include "src/ppc/frames-ppc.h" |
#include "src/ppc/simulator-ppc.h" |
+#include "src/runtime/runtime-utils.h" |
#if defined(USE_SIMULATOR) |
@@ -1171,20 +1172,11 @@ bool Simulator::OverflowFrom(int32_t alu_out, int32_t left, int32_t right, |
#if V8_TARGET_ARCH_PPC64 |
-struct ObjectPair { |
- intptr_t x; |
- intptr_t y; |
-}; |
- |
- |
static void decodeObjectPair(ObjectPair* pair, intptr_t* x, intptr_t* y) { |
- *x = pair->x; |
- *y = pair->y; |
+ *x = reinterpret_cast<intptr_t>(pair->x); |
+ *y = reinterpret_cast<intptr_t>(pair->y); |
} |
#else |
-typedef uint64_t ObjectPair; |
- |
- |
static void decodeObjectPair(ObjectPair* pair, intptr_t* x, intptr_t* y) { |
#if V8_TARGET_BIG_ENDIAN |
*x = static_cast<int32_t>(*pair >> 32); |
@@ -1207,6 +1199,11 @@ typedef ObjectPair (*SimulatorRuntimeCall)(intptr_t arg0, intptr_t arg1, |
intptr_t arg2, intptr_t arg3, |
intptr_t arg4, intptr_t arg5); |
+typedef ObjectTriple (*SimulatorRuntimeTripleCall)(intptr_t arg0, intptr_t arg1, |
+ intptr_t arg2, intptr_t arg3, |
+ intptr_t arg4, |
+ intptr_t arg5); |
+ |
// These prototypes handle the four types of FP calls. |
typedef int (*SimulatorRuntimeCompareCall)(double darg0, double darg1); |
typedef double (*SimulatorRuntimeFPFPCall)(double darg0, double darg1); |
@@ -1237,13 +1234,13 @@ void Simulator::SoftwareInterrupt(Instruction* instr) { |
Redirection* redirection = Redirection::FromSwiInstruction(instr); |
const int kArgCount = 6; |
int arg0_regnum = 3; |
-#if !ABI_RETURNS_OBJECT_PAIRS_IN_REGS |
intptr_t result_buffer = 0; |
- if (redirection->type() == ExternalReference::BUILTIN_OBJECTPAIR_CALL) { |
+ if (redirection->type() == ExternalReference::BUILTIN_CALL_TRIPLE || |
+ (redirection->type() == ExternalReference::BUILTIN_CALL_PAIR && |
+ !ABI_RETURNS_OBJECT_PAIRS_IN_REGS)) { |
result_buffer = get_register(r3); |
arg0_regnum++; |
} |
-#endif |
intptr_t arg[kArgCount]; |
for (int i = 0; i < kArgCount; i++) { |
arg[i] = get_register(arg0_regnum + i); |
@@ -1430,19 +1427,36 @@ void Simulator::SoftwareInterrupt(Instruction* instr) { |
PrintF("\n"); |
} |
CHECK(stack_aligned); |
- DCHECK(redirection->type() == ExternalReference::BUILTIN_CALL); |
- SimulatorRuntimeCall target = |
- reinterpret_cast<SimulatorRuntimeCall>(external); |
- ObjectPair result = |
- target(arg[0], arg[1], arg[2], arg[3], arg[4], arg[5]); |
- intptr_t x; |
- intptr_t y; |
- decodeObjectPair(&result, &x, &y); |
- if (::v8::internal::FLAG_trace_sim) { |
- PrintF("Returned {%08" V8PRIxPTR ", %08" V8PRIxPTR "}\n", x, y); |
- } |
- set_register(r3, x); |
- set_register(r4, y); |
+ if (redirection->type() == ExternalReference::BUILTIN_CALL_TRIPLE) { |
+ SimulatorRuntimeTripleCall target = |
+ reinterpret_cast<SimulatorRuntimeTripleCall>(external); |
+ ObjectTriple result = |
+ target(arg[0], arg[1], arg[2], arg[3], arg[4], arg[5]); |
+ if (::v8::internal::FLAG_trace_sim) { |
+ PrintF("Returned {%08" V8PRIxPTR ", %08" V8PRIxPTR ", %08" V8PRIxPTR |
+ "}\n", |
+ reinterpret_cast<intptr_t>(result.x), |
+ reinterpret_cast<intptr_t>(result.y), |
+ reinterpret_cast<intptr_t>(result.z)); |
+ } |
+ memcpy(reinterpret_cast<void*>(result_buffer), &result, |
+ sizeof(ObjectTriple)); |
+ set_register(r3, result_buffer); |
+ } else { |
+ DCHECK(redirection->type() == ExternalReference::BUILTIN_CALL); |
+ SimulatorRuntimeCall target = |
+ reinterpret_cast<SimulatorRuntimeCall>(external); |
+ ObjectPair result = |
+ target(arg[0], arg[1], arg[2], arg[3], arg[4], arg[5]); |
+ intptr_t x; |
+ intptr_t y; |
+ decodeObjectPair(&result, &x, &y); |
+ if (::v8::internal::FLAG_trace_sim) { |
+ PrintF("Returned {%08" V8PRIxPTR ", %08" V8PRIxPTR "}\n", x, y); |
+ } |
+ set_register(r3, x); |
+ set_register(r4, y); |
+ } |
} |
set_pc(saved_lr); |
break; |