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

Unified Diff: runtime/vm/code_generator.cc

Issue 11642003: Create and cache method extraction stub in the ICData. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: lazyly inject extractors as getters into class Created 7 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 | « runtime/vm/class_finalizer.cc ('k') | runtime/vm/dart_api_impl.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/code_generator.cc
diff --git a/runtime/vm/code_generator.cc b/runtime/vm/code_generator.cc
index 0dd758140a55a5fbf8bf0f3b22e95517a5076111..fcfb43a0af1edbfea12f2a00d9acf8e0c328713c 100644
--- a/runtime/vm/code_generator.cc
+++ b/runtime/vm/code_generator.cc
@@ -1127,39 +1127,6 @@ DEFINE_RUNTIME_ENTRY(InvokeNonClosure, 3) {
}
-// An instance call could not be resolved by an IC miss handler. Check if
-// it was a getter call and if there is an instance function with the same
-// name. If so, create and return an implicit closure from the function.
-// Otherwise return null.
-static RawInstance* ResolveImplicitClosure(const Instance& receiver,
- const Class& receiver_class,
- const String& target_name) {
- // 1. Check if was a getter call.
- if (!Field::IsGetterName(target_name)) return Instance::null();
-
- // 2. Check if there is an instance function with the same name.
- String& function_name = String::Handle(Field::NameFromGetter(target_name));
- function_name = Symbols::New(function_name);
- const Function& function = Function::Handle(
- Resolver::ResolveDynamicAnyArgs(receiver_class, function_name));
- if (function.IsNull()) return Instance::null();
-
- // Create a closure object for the implicit closure function.
- const Function& closure_function =
- Function::Handle(function.ImplicitClosureFunction());
- const Context& context = Context::Handle(Context::New(1));
- context.SetAt(0, receiver);
- const Instance& closure =
- Instance::Handle(Closure::New(closure_function, context));
- if (receiver_class.HasTypeArguments()) {
- const AbstractTypeArguments& type_arguments =
- AbstractTypeArguments::Handle(receiver.GetTypeArguments());
- closure.SetTypeArguments(type_arguments);
- }
- return closure.raw();
-}
-
-
// An instance call of the form o.f(...) could not be resolved. Check if
// there is a getter with the same name. If so, invoke it. If the value is
// a closure, invoke it with the given arguments. If the value is a
@@ -1179,7 +1146,9 @@ static bool ResolveCallThroughGetter(const Instance& receiver,
getter_name,
kNumArguments,
kNumNamedArguments));
- if (getter.IsNull()) return false;
+ if (getter.IsNull() || getter.IsMethodExtractor()) {
+ return false;
+ }
// 2. Invoke the getter.
const Array& args = Array::Handle(Array::New(kNumArguments));
@@ -1231,14 +1200,6 @@ DEFINE_RUNTIME_ENTRY(InstanceFunctionLookup, 4) {
}
const String& target_name = String::Handle(ic_data.target_name());
- Instance& closure = Instance::Handle(ResolveImplicitClosure(receiver,
- receiver_class,
- target_name));
- if (!closure.IsNull()) {
- arguments.SetReturn(closure);
- return;
- }
-
Object& result = Object::Handle();
if (!ResolveCallThroughGetter(receiver,
receiver_class,
« no previous file with comments | « runtime/vm/class_finalizer.cc ('k') | runtime/vm/dart_api_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698