| 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 683 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 694 constantInterceptor = backend.jsBoolClass; | 694 constantInterceptor = backend.jsBoolClass; |
| 695 } else if (type.isString()) { | 695 } else if (type.isString()) { |
| 696 constantInterceptor = backend.jsStringClass; | 696 constantInterceptor = backend.jsStringClass; |
| 697 } else if (type.isArray()) { | 697 } else if (type.isArray()) { |
| 698 constantInterceptor = backend.jsArrayClass; | 698 constantInterceptor = backend.jsArrayClass; |
| 699 } else if (type.isNull()) { | 699 } else if (type.isNull()) { |
| 700 constantInterceptor = backend.jsNullClass; | 700 constantInterceptor = backend.jsNullClass; |
| 701 } else if (type.isNumber()) { | 701 } else if (type.isNumber()) { |
| 702 // If the method being intercepted is not defined in [int] or | 702 // If the method being intercepted is not defined in [int] or |
| 703 // [double] we can safely use the number interceptor. | 703 // [double] we can safely use the number interceptor. |
| 704 if (!intercepted.contains(compiler.intClass) | 704 if (!intercepted.contains(backend.jsIntClass) |
| 705 && !intercepted.contains(compiler.doubleClass)) { | 705 && !intercepted.contains(backend.jsDoubleClass)) { |
| 706 constantInterceptor = backend.jsNumberClass; | 706 constantInterceptor = backend.jsNumberClass; |
| 707 } | 707 } |
| 708 } | 708 } |
| 709 | 709 |
| 710 if (constantInterceptor == null) return null; | 710 if (constantInterceptor == null) return null; |
| 711 if (constantInterceptor == work.element.getEnclosingClass()) { | 711 if (constantInterceptor == work.element.getEnclosingClass()) { |
| 712 return graph.thisInstruction; | 712 return graph.thisInstruction; |
| 713 } | 713 } |
| 714 | 714 |
| 715 Constant constant = new InterceptorConstant( | 715 Constant constant = new InterceptorConstant( |
| (...skipping 816 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1532 HBasicBlock block = user.block; | 1532 HBasicBlock block = user.block; |
| 1533 block.addAfter(user, interceptor); | 1533 block.addAfter(user, interceptor); |
| 1534 block.rewrite(user, interceptor); | 1534 block.rewrite(user, interceptor); |
| 1535 block.remove(user); | 1535 block.remove(user); |
| 1536 | 1536 |
| 1537 // The interceptor will be removed in the dead code elimination | 1537 // The interceptor will be removed in the dead code elimination |
| 1538 // phase. Note that removing it here would not work because of how | 1538 // phase. Note that removing it here would not work because of how |
| 1539 // the [visitBasicBlock] is implemented. | 1539 // the [visitBasicBlock] is implemented. |
| 1540 } | 1540 } |
| 1541 } | 1541 } |
| OLD | NEW |