Index: src/x64/fast-codegen-x64.cc |
=================================================================== |
--- src/x64/fast-codegen-x64.cc (revision 3194) |
+++ src/x64/fast-codegen-x64.cc (working copy) |
@@ -802,8 +802,13 @@ |
void FastCodeGenerator::VisitCall(Call* expr) { |
Expression* fun = expr->expression(); |
+ Variable* var = fun->AsVariableProxy()->AsVariable(); |
- if (fun->AsProperty() != NULL) { |
+ if (var != NULL && |
+ var->is_possibly_eval()) { |
+ // Call to eval. |
+ UNREACHABLE(); |
+ } else if (fun->AsProperty() != NULL) { |
// Call on a property. |
Property* prop = fun->AsProperty(); |
Literal* key = prop->key()->AsLiteral(); |
@@ -839,19 +844,26 @@ |
} |
EmitCallWithStub(expr); |
} |
- } else if (fun->AsVariableProxy()->AsVariable() != NULL) { |
+ } else if (var != NULL) { |
// Call on a global variable |
- Variable* var = fun->AsVariableProxy()->AsVariable(); |
ASSERT(var != NULL && !var->is_this() && var->is_global()); |
ASSERT(!var->is_possibly_eval()); |
__ Push(var->name()); |
// Push global object (receiver). |
__ push(CodeGenerator::GlobalObject()); |
EmitCallWithIC(expr, RelocInfo::CODE_TARGET_CONTEXT); |
+ } else if (var != NULL && var->slot() != NULL && |
+ var->slot()->type() == Slot::LOOKUP) { |
+ // Call inside a with-statement |
+ UNREACHABLE(); |
} else { |
- // Calls we cannot handle right now. |
- // Should bailout in the CodeGenSelector. |
- UNREACHABLE(); |
+ // Call with an arbitrary function expression. |
+ Visit(expr->expression()); |
+ // Load global receiver object. |
+ __ movq(rbx, CodeGenerator::GlobalObject()); |
+ __ push(FieldOperand(rbx, GlobalObject::kGlobalReceiverOffset)); |
+ // Emit function call. |
+ EmitCallWithStub(expr); |
} |
} |