| Index: src/x64/full-codegen-x64.cc
|
| ===================================================================
|
| --- src/x64/full-codegen-x64.cc (revision 3837)
|
| +++ src/x64/full-codegen-x64.cc (working copy)
|
| @@ -1200,7 +1200,7 @@
|
|
|
|
|
| void FullCodeGenerator::EmitCallWithIC(Call* expr,
|
| - Handle<Object> ignored,
|
| + Handle<Object> name,
|
| RelocInfo::Mode mode) {
|
| // Code common for calls using the IC.
|
| ZoneList<Expression*>* args = expr->arguments();
|
| @@ -1208,6 +1208,7 @@
|
| for (int i = 0; i < arg_count; i++) {
|
| VisitForValue(args->at(i), kStack);
|
| }
|
| + __ Move(rcx, name);
|
| // Record source position for debugger.
|
| SetSourcePosition(expr->position());
|
| // Call the IC initialization code.
|
| @@ -1217,8 +1218,7 @@
|
| __ Call(ic, mode);
|
| // Restore context register.
|
| __ movq(rsi, Operand(rbp, StandardFrameConstants::kContextOffset));
|
| - // Discard the function left on TOS.
|
| - DropAndApply(1, context_, rax);
|
| + Apply(context_, rax);
|
| }
|
|
|
|
|
| @@ -1250,7 +1250,6 @@
|
| UNREACHABLE();
|
| } else if (var != NULL && !var->is_this() && var->is_global()) {
|
| // Call to a global variable.
|
| - __ Push(var->name());
|
| // Push global object as receiver for the call IC lookup.
|
| __ push(CodeGenerator::GlobalObject());
|
| EmitCallWithIC(expr, var->name(), RelocInfo::CODE_TARGET_CONTEXT);
|
| @@ -1264,7 +1263,6 @@
|
| Literal* key = prop->key()->AsLiteral();
|
| if (key != NULL && key->handle()->IsSymbol()) {
|
| // Call to a named property, use call IC.
|
| - __ Push(key->handle());
|
| VisitForValue(prop->obj(), kStack);
|
| EmitCallWithIC(expr, key->handle(), RelocInfo::CODE_TARGET);
|
| } else {
|
| @@ -1355,7 +1353,6 @@
|
|
|
| if (expr->is_jsruntime()) {
|
| // Prepare for calling JS runtime function.
|
| - __ Push(expr->name());
|
| __ movq(rax, CodeGenerator::GlobalObject());
|
| __ push(FieldOperand(rax, GlobalObject::kBuiltinsOffset));
|
| }
|
| @@ -1367,18 +1364,17 @@
|
| }
|
|
|
| if (expr->is_jsruntime()) {
|
| - // Call the JS runtime function.
|
| - Handle<Code> ic = CodeGenerator::ComputeCallInitialize(arg_count,
|
| - NOT_IN_LOOP);
|
| + // Call the JS runtime function using a call IC.
|
| + __ Move(rcx, expr->name());
|
| + InLoopFlag in_loop = (loop_depth() > 0) ? IN_LOOP : NOT_IN_LOOP;
|
| + Handle<Code> ic = CodeGenerator::ComputeCallInitialize(arg_count, in_loop);
|
| __ call(ic, RelocInfo::CODE_TARGET);
|
| // Restore context register.
|
| __ movq(rsi, Operand(rbp, StandardFrameConstants::kContextOffset));
|
| - // Discard the function left on TOS.
|
| - DropAndApply(1, context_, rax);
|
| } else {
|
| __ CallRuntime(expr->function(), arg_count);
|
| - Apply(context_, rax);
|
| }
|
| + Apply(context_, rax);
|
| }
|
|
|
|
|
|
|