Index: runtime/vm/jit_optimizer.cc |
diff --git a/runtime/vm/jit_optimizer.cc b/runtime/vm/jit_optimizer.cc |
index 00f1588f9eba4a371e5e32346d7717be82bb297c..63c79bc2a0f948c63075106fea7611d72b981b57 100644 |
--- a/runtime/vm/jit_optimizer.cc |
+++ b/runtime/vm/jit_optimizer.cc |
@@ -1707,13 +1707,20 @@ void JitOptimizer::VisitInstanceCall(InstanceCallInstr* instr) { |
// we don't have one target. |
const Function& target = |
Function::Handle(Z, unary_checks.GetTargetAt(0)); |
- const bool polymorphic_target = MethodRecognizer::PolymorphicTarget(target); |
- has_one_target = !polymorphic_target; |
+ if (target.recognized_kind() == MethodRecognizer::kObjectRuntimeType) { |
+ has_one_target = |
+ PolymorphicInstanceCallInstr::ComputeRuntimeType(unary_checks) != |
+ Type::null(); |
+ } else { |
+ const bool polymorphic_target = |
+ MethodRecognizer::PolymorphicTarget(target); |
+ has_one_target = !polymorphic_target; |
+ } |
} |
if (has_one_target) { |
- RawFunction::Kind function_kind = |
- Function::Handle(Z, unary_checks.GetTargetAt(0)).kind(); |
+ const Function& target = Function::Handle(Z, unary_checks.GetTargetAt(0)); |
+ const RawFunction::Kind function_kind = target.kind(); |
if (!flow_graph()->InstanceCallNeedsClassCheck(instr, function_kind)) { |
PolymorphicInstanceCallInstr* call = |
new(Z) PolymorphicInstanceCallInstr(instr, unary_checks, |