| Index: runtime/vm/jit_optimizer.cc
|
| diff --git a/runtime/vm/jit_optimizer.cc b/runtime/vm/jit_optimizer.cc
|
| index fb6ee1d43be1d01be334cbb573a14b2f57af868e..e69a8c3ce19a5fcab2020a4e60acd4d321c760fb 100644
|
| --- a/runtime/vm/jit_optimizer.cc
|
| +++ b/runtime/vm/jit_optimizer.cc
|
| @@ -199,9 +199,6 @@ void JitOptimizer::SpecializePolymorphicInstanceCall(
|
| // Specialization adds receiver checks which can lead to deoptimization.
|
| return;
|
| }
|
| - if (!call->with_checks()) {
|
| - return; // Already specialized.
|
| - }
|
|
|
| const intptr_t receiver_cid =
|
| call->PushArgumentAt(0)->value()->Type()->ToCid();
|
| @@ -220,11 +217,9 @@ void JitOptimizer::SpecializePolymorphicInstanceCall(
|
| return;
|
| }
|
|
|
| - const bool with_checks = false;
|
| - const bool complete = false;
|
| - PolymorphicInstanceCallInstr* specialized =
|
| - new (Z) PolymorphicInstanceCallInstr(call->instance_call(), *targets,
|
| - with_checks, complete);
|
| + ASSERT(targets->HasSingleTarget());
|
| + const Function& target = targets->FirstTarget();
|
| + StaticCallInstr* specialized = StaticCallInstr::FromCall(Z, call, target);
|
| call->ReplaceWith(specialized, current_iterator());
|
| }
|
|
|
| @@ -1531,10 +1526,7 @@ void JitOptimizer::VisitInstanceCall(InstanceCallInstr* instr) {
|
| 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, *targets,
|
| - /* call_with_checks = */ false,
|
| - /* complete = */ false);
|
| + StaticCallInstr* call = StaticCallInstr::FromCall(Z, instr, target);
|
| instr->ReplaceWith(call, current_iterator());
|
| return;
|
| }
|
| @@ -1550,7 +1542,6 @@ void JitOptimizer::VisitInstanceCall(InstanceCallInstr* instr) {
|
| // very polymorphic sites we don't make this optimization, keeping it as a
|
| // regular checked PolymorphicInstanceCall, which falls back to the slow but
|
| // non-deopting megamorphic call stub when it sees new receiver classes.
|
| - bool call_with_checks;
|
| if (has_one_target && FLAG_polymorphic_with_deopt &&
|
| (!instr->ic_data()->HasDeoptReason(ICData::kDeoptCheckClass) ||
|
| unary_checks.NumberOfChecks() <= FLAG_max_polymorphic_checks)) {
|
| @@ -1559,14 +1550,15 @@ void JitOptimizer::VisitInstanceCall(InstanceCallInstr* instr) {
|
| // array, not the IC array.
|
| AddReceiverCheck(instr);
|
| // Call can still deoptimize, do not detach environment from instr.
|
| - call_with_checks = false;
|
| + const Function& target = Function::Handle(Z, unary_checks.GetTargetAt(0));
|
| + StaticCallInstr* call = StaticCallInstr::FromCall(Z, instr, target);
|
| + instr->ReplaceWith(call, current_iterator());
|
| } else {
|
| - call_with_checks = true;
|
| + PolymorphicInstanceCallInstr* call =
|
| + new (Z) PolymorphicInstanceCallInstr(instr, *targets,
|
| + /* complete = */ false);
|
| + instr->ReplaceWith(call, current_iterator());
|
| }
|
| - PolymorphicInstanceCallInstr* call =
|
| - new (Z) PolymorphicInstanceCallInstr(instr, *targets, call_with_checks,
|
| - /* complete = */ false);
|
| - instr->ReplaceWith(call, current_iterator());
|
| }
|
|
|
|
|
|
|