Index: src/crankshaft/s390/lithium-s390.cc |
diff --git a/src/crankshaft/s390/lithium-s390.cc b/src/crankshaft/s390/lithium-s390.cc |
index 44bf00be40139cb260a20e9ecff882f077fee241..bf9dfd56bae04409eeb7dd009fda5f9f7dc65c4b 100644 |
--- a/src/crankshaft/s390/lithium-s390.cc |
+++ b/src/crankshaft/s390/lithium-s390.cc |
@@ -921,6 +921,9 @@ LInstruction* LChunkBuilder::DoDeclareGlobals(HDeclareGlobals* instr) { |
LInstruction* LChunkBuilder::DoCallWithDescriptor(HCallWithDescriptor* instr) { |
CallInterfaceDescriptor descriptor = instr->descriptor(); |
+ DCHECK_EQ(descriptor.GetParameterCount() + |
+ LCallWithDescriptor::kImplicitRegisterParameterCount, |
+ instr->OperandCount()); |
LOperand* target = UseRegisterOrConstantAtStart(instr->target()); |
ZoneList<LOperand*> ops(instr->OperandCount(), zone()); |
@@ -929,15 +932,20 @@ LInstruction* LChunkBuilder::DoCallWithDescriptor(HCallWithDescriptor* instr) { |
// Context |
LOperand* op = UseFixed(instr->OperandAt(1), cp); |
ops.Add(op, zone()); |
- // Other register parameters |
- for (int i = LCallWithDescriptor::kImplicitRegisterParameterCount; |
- i < instr->OperandCount(); i++) { |
- op = |
- UseFixed(instr->OperandAt(i), |
- descriptor.GetRegisterParameter( |
- i - LCallWithDescriptor::kImplicitRegisterParameterCount)); |
+ // Load register parameters. |
+ int i = 0; |
+ for (; i < descriptor.GetRegisterParameterCount(); i++) { |
+ op = UseFixed(instr->OperandAt( |
+ i + LCallWithDescriptor::kImplicitRegisterParameterCount), |
+ descriptor.GetRegisterParameter(i)); |
ops.Add(op, zone()); |
} |
+ // Push stack parameters. |
+ for (; i < descriptor.GetParameterCount(); i++) { |
+ op = UseAny(instr->OperandAt( |
+ i + LCallWithDescriptor::kImplicitRegisterParameterCount)); |
+ AddInstruction(new (zone()) LPushArgument(op), instr); |
+ } |
LCallWithDescriptor* result = |
new (zone()) LCallWithDescriptor(descriptor, ops, zone()); |