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 1071 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1082 /// | 1082 /// |
1083 /// Returns `true` if the node was replaced. | 1083 /// Returns `true` if the node was replaced. |
1084 bool specializeFieldAccess(InvokeMethod node) { | 1084 bool specializeFieldAccess(InvokeMethod node) { |
1085 if (!node.selector.isGetter && !node.selector.isSetter) return false; | 1085 if (!node.selector.isGetter && !node.selector.isSetter) return false; |
1086 AbstractValue receiver = getValue(getDartReceiver(node)); | 1086 AbstractValue receiver = getValue(getDartReceiver(node)); |
1087 Element target = | 1087 Element target = |
1088 typeSystem.locateSingleElement(receiver.type, node.selector); | 1088 typeSystem.locateSingleElement(receiver.type, node.selector); |
1089 if (target is! FieldElement) return false; | 1089 if (target is! FieldElement) return false; |
1090 // TODO(asgerf): Inlining native fields will make some tests pass for the | 1090 // TODO(asgerf): Inlining native fields will make some tests pass for the |
1091 // wrong reason, so for testing reasons avoid inlining them. | 1091 // wrong reason, so for testing reasons avoid inlining them. |
1092 if (target.isNative) return false; | 1092 if (target.isNative || target.isJsInterop) return false; |
1093 Continuation cont = node.continuation.definition; | 1093 Continuation cont = node.continuation.definition; |
1094 if (node.selector.isGetter) { | 1094 if (node.selector.isGetter) { |
1095 GetField get = new GetField(getDartReceiver(node), target); | 1095 GetField get = new GetField(getDartReceiver(node), target); |
1096 LetPrim let = makeLetPrimInvoke(get, cont); | 1096 LetPrim let = makeLetPrimInvoke(get, cont); |
1097 replaceSubtree(node, let); | 1097 replaceSubtree(node, let); |
1098 push(let); | 1098 push(let); |
1099 return true; | 1099 return true; |
1100 } else { | 1100 } else { |
1101 if (target.isFinal) return false; | 1101 if (target.isFinal) return false; |
1102 assert(cont.parameters.single.hasNoUses); | 1102 assert(cont.parameters.single.hasNoUses); |
(...skipping 1908 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3011 processLetPrim(LetPrim node) { | 3011 processLetPrim(LetPrim node) { |
3012 node.primitive.type = null; | 3012 node.primitive.type = null; |
3013 values[node.primitive] = null; | 3013 values[node.primitive] = null; |
3014 } | 3014 } |
3015 | 3015 |
3016 processLetMutable(LetMutable node) { | 3016 processLetMutable(LetMutable node) { |
3017 node.variable.type = null; | 3017 node.variable.type = null; |
3018 values[node.variable] = null; | 3018 values[node.variable] = null; |
3019 } | 3019 } |
3020 } | 3020 } |
OLD | NEW |