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

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

Issue 2841693003: PPC/s390: [sim] Consistent support for C calls with up to 9 args (Closed)
Patch Set: rebased and addressed comments Created 3 years, 8 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/ppc/macro-assembler-ppc.cc ('k') | src/s390/macro-assembler-s390.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/ppc/simulator-ppc.cc
diff --git a/src/ppc/simulator-ppc.cc b/src/ppc/simulator-ppc.cc
index 071b7e4199f7699547d9c65745c13eddf872327c..fab4913bda2f67bd2fbc0938e82f17d951b3678d 100644
--- a/src/ppc/simulator-ppc.cc
+++ b/src/ppc/simulator-ppc.cc
@@ -1292,7 +1292,9 @@ static void decodeObjectPair(ObjectPair* pair, intptr_t* x, intptr_t* y) {
// Calls into the V8 runtime.
typedef intptr_t (*SimulatorRuntimeCall)(intptr_t arg0, intptr_t arg1,
intptr_t arg2, intptr_t arg3,
- intptr_t arg4, intptr_t arg5);
+ intptr_t arg4, intptr_t arg5,
+ intptr_t arg6, intptr_t arg7,
+ intptr_t arg8);
typedef ObjectPair (*SimulatorRuntimePairCall)(intptr_t arg0, intptr_t arg1,
intptr_t arg2, intptr_t arg3,
intptr_t arg4, intptr_t arg5);
@@ -1329,7 +1331,8 @@ void Simulator::SoftwareInterrupt(Instruction* instr) {
(get_register(sp) & (::v8::internal::FLAG_sim_stack_alignment - 1)) ==
0;
Redirection* redirection = Redirection::FromSwiInstruction(instr);
- const int kArgCount = 6;
+ const int kArgCount = 9;
+ const int kRegisterArgCount = 8;
int arg0_regnum = 3;
intptr_t result_buffer = 0;
bool uses_result_buffer =
@@ -1341,9 +1344,15 @@ void Simulator::SoftwareInterrupt(Instruction* instr) {
arg0_regnum++;
}
intptr_t arg[kArgCount];
- for (int i = 0; i < kArgCount; i++) {
+ // First eight arguments in registers r3-r10.
+ for (int i = 0; i < kRegisterArgCount; i++) {
arg[i] = get_register(arg0_regnum + i);
}
+ intptr_t* stack_pointer = reinterpret_cast<intptr_t*>(get_register(sp));
+ // Remaining argument on stack
+ arg[kRegisterArgCount] = stack_pointer[kStackFrameExtraParamSlot];
+ STATIC_ASSERT(kArgCount == kRegisterArgCount + 1);
+ STATIC_ASSERT(kMaxCParameters == 9);
bool fp_call =
(redirection->type() == ExternalReference::BUILTIN_FP_FP_CALL) ||
(redirection->type() == ExternalReference::BUILTIN_COMPARE_CALL) ||
@@ -1519,9 +1528,10 @@ void Simulator::SoftwareInterrupt(Instruction* instr) {
PrintF(
"Call to host function at %p,\n"
"\t\t\t\targs %08" V8PRIxPTR ", %08" V8PRIxPTR ", %08" V8PRIxPTR
+ ", %08" V8PRIxPTR ", %08" V8PRIxPTR ", %08" V8PRIxPTR
", %08" V8PRIxPTR ", %08" V8PRIxPTR ", %08" V8PRIxPTR,
- static_cast<void*>(FUNCTION_ADDR(target)), arg[0], arg[1],
- arg[2], arg[3], arg[4], arg[5]);
+ static_cast<void*>(FUNCTION_ADDR(target)), arg[0], arg[1], arg[2],
+ arg[3], arg[4], arg[5], arg[6], arg[7], arg[8]);
if (!stack_aligned) {
PrintF(" with unaligned stack %08" V8PRIxPTR "\n",
get_register(sp));
@@ -1568,8 +1578,8 @@ void Simulator::SoftwareInterrupt(Instruction* instr) {
DCHECK(redirection->type() == ExternalReference::BUILTIN_CALL);
SimulatorRuntimeCall target =
reinterpret_cast<SimulatorRuntimeCall>(external);
- intptr_t result =
- target(arg[0], arg[1], arg[2], arg[3], arg[4], arg[5]);
+ intptr_t result = target(arg[0], arg[1], arg[2], arg[3], arg[4],
+ arg[5], arg[6], arg[7], arg[8]);
if (::v8::internal::FLAG_trace_sim) {
PrintF("Returned %08" V8PRIxPTR "\n", result);
}
« no previous file with comments | « src/ppc/macro-assembler-ppc.cc ('k') | src/s390/macro-assembler-s390.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698