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

Unified Diff: runtime/vm/code_generator.cc

Issue 18469003: Guard against entering a noSuchMethod dispatcher twice into ICData. (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 | no next file » | 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 24939)
+++ runtime/vm/code_generator.cc (working copy)
@@ -1254,13 +1254,25 @@
receiver_class.GetNoSuchMethodDispatcher(target_name, args_descriptor));
// Update IC data.
ASSERT(!target_function.IsNull());
+ intptr_t receiver_cid = receiver.GetClassId();
if (ic_data.num_args_tested() == 1) {
srdjan 2013/07/12 14:45:12 Add a TODO as discussed in the the CL text.
Florian Schneider 2013/07/12 15:43:59 Done. There is a TODO below about that.
- ic_data.AddReceiverCheck(receiver.GetClassId(), target_function);
+ // In optimized code we may enter into here via the
+ // MegamorphicCacheMissHandler since noSuchMethod dispatchers are not
+ // inserted into the megamorphic cache. Therefore, we need to guard
+ // against entering the same check twice into the ICData.
+ // Note that num_args_tested == 1 in optimized code.
+ // TODO(fschneider): Handle extraordinary cases like noSuchMethod and
+ // implicit closure invocation properly in the megamorphic cache.
+ const Function& target =
+ Function::Handle(ic_data.GetTargetForReceiverClassId(receiver_cid));
+ if (target.IsNull()) {
+ ic_data.AddReceiverCheck(receiver_cid, target_function);
+ }
} else {
// Operators calls have two or three arguments tested ([], []=, etc.)
ASSERT(ic_data.num_args_tested() > 1);
GrowableArray<intptr_t> class_ids(ic_data.num_args_tested());
- class_ids.Add(receiver.GetClassId());
+ class_ids.Add(receiver_cid);
for (intptr_t i = 1; i < ic_data.num_args_tested(); ++i) {
class_ids.Add(Object::Handle(args.At(i)).GetClassId());
}
@@ -1269,7 +1281,7 @@
if (FLAG_trace_ic) {
OS::PrintErr("NoSuchMethod IC miss: adding <%s> id:%"Pd" -> <%s>\n",
Class::Handle(receiver.clazz()).ToCString(),
- receiver.GetClassId(),
+ receiver_cid,
target_function.ToCString());
}
result = DartEntry::InvokeFunction(target_function, args, args_descriptor);
« 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