| 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 CodegenWorkItem; | 5 import '../common/codegen.dart' show CodegenWorkItem; | 
| 6 import '../common/tasks.dart' show CompilerTask; | 6 import '../common/tasks.dart' show CompilerTask; | 
| 7 import '../compiler.dart' show Compiler; | 7 import '../compiler.dart' show Compiler; | 
| 8 import '../constants/constant_system.dart'; | 8 import '../constants/constant_system.dart'; | 
| 9 import '../constants/values.dart'; | 9 import '../constants/values.dart'; | 
| 10 import '../core_types.dart' show CoreClasses; | 10 import '../core_types.dart' show CoreClasses; | 
| (...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 240     ConstantValue value = getConstantFromType(node); | 240     ConstantValue value = getConstantFromType(node); | 
| 241     if (value != null) { | 241     if (value != null) { | 
| 242       HConstant constant = graph.addConstant(value, compiler); | 242       HConstant constant = graph.addConstant(value, compiler); | 
| 243       for (HInstruction user in node.usedBy.toList()) { | 243       for (HInstruction user in node.usedBy.toList()) { | 
| 244         user.changeUse(node, constant); | 244         user.changeUse(node, constant); | 
| 245       } | 245       } | 
| 246     } | 246     } | 
| 247   } | 247   } | 
| 248 | 248 | 
| 249   HInstruction visitParameterValue(HParameterValue node) { | 249   HInstruction visitParameterValue(HParameterValue node) { | 
| 250     // It is possible for the parameter value to be assigned to in the function | 250     // If the parameter is used as a mutable variable we cannot replace the | 
| 251     // body. If that happens then we should not forward the constant value to | 251     // variable with a value. | 
| 252     // its uses since since the uses reachable from the assignment may have | 252     if (node.usedAsVariable()) return node; | 
| 253     // values in addition to the constant passed to the function. |  | 
| 254     if (node.usedBy |  | 
| 255         .any((user) => user is HLocalSet && identical(user.local, node))) { |  | 
| 256       return node; |  | 
| 257     } |  | 
| 258     propagateConstantValueToUses(node); | 253     propagateConstantValueToUses(node); | 
| 259     return node; | 254     return node; | 
| 260   } | 255   } | 
| 261 | 256 | 
| 262   HInstruction visitBoolify(HBoolify node) { | 257   HInstruction visitBoolify(HBoolify node) { | 
| 263     List<HInstruction> inputs = node.inputs; | 258     List<HInstruction> inputs = node.inputs; | 
| 264     assert(inputs.length == 1); | 259     assert(inputs.length == 1); | 
| 265     HInstruction input = inputs[0]; | 260     HInstruction input = inputs[0]; | 
| 266     if (input.isBoolean(compiler)) return input; | 261     if (input.isBoolean(compiler)) return input; | 
| 267 | 262 | 
| (...skipping 2116 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 2384 | 2379 | 
| 2385     keyedValues.forEach((receiver, values) { | 2380     keyedValues.forEach((receiver, values) { | 
| 2386       result.keyedValues[receiver] = | 2381       result.keyedValues[receiver] = | 
| 2387           new Map<HInstruction, HInstruction>.from(values); | 2382           new Map<HInstruction, HInstruction>.from(values); | 
| 2388     }); | 2383     }); | 
| 2389 | 2384 | 
| 2390     result.nonEscapingReceivers.addAll(nonEscapingReceivers); | 2385     result.nonEscapingReceivers.addAll(nonEscapingReceivers); | 
| 2391     return result; | 2386     return result; | 
| 2392   } | 2387   } | 
| 2393 } | 2388 } | 
| OLD | NEW | 
|---|