OLD | NEW |
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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 library dart2js.cps_ir.type_propagation; | 4 library dart2js.cps_ir.type_propagation; |
5 | 5 |
6 import 'optimizers.dart'; | 6 import 'optimizers.dart'; |
7 | 7 |
8 import '../closure.dart' show | 8 import '../closure.dart' show |
9 ClosureClassElement; | 9 ClosureClassElement; |
10 import '../common.dart'; | 10 import '../common.dart'; |
(...skipping 1700 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1711 | 1711 |
1712 void visitInvokeMethod(InvokeMethod node) { | 1712 void visitInvokeMethod(InvokeMethod node) { |
1713 if (constifyExpression(node)) return; | 1713 if (constifyExpression(node)) return; |
1714 if (specializeOperatorCall(node)) return; | 1714 if (specializeOperatorCall(node)) return; |
1715 if (specializeFieldAccess(node)) return; | 1715 if (specializeFieldAccess(node)) return; |
1716 if (specializeIndexableAccess(node)) return; | 1716 if (specializeIndexableAccess(node)) return; |
1717 if (specializeArrayAccess(node)) return; | 1717 if (specializeArrayAccess(node)) return; |
1718 if (specializeSingleUseClosureCall(node)) return; | 1718 if (specializeSingleUseClosureCall(node)) return; |
1719 if (specializeClosureCall(node)) return; | 1719 if (specializeClosureCall(node)) return; |
1720 | 1720 |
| 1721 node.mask = |
| 1722 typeSystem.intersection(node.mask, getValue(getDartReceiver(node)).type); |
| 1723 |
1721 AbstractValue receiver = getValue(node.receiver.definition); | 1724 AbstractValue receiver = getValue(node.receiver.definition); |
1722 | 1725 |
1723 if (node.receiverIsIntercepted && | 1726 if (node.receiverIsIntercepted && |
1724 node.receiver.definition.sameValue(node.arguments[0].definition)) { | 1727 node.receiver.definition.sameValue(node.arguments[0].definition)) { |
1725 // The receiver and first argument are the same; that means we already | 1728 // The receiver and first argument are the same; that means we already |
1726 // determined in visitInterceptor that we are targeting a non-interceptor. | 1729 // determined in visitInterceptor that we are targeting a non-interceptor. |
1727 | 1730 |
1728 // Check if any of the possible targets depend on the extra receiver | 1731 // Check if any of the possible targets depend on the extra receiver |
1729 // argument. Mixins do this, and tear-offs always needs the extra receiver | 1732 // argument. Mixins do this, and tear-offs always needs the extra receiver |
1730 // argument because BoundClosure uses it for equality and hash code. | 1733 // argument because BoundClosure uses it for equality and hash code. |
(...skipping 1005 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2736 setReachable(cont); | 2739 setReachable(cont); |
2737 setValue(cont.parameters.single, input); | 2740 setValue(cont.parameters.single, input); |
2738 break; | 2741 break; |
2739 | 2742 |
2740 case AbstractBool.False: | 2743 case AbstractBool.False: |
2741 break; // Cast fails. Continuation should remain unreachable. | 2744 break; // Cast fails. Continuation should remain unreachable. |
2742 | 2745 |
2743 case AbstractBool.Maybe: | 2746 case AbstractBool.Maybe: |
2744 setReachable(cont); | 2747 setReachable(cont); |
2745 // Narrow type of output to those that survive the cast. | 2748 // Narrow type of output to those that survive the cast. |
2746 TypeMask type = input.type.intersection( | 2749 TypeMask type = typeSystem.intersection( |
2747 typeSystem.subtypesOf(node.dartType), | 2750 input.type, |
2748 classWorld); | 2751 typeSystem.subtypesOf(node.dartType)); |
2749 setValue(cont.parameters.single, nonConstant(type)); | 2752 setValue(cont.parameters.single, nonConstant(type)); |
2750 break; | 2753 break; |
2751 } | 2754 } |
2752 } | 2755 } |
2753 | 2756 |
2754 void visitSetMutable(SetMutable node) { | 2757 void visitSetMutable(SetMutable node) { |
2755 setValue(node.variable.definition, getValue(node.value.definition)); | 2758 setValue(node.variable.definition, getValue(node.value.definition)); |
2756 } | 2759 } |
2757 | 2760 |
2758 void visitLiteralList(LiteralList node) { | 2761 void visitLiteralList(LiteralList node) { |
(...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3035 processLetPrim(LetPrim node) { | 3038 processLetPrim(LetPrim node) { |
3036 node.primitive.type = null; | 3039 node.primitive.type = null; |
3037 values[node.primitive] = null; | 3040 values[node.primitive] = null; |
3038 } | 3041 } |
3039 | 3042 |
3040 processLetMutable(LetMutable node) { | 3043 processLetMutable(LetMutable node) { |
3041 node.variable.type = null; | 3044 node.variable.type = null; |
3042 values[node.variable] = null; | 3045 values[node.variable] = null; |
3043 } | 3046 } |
3044 } | 3047 } |
OLD | NEW |