| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 #include "vm/jit_optimizer.h" | 5 #include "vm/jit_optimizer.h" |
| 6 | 6 |
| 7 #include "vm/bit_vector.h" | 7 #include "vm/bit_vector.h" |
| 8 #include "vm/branch_optimizer.h" | 8 #include "vm/branch_optimizer.h" |
| 9 #include "vm/cha.h" | 9 #include "vm/cha.h" |
| 10 #include "vm/compiler.h" | 10 #include "vm/compiler.h" |
| (...skipping 1689 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1700 return; | 1700 return; |
| 1701 } | 1701 } |
| 1702 | 1702 |
| 1703 bool has_one_target = unary_checks.HasOneTarget(); | 1703 bool has_one_target = unary_checks.HasOneTarget(); |
| 1704 | 1704 |
| 1705 if (has_one_target) { | 1705 if (has_one_target) { |
| 1706 // Check if the single target is a polymorphic target, if it is, | 1706 // Check if the single target is a polymorphic target, if it is, |
| 1707 // we don't have one target. | 1707 // we don't have one target. |
| 1708 const Function& target = | 1708 const Function& target = |
| 1709 Function::Handle(Z, unary_checks.GetTargetAt(0)); | 1709 Function::Handle(Z, unary_checks.GetTargetAt(0)); |
| 1710 const bool polymorphic_target = MethodRecognizer::PolymorphicTarget(target); | 1710 if (target.recognized_kind() == MethodRecognizer::kObjectRuntimeType) { |
| 1711 has_one_target = !polymorphic_target; | 1711 has_one_target = |
| 1712 PolymorphicInstanceCallInstr::ComputeRuntimeType(unary_checks) != |
| 1713 Type::null(); |
| 1714 } else { |
| 1715 const bool polymorphic_target = |
| 1716 MethodRecognizer::PolymorphicTarget(target); |
| 1717 has_one_target = !polymorphic_target; |
| 1718 } |
| 1712 } | 1719 } |
| 1713 | 1720 |
| 1714 if (has_one_target) { | 1721 if (has_one_target) { |
| 1715 RawFunction::Kind function_kind = | 1722 const Function& target = Function::Handle(Z, unary_checks.GetTargetAt(0)); |
| 1716 Function::Handle(Z, unary_checks.GetTargetAt(0)).kind(); | 1723 const RawFunction::Kind function_kind = target.kind(); |
| 1717 if (!flow_graph()->InstanceCallNeedsClassCheck(instr, function_kind)) { | 1724 if (!flow_graph()->InstanceCallNeedsClassCheck(instr, function_kind)) { |
| 1718 PolymorphicInstanceCallInstr* call = | 1725 PolymorphicInstanceCallInstr* call = |
| 1719 new(Z) PolymorphicInstanceCallInstr(instr, unary_checks, | 1726 new(Z) PolymorphicInstanceCallInstr(instr, unary_checks, |
| 1720 /* call_with_checks = */ false, | 1727 /* call_with_checks = */ false, |
| 1721 /* complete = */ false); | 1728 /* complete = */ false); |
| 1722 instr->ReplaceWith(call, current_iterator()); | 1729 instr->ReplaceWith(call, current_iterator()); |
| 1723 return; | 1730 return; |
| 1724 } | 1731 } |
| 1725 } | 1732 } |
| 1726 | 1733 |
| (...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2013 | 2020 |
| 2014 // Discard the environment from the original instruction because the store | 2021 // Discard the environment from the original instruction because the store |
| 2015 // can't deoptimize. | 2022 // can't deoptimize. |
| 2016 instr->RemoveEnvironment(); | 2023 instr->RemoveEnvironment(); |
| 2017 ReplaceCall(instr, store); | 2024 ReplaceCall(instr, store); |
| 2018 return true; | 2025 return true; |
| 2019 } | 2026 } |
| 2020 | 2027 |
| 2021 | 2028 |
| 2022 } // namespace dart | 2029 } // namespace dart |
| OLD | NEW |