Index: src/crankshaft/x64/lithium-x64.cc |
diff --git a/src/crankshaft/x64/lithium-x64.cc b/src/crankshaft/x64/lithium-x64.cc |
index 06b5052a62965023390bf340532a39cad3574b01..18fb5d4d09b42e03663b627e247c1e2bb913ca1d 100644 |
--- a/src/crankshaft/x64/lithium-x64.cc |
+++ b/src/crankshaft/x64/lithium-x64.cc |
@@ -1024,6 +1024,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()); |
@@ -1032,15 +1035,20 @@ LInstruction* LChunkBuilder::DoCallWithDescriptor( |
// Context |
LOperand* op = UseFixed(instr->OperandAt(1), rsi); |
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()); |