Index: src/crankshaft/mips/lithium-mips.cc |
diff --git a/src/crankshaft/mips/lithium-mips.cc b/src/crankshaft/mips/lithium-mips.cc |
index 86ef8f8a9c0d8186971ffad57a3da340cd46e9aa..5533b8f59d68ba73461c5bb858dd4159e4cf00a8 100644 |
--- a/src/crankshaft/mips/lithium-mips.cc |
+++ b/src/crankshaft/mips/lithium-mips.cc |
@@ -1006,6 +1006,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()); |
@@ -1014,15 +1017,20 @@ LInstruction* LChunkBuilder::DoCallWithDescriptor( |
// 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()); |