| 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 part of ssa; | 5 part of ssa; |
| 6 | 6 |
| 7 abstract class OptimizationPhase { | 7 abstract class OptimizationPhase { |
| 8 String get name; | 8 String get name; |
| 9 void visitGraph(HGraph graph); | 9 void visitGraph(HGraph graph); |
| 10 } | 10 } |
| (...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 257 HConstant constantInput = actualReceiver; | 257 HConstant constantInput = actualReceiver; |
| 258 StringConstantValue constant = constantInput.constant; | 258 StringConstantValue constant = constantInput.constant; |
| 259 return graph.addConstantInt(constant.length, compiler); | 259 return graph.addConstantInt(constant.length, compiler); |
| 260 } else if (actualReceiver.isConstantList()) { | 260 } else if (actualReceiver.isConstantList()) { |
| 261 HConstant constantInput = actualReceiver; | 261 HConstant constantInput = actualReceiver; |
| 262 ListConstantValue constant = constantInput.constant; | 262 ListConstantValue constant = constantInput.constant; |
| 263 return graph.addConstantInt(constant.length, compiler); | 263 return graph.addConstantInt(constant.length, compiler); |
| 264 } | 264 } |
| 265 Element element = backend.jsIndexableLength; | 265 Element element = backend.jsIndexableLength; |
| 266 bool isFixed = isFixedLength(actualReceiver.instructionType, compiler); | 266 bool isFixed = isFixedLength(actualReceiver.instructionType, compiler); |
| 267 TypeMask actualType = node.instructionType; |
| 268 ClassWorld classWorld = compiler.world; |
| 269 TypeMask resultType = backend.positiveIntType; |
| 270 // If we already have computed a more specific type, keep that type. |
| 271 if (actualType.satisfies(backend.jsUInt31Class, classWorld)) { |
| 272 resultType = backend.uint31Type; |
| 273 } else if (actualType.satisfies(backend.jsUInt32Class, classWorld)) { |
| 274 resultType = backend.uint32Type; |
| 275 } |
| 267 HFieldGet result = new HFieldGet( | 276 HFieldGet result = new HFieldGet( |
| 268 element, actualReceiver, backend.positiveIntType, | 277 element, actualReceiver, resultType, |
| 269 isAssignable: !isFixed); | 278 isAssignable: !isFixed); |
| 270 return result; | 279 return result; |
| 271 } else if (actualReceiver.isConstantMap()) { | 280 } else if (actualReceiver.isConstantMap()) { |
| 272 HConstant constantInput = actualReceiver; | 281 HConstant constantInput = actualReceiver; |
| 273 MapConstantValue constant = constantInput.constant; | 282 MapConstantValue constant = constantInput.constant; |
| 274 return graph.addConstantInt(constant.length, compiler); | 283 return graph.addConstantInt(constant.length, compiler); |
| 275 } | 284 } |
| 276 return null; | 285 return null; |
| 277 } | 286 } |
| 278 | 287 |
| (...skipping 2007 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2286 | 2295 |
| 2287 keyedValues.forEach((receiver, values) { | 2296 keyedValues.forEach((receiver, values) { |
| 2288 result.keyedValues[receiver] = | 2297 result.keyedValues[receiver] = |
| 2289 new Map<HInstruction, HInstruction>.from(values); | 2298 new Map<HInstruction, HInstruction>.from(values); |
| 2290 }); | 2299 }); |
| 2291 | 2300 |
| 2292 result.nonEscapingReceivers.addAll(nonEscapingReceivers); | 2301 result.nonEscapingReceivers.addAll(nonEscapingReceivers); |
| 2293 return result; | 2302 return result; |
| 2294 } | 2303 } |
| 2295 } | 2304 } |
| OLD | NEW |