| 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 class Interceptors { | 5 class Interceptors { |
| 6 Compiler compiler; | 6 Compiler compiler; |
| 7 Interceptors(Compiler this.compiler); | 7 Interceptors(Compiler this.compiler); |
| 8 | 8 |
| 9 SourceString mapOperatorToMethodName(Operator op) { | 9 SourceString mapOperatorToMethodName(Operator op) { |
| 10 String name = op.source.stringValue; | 10 String name = op.source.stringValue; |
| (...skipping 1030 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1041 Element sourceElement) { | 1041 Element sourceElement) { |
| 1042 if (!compiler.enableTypeAssertions) return original; | 1042 if (!compiler.enableTypeAssertions) return original; |
| 1043 | 1043 |
| 1044 Type type = sourceElement.computeType(compiler); | 1044 Type type = sourceElement.computeType(compiler); |
| 1045 if (type === null) return original; | 1045 if (type === null) return original; |
| 1046 if (type.element === compiler.dynamicClass) return original; | 1046 if (type.element === compiler.dynamicClass) return original; |
| 1047 if (type.element === compiler.objectClass) return original; | 1047 if (type.element === compiler.objectClass) return original; |
| 1048 | 1048 |
| 1049 HType convertedType = new HType.fromBoundedType(type, compiler, true); | 1049 HType convertedType = new HType.fromBoundedType(type, compiler, true); |
| 1050 | 1050 |
| 1051 // TODO(ngeoffray): the factory method should never return null. | |
| 1052 if (convertedType === null) { | |
| 1053 return original; | |
| 1054 } | |
| 1055 | |
| 1056 // No need to convert if we know the instruction has | 1051 // No need to convert if we know the instruction has |
| 1057 // [convertedType] as a bound. | 1052 // [convertedType] as a bound. |
| 1058 if (original.guaranteedType == convertedType) { | 1053 if (original.guaranteedType == convertedType) { |
| 1059 return original; | 1054 return original; |
| 1060 } | 1055 } |
| 1061 | 1056 |
| 1062 HInstruction instruction = | 1057 HInstruction instruction = |
| 1063 new HTypeConversion(convertedType, original, true); | 1058 new HTypeConversion(convertedType, original, true); |
| 1064 add(instruction); | 1059 add(instruction); |
| 1065 return instruction; | 1060 return instruction; |
| (...skipping 2254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3320 <HInstruction>[target, input], | 3315 <HInstruction>[target, input], |
| 3321 HType.STRING)); | 3316 HType.STRING)); |
| 3322 return builder.pop(); | 3317 return builder.pop(); |
| 3323 } | 3318 } |
| 3324 | 3319 |
| 3325 HInstruction result() { | 3320 HInstruction result() { |
| 3326 flushLiterals(); | 3321 flushLiterals(); |
| 3327 return prefix; | 3322 return prefix; |
| 3328 } | 3323 } |
| 3329 } | 3324 } |
| OLD | NEW |