| 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 'optimizers.dart'; | 7 import 'optimizers.dart'; |
| 8 import 'cps_ir_nodes.dart'; | 8 import 'cps_ir_nodes.dart'; |
| 9 import 'loop_hierarchy.dart'; | 9 import 'loop_hierarchy.dart'; |
| 10 import 'cps_fragment.dart'; | 10 import 'cps_fragment.dart'; |
| 11 import '../constants/values.dart'; | 11 import '../constants/values.dart'; |
| 12 import '../elements/elements.dart'; | 12 import '../elements/elements.dart'; |
| 13 import '../js_backend/backend_helpers.dart' show BackendHelpers; | 13 import '../js_backend/backend_helpers.dart' show BackendHelpers; |
| 14 import '../js_backend/js_backend.dart' show JavaScriptBackend; | 14 import '../js_backend/js_backend.dart' show JavaScriptBackend; |
| 15 import '../types/types.dart' show TypeMask; | 15 import '../types/types.dart' show TypeMask; |
| 16 import '../io/source_information.dart' show SourceInformation; | 16 import '../io/source_information.dart' show SourceInformation; |
| 17 import '../universe/selector.dart'; | |
| 18 | 17 |
| 19 /// Replaces `getInterceptor` calls with interceptor constants when possible, | 18 /// Replaces `getInterceptor` calls with interceptor constants when possible, |
| 20 /// or with "almost constant" expressions like "x && CONST" when the input | 19 /// or with "almost constant" expressions like "x && CONST" when the input |
| 21 /// is either null or has a known interceptor. | 20 /// is either null or has a known interceptor. |
| 22 // | 21 // |
| 23 // TODO(asgerf): Compute intercepted classes in this pass. | 22 // TODO(asgerf): Compute intercepted classes in this pass. |
| 24 class OptimizeInterceptors extends TrampolineRecursiveVisitor implements Pass { | 23 class OptimizeInterceptors extends TrampolineRecursiveVisitor implements Pass { |
| 25 String get passName => 'Optimize interceptors'; | 24 String get passName => 'Optimize interceptors'; |
| 26 | 25 |
| 27 JavaScriptBackend backend; | 26 JavaScriptBackend backend; |
| (...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 220 sharedConstantFor.remove(prim.value); | 219 sharedConstantFor.remove(prim.value); |
| 221 }); | 220 }); |
| 222 } | 221 } |
| 223 return next; | 222 return next; |
| 224 } | 223 } |
| 225 | 224 |
| 226 bool shouldShareConstant(Constant constant) { | 225 bool shouldShareConstant(Constant constant) { |
| 227 return constant.value.isInterceptor; | 226 return constant.value.isInterceptor; |
| 228 } | 227 } |
| 229 } | 228 } |
| OLD | NEW |