Index: runtime/vm/code_generator.cc |
diff --git a/runtime/vm/code_generator.cc b/runtime/vm/code_generator.cc |
index 9b3eb295c83059e52210650f7fca07def7f3d33b..54613cdff366a07a4ba6eaf6ce838260fed31f05 100644 |
--- a/runtime/vm/code_generator.cc |
+++ b/runtime/vm/code_generator.cc |
@@ -1049,7 +1049,17 @@ DEFINE_RUNTIME_ENTRY(MegamorphicCacheMissHandler, 3) { |
if (ic_data_or_cache.IsICData()) { |
const ICData& ic_data = ICData::Cast(ic_data_or_cache); |
- ic_data.AddReceiverCheck(receiver.GetClassId(), target_function); |
+ |
+ if (ic_data.NumArgsTested() == 1) { |
+ ic_data.AddReceiverCheck(receiver.GetClassId(), target_function); |
+ } else { |
+ ASSERT(ic_data.NumArgsTested() == 2); |
+ GrowableArray<intptr_t> class_ids(2); |
+ class_ids.Add(receiver.GetClassId()); |
+ class_ids.Add(kDynamicCid); // No one will read this. |
+ ic_data.AddCheck(class_ids, target_function); |
+ } |
+ |
if (ic_data.NumberOfChecks() > FLAG_max_polymorphic_checks) { |
// Switch to megamorphic call. |
const MegamorphicCache& cache = MegamorphicCache::Handle(zone, |