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 648 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
659 return graph.addConstant(constantSystem.createString(folded, node.node)); | 659 return graph.addConstant(constantSystem.createString(folded, node.node)); |
660 } | 660 } |
661 | 661 |
662 HInstruction visitInterceptor(HInterceptor node) { | 662 HInstruction visitInterceptor(HInterceptor node) { |
663 if (node.isConstant()) return node; | 663 if (node.isConstant()) return node; |
664 // If the intercepted object does not need to be intercepted, just | 664 // If the intercepted object does not need to be intercepted, just |
665 // return the object (the [:getInterceptor:] method would have | 665 // return the object (the [:getInterceptor:] method would have |
666 // returned the object). | 666 // returned the object). |
667 HType type = node.receiver.instructionType; | 667 HType type = node.receiver.instructionType; |
668 if (!type.canBePrimitive(compiler)) { | 668 if (!type.canBePrimitive(compiler)) { |
669 print('IN HERE BECAUSE OF $type'); | |
670 if (!(type.canBeNull() | 669 if (!(type.canBeNull() |
671 && node.interceptedClasses.contains(compiler.objectClass))) { | 670 && node.interceptedClasses.contains(compiler.objectClass))) { |
672 return node.receiver; | 671 return node.receiver; |
673 } | 672 } |
674 } | 673 } |
675 HInstruction constant = tryComputeConstantInterceptor( | 674 HInstruction constant = tryComputeConstantInterceptor( |
676 node.inputs[0], node.interceptedClasses); | 675 node.inputs[0], node.interceptedClasses); |
677 if (constant == null) return node; | 676 if (constant == null) return node; |
678 | 677 |
679 return constant; | 678 return constant; |
(...skipping 849 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1529 HBasicBlock block = user.block; | 1528 HBasicBlock block = user.block; |
1530 block.addAfter(user, interceptor); | 1529 block.addAfter(user, interceptor); |
1531 block.rewrite(user, interceptor); | 1530 block.rewrite(user, interceptor); |
1532 block.remove(user); | 1531 block.remove(user); |
1533 | 1532 |
1534 // The interceptor will be removed in the dead code elimination | 1533 // The interceptor will be removed in the dead code elimination |
1535 // phase. Note that removing it here would not work because of how | 1534 // phase. Note that removing it here would not work because of how |
1536 // the [visitBasicBlock] is implemented. | 1535 // the [visitBasicBlock] is implemented. |
1537 } | 1536 } |
1538 } | 1537 } |
OLD | NEW |