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

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

Issue 355009: Fix a latent bug in the top-level compilation of function calls.... (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 3203)
+++ src/ia32/fast-codegen-ia32.cc (working copy)
@@ -787,29 +787,38 @@
void FastCodeGenerator::VisitCall(Call* expr) {
+ Comment cmnt(masm_, "[ Call");
Expression* fun = expr->expression();
Variable* var = fun->AsVariableProxy()->AsVariable();
- if (var != NULL &&
- var->is_possibly_eval()) {
- // Call to eval.
+ if (var != NULL && var->is_possibly_eval()) {
+ // Call to the identifier 'eval'.
UNREACHABLE();
+ } else if (var != NULL && !var->is_this() && var->is_global()) {
+ // Call to a global variable.
+ __ push(Immediate(var->name()));
+ // Push global object as receiver for the call IC lookup.
+ __ push(CodeGenerator::GlobalObject());
+ EmitCallWithIC(expr, RelocInfo::CODE_TARGET_CONTEXT);
+ } else if (var != NULL && var->slot() != NULL &&
+ var->slot()->type() == Slot::LOOKUP) {
+ // Call to a lookup slot.
+ UNREACHABLE();
} else if (fun->AsProperty() != NULL) {
- // Call on a property.
+ // Call to an object property.
Property* prop = fun->AsProperty();
Literal* key = prop->key()->AsLiteral();
if (key != NULL && key->handle()->IsSymbol()) {
- // Call on a named property: foo.x(1,2,3)
+ // Call to a named property, use call IC.
__ push(Immediate(key->handle()));
Visit(prop->obj());
- // Use call IC.
EmitCallWithIC(expr, RelocInfo::CODE_TARGET);
} else {
- // Call on a keyed property: foo[key](1,2,3)
- // Use a keyed load IC followed by a call IC.
+ // Call to a keyed property, use keyed load IC followed by function
+ // call.
Visit(prop->obj());
Visit(prop->key());
- // Record source position of property.
+ // Record source code position for IC call.
SetSourcePosition(prop->position());
Handle<Code> ic(Builtins::builtin(Builtins::KeyedLoadIC_Initialize));
__ call(ic, RelocInfo::CODE_TARGET);
@@ -830,22 +839,8 @@
}
EmitCallWithStub(expr);
}
- } else if (var != NULL) {
- // Call on a global variable
- 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 {
- // Call with an arbitrary function expression.
+ // Call to some other function expression.
Visit(expr->expression());
// Load global receiver object.
__ mov(ebx, CodeGenerator::GlobalObject());
« 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