Index: src/ia32/fast-codegen-ia32.cc |
=================================================================== |
--- src/ia32/fast-codegen-ia32.cc (revision 3194) |
+++ src/ia32/fast-codegen-ia32.cc (working copy) |
@@ -788,8 +788,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(); |
@@ -825,19 +830,28 @@ |
} |
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 != NULL); |
+ ASSERT(!var->is_this()); |
+ ASSERT(var->is_global()); |
ASSERT(!var->is_possibly_eval()); |
__ push(Immediate(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. |
+ __ mov(ebx, CodeGenerator::GlobalObject()); |
+ __ push(FieldOperand(ebx, GlobalObject::kGlobalReceiverOffset)); |
+ // Emit function call. |
+ EmitCallWithStub(expr); |
} |
} |