| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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/intermediate_language.h" | 5 #include "vm/intermediate_language.h" |
| 6 | 6 |
| 7 #include "vm/bit_vector.h" | 7 #include "vm/bit_vector.h" |
| 8 #include "vm/dart_entry.h" | 8 #include "vm/dart_entry.h" |
| 9 #include "vm/flow_graph_allocator.h" | 9 #include "vm/flow_graph_allocator.h" |
| 10 #include "vm/flow_graph_builder.h" | 10 #include "vm/flow_graph_builder.h" |
| (...skipping 1730 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1741 (left()->ResultCid() == kBoolCid)) { | 1741 (left()->ResultCid() == kBoolCid)) { |
| 1742 // Return left subexpression as the replacement for this instruction. | 1742 // Return left subexpression as the replacement for this instruction. |
| 1743 return left_defn; | 1743 return left_defn; |
| 1744 } | 1744 } |
| 1745 return this; | 1745 return this; |
| 1746 } | 1746 } |
| 1747 | 1747 |
| 1748 | 1748 |
| 1749 Instruction* CheckClassInstr::Canonicalize(FlowGraphOptimizer* optimizer) { | 1749 Instruction* CheckClassInstr::Canonicalize(FlowGraphOptimizer* optimizer) { |
| 1750 const intptr_t value_cid = value()->ResultCid(); | 1750 const intptr_t value_cid = value()->ResultCid(); |
| 1751 if (value_cid == kDynamicCid) { |
| 1752 return this; |
| 1753 } |
| 1754 |
| 1751 const intptr_t num_checks = unary_checks().NumberOfChecks(); | 1755 const intptr_t num_checks = unary_checks().NumberOfChecks(); |
| 1752 if ((num_checks == 1) && | 1756 |
| 1753 (value_cid == unary_checks().GetReceiverClassIdAt(0))) { | 1757 for (intptr_t i = 0; i < num_checks; i++) { |
| 1754 // No checks needed. | 1758 if (value_cid == unary_checks().GetReceiverClassIdAt(i)) { |
| 1755 return NULL; | 1759 // No checks needed. |
| 1760 return NULL; |
| 1761 } |
| 1756 } | 1762 } |
| 1763 |
| 1757 return this; | 1764 return this; |
| 1758 } | 1765 } |
| 1759 | 1766 |
| 1760 | 1767 |
| 1761 Instruction* CheckSmiInstr::Canonicalize(FlowGraphOptimizer* optimizer) { | 1768 Instruction* CheckSmiInstr::Canonicalize(FlowGraphOptimizer* optimizer) { |
| 1762 return (value()->ResultCid() == kSmiCid) ? NULL : this; | 1769 return (value()->ResultCid() == kSmiCid) ? NULL : this; |
| 1763 } | 1770 } |
| 1764 | 1771 |
| 1765 | 1772 |
| 1766 Instruction* CheckEitherNonSmiInstr::Canonicalize( | 1773 Instruction* CheckEitherNonSmiInstr::Canonicalize( |
| (...skipping 1194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2961 default: | 2968 default: |
| 2962 UNREACHABLE(); | 2969 UNREACHABLE(); |
| 2963 return -1; | 2970 return -1; |
| 2964 } | 2971 } |
| 2965 } | 2972 } |
| 2966 | 2973 |
| 2967 | 2974 |
| 2968 #undef __ | 2975 #undef __ |
| 2969 | 2976 |
| 2970 } // namespace dart | 2977 } // namespace dart |
| OLD | NEW |