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

Unified Diff: src/x64/fast-codegen-x64.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/ia32/fast-codegen-ia32.cc ('k') | test/mjsunit/compiler/function-call.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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);
}
}
« no previous file with comments | « src/ia32/fast-codegen-ia32.cc ('k') | test/mjsunit/compiler/function-call.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698