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 797 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
808 return false; | 808 return false; |
809 } | 809 } |
810 | 810 |
811 // [interceptedClasses] is sparse - it is just the classes that define some | 811 // [interceptedClasses] is sparse - it is just the classes that define some |
812 // intercepted method. Their subclasses (that inherit the method) are | 812 // intercepted method. Their subclasses (that inherit the method) are |
813 // implicit, so we have to extend them. | 813 // implicit, so we have to extend them. |
814 | 814 |
815 TypeMask receiverMask = receiverType.computeMask(compiler); | 815 TypeMask receiverMask = receiverType.computeMask(compiler); |
816 return interceptedClasses | 816 return interceptedClasses |
817 .where((cls) => cls != compiler.objectClass) | 817 .where((cls) => cls != compiler.objectClass) |
818 .map((cls) => new TypeMask.subclass(cls.rawType)) | 818 .map((cls) => backend.classesMixedIntoNativeClasses.contains(cls) |
| 819 ? new TypeMask.subtype(cls.rawType) |
| 820 : new TypeMask.subclass(cls.rawType)) |
819 .every((mask) => receiverMask.intersection(mask, compiler).isEmpty); | 821 .every((mask) => receiverMask.intersection(mask, compiler).isEmpty); |
820 } | 822 } |
821 | 823 |
822 HInstruction tryComputeConstantInterceptor(HInstruction input, | 824 HInstruction tryComputeConstantInterceptor(HInstruction input, |
823 Set<ClassElement> intercepted) { | 825 Set<ClassElement> intercepted) { |
824 if (input == graph.explicitReceiverParameter) { | 826 if (input == graph.explicitReceiverParameter) { |
825 // If `explicitReceiverParameter` is set it means the current method is an | 827 // If `explicitReceiverParameter` is set it means the current method is an |
826 // interceptor method, and `this` is the interceptor. The caller just did | 828 // interceptor method, and `this` is the interceptor. The caller just did |
827 // `getInterceptor(foo).currentMethod(foo)` to enter the current method. | 829 // `getInterceptor(foo).currentMethod(foo)` to enter the current method. |
828 return graph.thisInstruction; | 830 return graph.thisInstruction; |
(...skipping 857 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1686 HBasicBlock block = user.block; | 1688 HBasicBlock block = user.block; |
1687 block.addAfter(user, interceptor); | 1689 block.addAfter(user, interceptor); |
1688 block.rewrite(user, interceptor); | 1690 block.rewrite(user, interceptor); |
1689 block.remove(user); | 1691 block.remove(user); |
1690 | 1692 |
1691 // The interceptor will be removed in the dead code elimination | 1693 // The interceptor will be removed in the dead code elimination |
1692 // phase. Note that removing it here would not work because of how | 1694 // phase. Note that removing it here would not work because of how |
1693 // the [visitBasicBlock] is implemented. | 1695 // the [visitBasicBlock] is implemented. |
1694 } | 1696 } |
1695 } | 1697 } |
OLD | NEW |