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

Unified Diff: runtime/vm/parser.cc

Issue 890573002: VM: Simplify dispatcher code for closure calls. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 5 years, 11 months 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 | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/parser.cc
===================================================================
--- runtime/vm/parser.cc (revision 43280)
+++ runtime/vm/parser.cc (working copy)
@@ -1432,11 +1432,18 @@
ArgumentListNode* no_args = new ArgumentListNode(token_pos);
LoadLocalNode* receiver = new LoadLocalNode(token_pos, scope->VariableAt(0));
+ const Class& owner = Class::Handle(Z, func.Owner());
+ ASSERT(!owner.IsNull());
const String& name = String::Handle(Z, func.name());
- const String& getter_name = String::ZoneHandle(Z,
- Symbols::New(String::Handle(Z, Field::GetterName(name))));
- InstanceCallNode* getter_call = new(Z) InstanceCallNode(
- token_pos, receiver, getter_name, no_args);
+ AstNode* function_object = NULL;
+ if (owner.IsSignatureClass() && name.Equals(Symbols::Call())) {
+ function_object = receiver;
+ } else {
+ const String& getter_name = String::ZoneHandle(Z,
+ Symbols::New(String::Handle(Z, Field::GetterName(name))));
+ function_object = new(Z) InstanceCallNode(
+ token_pos, receiver, getter_name, no_args);
+ }
// Pass arguments 1..n to the closure call.
ArgumentListNode* args = new(Z) ArgumentListNode(token_pos);
@@ -1455,13 +1462,11 @@
}
args->set_names(names);
- const Class& owner = Class::Handle(Z, func.Owner());
- ASSERT(!owner.IsNull());
AstNode* result = NULL;
if (owner.IsSignatureClass() && name.Equals(Symbols::Call())) {
- result = new ClosureCallNode(token_pos, getter_call, args);
+ result = new ClosureCallNode(token_pos, function_object, args);
} else {
- result = BuildClosureCall(token_pos, getter_call, args);
+ result = BuildClosureCall(token_pos, function_object, args);
}
ReturnNode* return_node = new ReturnNode(token_pos, result);
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698