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 | 4 |
5 import 'optimizers.dart'; | 5 import 'optimizers.dart'; |
6 | 6 |
| 7 import '../compiler.dart' as dart2js show |
| 8 Compiler; |
7 import '../constants/constant_system.dart'; | 9 import '../constants/constant_system.dart'; |
8 import '../resolution/operators.dart'; | |
9 import '../constants/values.dart'; | 10 import '../constants/values.dart'; |
10 import '../dart_types.dart' as types; | 11 import '../dart_types.dart' as types; |
11 import '../dart2jslib.dart' as dart2js; | 12 import '../diagnostics/invariant.dart' as dart2js show |
| 13 InternalErrorFunction; |
| 14 import '../elements/elements.dart'; |
| 15 import '../io/source_information.dart' show SourceInformation; |
| 16 import '../js_backend/js_backend.dart' show JavaScriptBackend; |
| 17 import '../resolution/operators.dart'; |
12 import '../tree/tree.dart' show DartString, ConsDartString, LiteralDartString; | 18 import '../tree/tree.dart' show DartString, ConsDartString, LiteralDartString; |
13 import 'cps_ir_nodes.dart'; | |
14 import '../types/types.dart'; | 19 import '../types/types.dart'; |
15 import '../types/constants.dart' show computeTypeMask; | 20 import '../types/constants.dart' show computeTypeMask; |
16 import '../elements/elements.dart'; | |
17 import '../universe/universe.dart'; | 21 import '../universe/universe.dart'; |
18 import '../js_backend/js_backend.dart' show JavaScriptBackend; | |
19 import '../io/source_information.dart' show SourceInformation; | |
20 import '../world.dart' show World; | 22 import '../world.dart' show World; |
21 import 'cps_fragment.dart'; | 23 import 'cps_fragment.dart'; |
| 24 import 'cps_ir_nodes.dart'; |
22 | 25 |
23 enum AbstractBool { | 26 enum AbstractBool { |
24 True, False, Maybe, Nothing | 27 True, False, Maybe, Nothing |
25 } | 28 } |
26 | 29 |
27 class TypeMaskSystem { | 30 class TypeMaskSystem { |
28 final TypesTask inferrer; | 31 final TypesTask inferrer; |
29 final World classWorld; | 32 final World classWorld; |
30 final JavaScriptBackend backend; | 33 final JavaScriptBackend backend; |
31 | 34 |
(...skipping 848 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
880 // We do not introduce shift-right operators yet because the operator | 883 // We do not introduce shift-right operators yet because the operator |
881 // to use depends on whether the left-hand operand is negative. | 884 // to use depends on whether the left-hand operand is negative. |
882 // See js_number.dart in js_runtime for details. | 885 // See js_number.dart in js_runtime for details. |
883 PrimitiveConstantValue rightConstant = right.constant; | 886 PrimitiveConstantValue rightConstant = right.constant; |
884 if (opname == '<<' && | 887 if (opname == '<<' && |
885 lattice.isDefinitelyInt(left) && | 888 lattice.isDefinitelyInt(left) && |
886 rightConstant != null && | 889 rightConstant != null && |
887 rightConstant.isInt && | 890 rightConstant.isInt && |
888 rightConstant.primitiveValue >= 0 && | 891 rightConstant.primitiveValue >= 0 && |
889 rightConstant.primitiveValue <= 31) { | 892 rightConstant.primitiveValue <= 31) { |
890 return replaceWithBinary(BuiltinOperator.NumShl, | 893 return replaceWithBinary(BuiltinOperator.NumShl, |
891 leftArg, rightArg); | 894 leftArg, rightArg); |
892 } | 895 } |
893 } | 896 } |
894 if (lattice.isDefinitelyString(left, allowNull: false) && | 897 if (lattice.isDefinitelyString(left, allowNull: false) && |
895 lattice.isDefinitelyString(right, allowNull: false) && | 898 lattice.isDefinitelyString(right, allowNull: false) && |
896 opname == '+') { | 899 opname == '+') { |
897 return replaceWithBinary(BuiltinOperator.StringConcatenate, | 900 return replaceWithBinary(BuiltinOperator.StringConcatenate, |
898 leftArg, rightArg); | 901 leftArg, rightArg); |
899 } | 902 } |
900 } | 903 } |
(...skipping 1466 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2367 } | 2370 } |
2368 | 2371 |
2369 processLetPrim(LetPrim node) { | 2372 processLetPrim(LetPrim node) { |
2370 values.remove(node.primitive); | 2373 values.remove(node.primitive); |
2371 } | 2374 } |
2372 | 2375 |
2373 processLetMutable(LetMutable node) { | 2376 processLetMutable(LetMutable node) { |
2374 values.remove(node.variable); | 2377 values.remove(node.variable); |
2375 } | 2378 } |
2376 } | 2379 } |
OLD | NEW |