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

Unified Diff: runtime/vm/code_generator.cc

Issue 11231074: Change signature of noSuchMethod to take an InvocationMirror. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: One more test expectation Created 8 years, 2 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/lib/object_patch.dart ('k') | runtime/vm/flow_graph_builder.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 a4d3cf4c495edf71b0aabb613c0d748d61b0f75c..e2efe293ebc8566f0b26da51421053d2cf9ce021 100644
--- a/runtime/vm/code_generator.cc
+++ b/runtime/vm/code_generator.cc
@@ -1282,23 +1282,43 @@ DEFINE_RUNTIME_ENTRY(InvokeNoSuchMethodFunction, 4) {
const String& original_function_name = String::Handle(ic_data.target_name());
ASSERT(!Array::CheckedHandle(arguments.At(2)).IsNull());
const Array& orig_arguments = Array::CheckedHandle(arguments.At(3));
- // TODO(regis): The signature of the "noSuchMethod" method has to change from
- // noSuchMethod(String name, Array arguments) to something like
- // noSuchMethod(InvocationMirror call).
- const int kNumArguments = 3;
- const int kNumNamedArguments = 0;
+ // Allocate an InvocationMirror object.
+ // TODO(regis): Fill in the InvocationMirror object correctly at
+ // this point we do not deal with named arguments and treat them
+ // all as positional.
+ const Library& core_lib = Library::Handle(Library::CoreLibrary());
+ const String& invocation_mirror_name = String::Handle(
+ Symbols::InvocationMirror());
+ Class& invocation_mirror_class = Class::Handle(
+ core_lib.LookupClassAllowPrivate(invocation_mirror_name));
+ ASSERT(!invocation_mirror_class.IsNull());
+ const String& allocation_function_name = String::Handle(
+ Symbols::AllocateInvocationMirror());
+ const Function& allocation_function = Function::ZoneHandle(
+ Resolver::ResolveStaticByName(invocation_mirror_class,
+ allocation_function_name,
+ Resolver::kIsQualified));
+ ASSERT(!allocation_function.IsNull());
+ GrowableArray<const Object*> allocation_arguments(2);
+ allocation_arguments.Add(&original_function_name);
+ allocation_arguments.Add(&orig_arguments);
const Array& kNoArgumentNames = Array::Handle();
- const String& function_name =
- String::Handle(Symbols::NoSuchMethod());
+ const Object& invocation_mirror = Object::Handle(
+ DartEntry::InvokeStatic(allocation_function,
+ allocation_arguments,
+ kNoArgumentNames));
+
+ const int kNumArguments = 2;
+ const int kNumNamedArguments = 0;
+ const String& function_name = String::Handle(Symbols::NoSuchMethod());
const Function& function = Function::ZoneHandle(
Resolver::ResolveDynamic(receiver,
function_name,
kNumArguments,
kNumNamedArguments));
ASSERT(!function.IsNull());
- GrowableArray<const Object*> invoke_arguments(2);
- invoke_arguments.Add(&original_function_name);
- invoke_arguments.Add(&orig_arguments);
+ GrowableArray<const Object*> invoke_arguments(1);
+ invoke_arguments.Add(&invocation_mirror);
const Object& result = Object::Handle(
DartEntry::InvokeDynamic(receiver,
function,
« no previous file with comments | « runtime/lib/object_patch.dart ('k') | runtime/vm/flow_graph_builder.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698