Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(481)

Unified Diff: src/ia32/fast-codegen-ia32.cc

Issue 346029: Support for function calls on an arbitrary expression that returns... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 11 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/compiler.cc ('k') | src/x64/fast-codegen-x64.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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);
}
}
« no previous file with comments | « src/compiler.cc ('k') | src/x64/fast-codegen-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698