| 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'; | |
| 8 import 'cps_ir_nodes.dart'; | |
| 9 import 'loop_hierarchy.dart'; | |
| 10 import 'cps_fragment.dart'; | |
| 11 import '../constants/values.dart'; | 7 import '../constants/values.dart'; |
| 12 import '../elements/elements.dart'; | 8 import '../elements/elements.dart'; |
| 9 import '../io/source_information.dart' show SourceInformation; |
| 13 import '../js_backend/backend_helpers.dart' show BackendHelpers; | 10 import '../js_backend/backend_helpers.dart' show BackendHelpers; |
| 14 import '../js_backend/js_backend.dart' show JavaScriptBackend; | 11 import '../js_backend/js_backend.dart' show JavaScriptBackend; |
| 15 import '../types/types.dart' show TypeMask; | 12 import '../types/types.dart' show TypeMask; |
| 16 import '../io/source_information.dart' show SourceInformation; | |
| 17 import '../world.dart'; | 13 import '../world.dart'; |
| 14 import 'cps_fragment.dart'; |
| 15 import 'cps_ir_nodes.dart'; |
| 16 import 'loop_hierarchy.dart'; |
| 17 import 'optimizers.dart'; |
| 18 import 'type_mask_system.dart'; | 18 import 'type_mask_system.dart'; |
| 19 | 19 |
| 20 /// Replaces `getInterceptor` calls with interceptor constants when possible, | 20 /// Replaces `getInterceptor` calls with interceptor constants when possible, |
| 21 /// or with "almost constant" expressions like "x && CONST" when the input | 21 /// or with "almost constant" expressions like "x && CONST" when the input |
| 22 /// is either null or has a known interceptor. | 22 /// is either null or has a known interceptor. |
| 23 /// | 23 /// |
| 24 /// Narrows the set of intercepted classes for interceptor calls. | 24 /// Narrows the set of intercepted classes for interceptor calls. |
| 25 /// | 25 /// |
| 26 /// Replaces calls on interceptors with one-shot interceptors. | 26 /// Replaces calls on interceptors with one-shot interceptors. |
| 27 class OptimizeInterceptors extends TrampolineRecursiveVisitor implements Pass { | 27 class OptimizeInterceptors extends TrampolineRecursiveVisitor implements Pass { |
| (...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 318 sharedConstantFor.remove(prim.value); | 318 sharedConstantFor.remove(prim.value); |
| 319 }); | 319 }); |
| 320 } | 320 } |
| 321 return next; | 321 return next; |
| 322 } | 322 } |
| 323 | 323 |
| 324 bool shouldShareConstant(Constant constant) { | 324 bool shouldShareConstant(Constant constant) { |
| 325 return constant.value.isInterceptor; | 325 return constant.value.isInterceptor; |
| 326 } | 326 } |
| 327 } | 327 } |
| OLD | NEW |