| 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 668 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 679 constantInterceptor = backend.jsIntClass; | 679 constantInterceptor = backend.jsIntClass; |
| 680 } else if (type.isDouble()) { | 680 } else if (type.isDouble()) { |
| 681 constantInterceptor = backend.jsDoubleClass; | 681 constantInterceptor = backend.jsDoubleClass; |
| 682 } else if (type.isBoolean()) { | 682 } else if (type.isBoolean()) { |
| 683 constantInterceptor = backend.jsBoolClass; | 683 constantInterceptor = backend.jsBoolClass; |
| 684 } else if (type.isString()) { | 684 } else if (type.isString()) { |
| 685 constantInterceptor = backend.jsStringClass; | 685 constantInterceptor = backend.jsStringClass; |
| 686 } else if (type.isArray()) { | 686 } else if (type.isArray()) { |
| 687 constantInterceptor = backend.jsArrayClass; | 687 constantInterceptor = backend.jsArrayClass; |
| 688 } else if (type.isNull()) { | 688 } else if (type.isNull()) { |
| 689 constantInterceptor = backend.jsIntClass; | 689 constantInterceptor = backend.jsNullClass; |
| 690 } else if (type.isNumber()) { | 690 } else if (type.isNumber()) { |
| 691 // If the method being intercepted is not defined in [int] or | 691 // If the method being intercepted is not defined in [int] or |
| 692 // [double] we can safely use the number interceptor. | 692 // [double] we can safely use the number interceptor. |
| 693 if (!intercepted.contains(compiler.intClass) | 693 if (!intercepted.contains(compiler.intClass) |
| 694 && !intercepted.contains(compiler.doubleClass)) { | 694 && !intercepted.contains(compiler.doubleClass)) { |
| 695 constantInterceptor = backend.jsNumberClass; | 695 constantInterceptor = backend.jsNumberClass; |
| 696 } | 696 } |
| 697 } | 697 } |
| 698 | 698 |
| 699 if (constantInterceptor == null) return null; | 699 if (constantInterceptor == null) return null; |
| (...skipping 820 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1520 HBasicBlock block = user.block; | 1520 HBasicBlock block = user.block; |
| 1521 block.addAfter(user, interceptor); | 1521 block.addAfter(user, interceptor); |
| 1522 block.rewrite(user, interceptor); | 1522 block.rewrite(user, interceptor); |
| 1523 block.remove(user); | 1523 block.remove(user); |
| 1524 | 1524 |
| 1525 // The interceptor will be removed in the dead code elimination | 1525 // The interceptor will be removed in the dead code elimination |
| 1526 // phase. Note that removing it here would not work because of how | 1526 // phase. Note that removing it here would not work because of how |
| 1527 // the [visitBasicBlock] is implemented. | 1527 // the [visitBasicBlock] is implemented. |
| 1528 } | 1528 } |
| 1529 } | 1529 } |
| OLD | NEW |