Index: src/crankshaft/ppc/lithium-ppc.cc |
diff --git a/src/crankshaft/ppc/lithium-ppc.cc b/src/crankshaft/ppc/lithium-ppc.cc |
index 3aa7cba8ee5c57fd12367229d477b2e19a92e20c..738cf231ce0e41c706cefcf7a0c325b4dfcccc0a 100644 |
--- a/src/crankshaft/ppc/lithium-ppc.cc |
+++ b/src/crankshaft/ppc/lithium-ppc.cc |
@@ -1012,6 +1012,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()); |
@@ -1020,15 +1023,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()); |