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

Unified Diff: src/arm/fast-codegen-arm.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 | « no previous file | src/compiler.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/arm/fast-codegen-arm.cc
===================================================================
--- src/arm/fast-codegen-arm.cc (revision 3194)
+++ src/arm/fast-codegen-arm.cc (working copy)
@@ -765,8 +765,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();
@@ -797,9 +802,8 @@
__ str(r1, MemOperand(sp));
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());
__ mov(r1, Operand(var->name()));
@@ -807,10 +811,19 @@
__ ldr(r0, CodeGenerator::GlobalObject());
__ stm(db_w, sp, r1.bit() | r0.bit());
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.
+ __ ldr(r1, CodeGenerator::GlobalObject());
+ __ ldr(r1, FieldMemOperand(r1, GlobalObject::kGlobalReceiverOffset));
+ __ push(r1);
+ // Emit function call.
+ EmitCallWithStub(expr);
}
}
« no previous file with comments | « no previous file | src/compiler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698