| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 '../common/codegen.dart' show CodegenRegistry, CodegenWorkItem; | 5 import '../common/codegen.dart' show CodegenRegistry, CodegenWorkItem; |
| 6 import '../common/names.dart' show Selectors; | 6 import '../common/names.dart' show Selectors; |
| 7 import '../common/tasks.dart' show CompilerTask; | 7 import '../common/tasks.dart' show CompilerTask; |
| 8 import '../compiler.dart' show Compiler; | 8 import '../compiler.dart' show Compiler; |
| 9 import '../constants/constant_system.dart'; | 9 import '../constants/constant_system.dart'; |
| 10 import '../constants/values.dart'; | 10 import '../constants/values.dart'; |
| (...skipping 934 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 945 if (other != value) { | 945 if (other != value) { |
| 946 node.block.addBefore(node, other); | 946 node.block.addBefore(node, other); |
| 947 value = other; | 947 value = other; |
| 948 } | 948 } |
| 949 } | 949 } |
| 950 return new HFieldSet(field, receiver, value); | 950 return new HFieldSet(field, receiver, value); |
| 951 } | 951 } |
| 952 | 952 |
| 953 HInstruction visitInvokeStatic(HInvokeStatic node) { | 953 HInstruction visitInvokeStatic(HInvokeStatic node) { |
| 954 propagateConstantValueToUses(node); | 954 propagateConstantValueToUses(node); |
| 955 if (node.element == backend.helpers.checkConcurrentModificationError) { | 955 Element element = node.element; |
| 956 |
| 957 if (element == backend.helpers.checkConcurrentModificationError) { |
| 956 if (node.inputs.length == 2) { | 958 if (node.inputs.length == 2) { |
| 957 HInstruction firstArgument = node.inputs[0]; | 959 HInstruction firstArgument = node.inputs[0]; |
| 958 if (firstArgument is HConstant) { | 960 if (firstArgument is HConstant) { |
| 959 HConstant constant = firstArgument; | 961 HConstant constant = firstArgument; |
| 960 if (constant.constant.isTrue) return constant; | 962 if (constant.constant.isTrue) return constant; |
| 961 } | 963 } |
| 962 } | 964 } |
| 965 } else if (element == backend.helpers.checkInt) { |
| 966 if (node.inputs.length == 1) { |
| 967 HInstruction argument = node.inputs[0]; |
| 968 if (argument.isInteger(compiler)) return argument; |
| 969 } |
| 970 } else if (element == backend.helpers.checkNum) { |
| 971 if (node.inputs.length == 1) { |
| 972 HInstruction argument = node.inputs[0]; |
| 973 if (argument.isNumber(compiler)) return argument; |
| 974 } |
| 975 } else if (element == backend.helpers.checkString) { |
| 976 if (node.inputs.length == 1) { |
| 977 HInstruction argument = node.inputs[0]; |
| 978 if (argument.isString(compiler)) return argument; |
| 979 } |
| 963 } | 980 } |
| 964 return node; | 981 return node; |
| 965 } | 982 } |
| 966 | 983 |
| 967 HInstruction visitStringConcat(HStringConcat node) { | 984 HInstruction visitStringConcat(HStringConcat node) { |
| 968 // Simplify string concat: | 985 // Simplify string concat: |
| 969 // | 986 // |
| 970 // "" + R -> R | 987 // "" + R -> R |
| 971 // L + "" -> L | 988 // L + "" -> L |
| 972 // "L" + "R" -> "LR" | 989 // "L" + "R" -> "LR" |
| (...skipping 1704 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2677 | 2694 |
| 2678 keyedValues.forEach((receiver, values) { | 2695 keyedValues.forEach((receiver, values) { |
| 2679 result.keyedValues[receiver] = | 2696 result.keyedValues[receiver] = |
| 2680 new Map<HInstruction, HInstruction>.from(values); | 2697 new Map<HInstruction, HInstruction>.from(values); |
| 2681 }); | 2698 }); |
| 2682 | 2699 |
| 2683 result.nonEscapingReceivers.addAll(nonEscapingReceivers); | 2700 result.nonEscapingReceivers.addAll(nonEscapingReceivers); |
| 2684 return result; | 2701 return result; |
| 2685 } | 2702 } |
| 2686 } | 2703 } |
| OLD | NEW |