Index: src/ia32/full-codegen-ia32.cc |
=================================================================== |
--- src/ia32/full-codegen-ia32.cc (revision 5833) |
+++ src/ia32/full-codegen-ia32.cc (working copy) |
@@ -2017,24 +2017,32 @@ |
void FullCodeGenerator::EmitKeyedCallWithIC(Call* expr, |
Expression* key, |
RelocInfo::Mode mode) { |
- // Code common for calls using the IC. |
+ // Load the key. |
+ VisitForAccumulatorValue(key); |
+ |
+ // Swap the name of the function and the receiver on the stack to follow |
+ // the calling convention for call ICs. |
+ __ pop(ecx); |
+ __ push(eax); |
+ __ push(ecx); |
+ |
+ // Load the arguments. |
ZoneList<Expression*>* args = expr->arguments(); |
int arg_count = args->length(); |
{ PreserveStatementPositionScope scope(masm()->positions_recorder()); |
for (int i = 0; i < arg_count; i++) { |
VisitForStackValue(args->at(i)); |
} |
- VisitForAccumulatorValue(key); |
- __ mov(ecx, eax); |
} |
// Record source position of the IC call. |
SetSourcePosition(expr->position(), FORCED_POSITION); |
InLoopFlag in_loop = (loop_depth() > 0) ? IN_LOOP : NOT_IN_LOOP; |
Handle<Code> ic = StubCache::ComputeKeyedCallInitialize(arg_count, in_loop); |
+ __ mov(ecx, Operand(esp, (arg_count + 1) * kPointerSize)); // Key. |
EmitCallIC(ic, mode); |
// Restore context register. |
__ mov(esi, Operand(ebp, StandardFrameConstants::kContextOffset)); |
- context()->Plug(eax); |
+ context()->DropAndPlug(1, eax); // Drop the key still on the stack. |
} |