| 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 part of ssa; | 5 part of ssa; |
| 6 | 6 |
| 7 abstract class OptimizationPhase { | 7 abstract class OptimizationPhase { |
| 8 String get name; | 8 String get name; |
| 9 void visitGraph(HGraph graph); | 9 void visitGraph(HGraph graph); |
| 10 } | 10 } |
| (...skipping 964 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 975 if (boundsChecked.contains(node)) return; | 975 if (boundsChecked.contains(node)) return; |
| 976 HInstruction index = node.index; | 976 HInstruction index = node.index; |
| 977 if (!node.index.isInteger()) { | 977 if (!node.index.isInteger()) { |
| 978 index = insertIntegerCheck(node, index); | 978 index = insertIntegerCheck(node, index); |
| 979 } | 979 } |
| 980 index = insertBoundsCheck(node, node.receiver, index); | 980 index = insertBoundsCheck(node, node.receiver, index); |
| 981 node.changeUse(node.index, index); | 981 node.changeUse(node.index, index); |
| 982 } | 982 } |
| 983 | 983 |
| 984 void visitIndexAssign(HIndexAssign node) { | 984 void visitIndexAssign(HIndexAssign node) { |
| 985 if (!node.receiver.isMutableArray()) return; | |
| 986 if (boundsChecked.contains(node)) return; | 985 if (boundsChecked.contains(node)) return; |
| 987 HInstruction index = node.index; | 986 HInstruction index = node.index; |
| 988 if (!node.index.isInteger()) { | 987 if (!node.index.isInteger()) { |
| 989 index = insertIntegerCheck(node, index); | 988 index = insertIntegerCheck(node, index); |
| 990 } | 989 } |
| 991 index = insertBoundsCheck(node, node.receiver, index); | 990 index = insertBoundsCheck(node, node.receiver, index); |
| 992 node.changeUse(node.index, index); | 991 node.changeUse(node.index, index); |
| 993 } | 992 } |
| 994 | 993 |
| 995 void visitInvokeDynamicMethod(HInvokeDynamicMethod node) { | 994 void visitInvokeDynamicMethod(HInvokeDynamicMethod node) { |
| (...skipping 715 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1711 HBasicBlock block = user.block; | 1710 HBasicBlock block = user.block; |
| 1712 block.addAfter(user, interceptor); | 1711 block.addAfter(user, interceptor); |
| 1713 block.rewrite(user, interceptor); | 1712 block.rewrite(user, interceptor); |
| 1714 block.remove(user); | 1713 block.remove(user); |
| 1715 | 1714 |
| 1716 // The interceptor will be removed in the dead code elimination | 1715 // The interceptor will be removed in the dead code elimination |
| 1717 // phase. Note that removing it here would not work because of how | 1716 // phase. Note that removing it here would not work because of how |
| 1718 // the [visitBasicBlock] is implemented. | 1717 // the [visitBasicBlock] is implemented. |
| 1719 } | 1718 } |
| 1720 } | 1719 } |
| OLD | NEW |