Index: src/crankshaft/x87/lithium-x87.cc |
diff --git a/src/crankshaft/x87/lithium-x87.cc b/src/crankshaft/x87/lithium-x87.cc |
index 68e2b32519d60ace458dfccc47dd4aecc7570f8f..a319c0c7186e056ac9e57adb613ba992a8bc9107 100644 |
--- a/src/crankshaft/x87/lithium-x87.cc |
+++ b/src/crankshaft/x87/lithium-x87.cc |
@@ -1053,6 +1053,10 @@ 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()); |
// Target |
@@ -1060,15 +1064,20 @@ LInstruction* LChunkBuilder::DoCallWithDescriptor( |
// Context |
LOperand* op = UseFixed(instr->OperandAt(1), esi); |
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()); |