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

Unified Diff: runtime/vm/code_generator.cc

Issue 18750004: Faster invocation of fields as methods. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 5 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 | runtime/vm/debugger.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/code_generator.cc
===================================================================
--- runtime/vm/code_generator.cc (revision 24991)
+++ runtime/vm/code_generator.cc (working copy)
@@ -1184,6 +1184,7 @@
const String& target_name,
const Array& arguments_descriptor,
const Array& arguments,
+ const ICData& ic_data,
Object* result) {
// 1. Check if there is a getter with the same name.
const String& getter_name = String::Handle(Field::GetterName(target_name));
@@ -1198,19 +1199,23 @@
return false;
}
- // 2. Invoke the getter.
- const Array& args = Array::Handle(Array::New(kNumArguments));
- args.SetAt(0, receiver);
- const Object& value = Object::Handle(DartEntry::InvokeFunction(getter, args));
-
- // 3. If there was some error, propagate it.
- CheckResultError(value);
-
- // 4. Invoke the value as a closure.
- Instance& instance = Instance::Handle();
- instance ^= value.raw();
- arguments.SetAt(0, instance);
- *result = DartEntry::InvokeClosure(arguments, arguments_descriptor);
+ const Function& target_function =
+ Function::Handle(receiver_class.GetInvocationDispatcher(
+ target_name,
+ arguments_descriptor,
+ RawFunction::kInvokeFieldDispatcher));
+ // Update IC data.
+ ASSERT(!target_function.IsNull());
+ ic_data.AddReceiverCheck(receiver.GetClassId(), target_function);
+ if (FLAG_trace_ic) {
+ OS::PrintErr("InvokeField IC miss: adding <%s> id:%"Pd" -> <%s>\n",
+ Class::Handle(receiver.clazz()).ToCString(),
+ receiver.GetClassId(),
+ target_function.ToCString());
+ }
+ *result = DartEntry::InvokeFunction(target_function,
+ arguments,
+ arguments_descriptor);
CheckResultError(*result);
return true;
}
@@ -1249,10 +1254,14 @@
target_name,
args_descriptor,
args,
+ ic_data,
&result)) {
ArgumentsDescriptor desc(args_descriptor);
- const Function& target_function = Function::Handle(
- receiver_class.GetNoSuchMethodDispatcher(target_name, args_descriptor));
+ const Function& target_function =
+ Function::Handle(receiver_class.GetInvocationDispatcher(
+ target_name,
+ args_descriptor,
+ RawFunction::kNoSuchMethodDispatcher));
// Update IC data.
ASSERT(!target_function.IsNull());
intptr_t receiver_cid = receiver.GetClassId();
« no previous file with comments | « no previous file | runtime/vm/debugger.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698