| OLD | NEW |
| 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, 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 library dart2js.cps_ir.optimize_interceptors; | 5 library dart2js.cps_ir.optimize_interceptors; |
| 6 | 6 |
| 7 import '../constants/values.dart'; | 7 import '../constants/values.dart'; |
| 8 import '../elements/elements.dart'; | 8 import '../elements/elements.dart'; |
| 9 import '../io/source_information.dart' show SourceInformation; | 9 import '../io/source_information.dart' show SourceInformation; |
| 10 import '../js_backend/backend_helpers.dart' show BackendHelpers; | 10 import '../js_backend/backend_helpers.dart' show BackendHelpers; |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 103 intercepted.clear(); | 103 intercepted.clear(); |
| 104 for (Reference ref = interceptor.firstRef; ref != null; ref = ref.next) { | 104 for (Reference ref = interceptor.firstRef; ref != null; ref = ref.next) { |
| 105 Node use = ref.parent; | 105 Node use = ref.parent; |
| 106 if (use is InvokeMethod) { | 106 if (use is InvokeMethod) { |
| 107 TypeMask type = use.receiver.type; | 107 TypeMask type = use.receiver.type; |
| 108 bool canOccurAsReceiver(ClassElement elem) { | 108 bool canOccurAsReceiver(ClassElement elem) { |
| 109 return classWorld.isInstantiated(elem) && | 109 return classWorld.isInstantiated(elem) && |
| 110 !typeSystem.areDisjoint( | 110 !typeSystem.areDisjoint( |
| 111 type, typeSystem.getInterceptorSubtypes(elem)); | 111 type, typeSystem.getInterceptorSubtypes(elem)); |
| 112 } | 112 } |
| 113 |
| 113 Iterable<ClassElement> classes = | 114 Iterable<ClassElement> classes = |
| 114 backend.getInterceptedClassesOn(use.selector.name); | 115 backend.getInterceptedClassesOn(use.selector.name); |
| 115 intercepted.addAll(classes.where(canOccurAsReceiver)); | 116 intercepted.addAll(classes.where(canOccurAsReceiver)); |
| 116 } else { | 117 } else { |
| 117 intercepted.clear(); | 118 intercepted.clear(); |
| 118 intercepted.add(backend.helpers.jsInterceptorClass); | 119 intercepted.add(backend.helpers.jsInterceptorClass); |
| 119 break; | 120 break; |
| 120 } | 121 } |
| 121 } | 122 } |
| 122 if (intercepted.contains(backend.helpers.jsInterceptorClass) || | 123 if (intercepted.contains(backend.helpers.jsInterceptorClass) || |
| (...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 318 sharedConstantFor.remove(prim.value); | 319 sharedConstantFor.remove(prim.value); |
| 319 }); | 320 }); |
| 320 } | 321 } |
| 321 return next; | 322 return next; |
| 322 } | 323 } |
| 323 | 324 |
| 324 bool shouldShareConstant(Constant constant) { | 325 bool shouldShareConstant(Constant constant) { |
| 325 return constant.value.isInterceptor; | 326 return constant.value.isInterceptor; |
| 326 } | 327 } |
| 327 } | 328 } |
| OLD | NEW |