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 '../closure.dart'; | 5 import '../closure.dart'; |
6 import '../common.dart'; | 6 import '../common.dart'; |
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 '../dart_types.dart'; | 10 import '../dart_types.dart'; |
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
191 HBasicBlock result = addNewBlock(); | 191 HBasicBlock result = addNewBlock(); |
192 result.loopInformation = new HLoopInformation(result, target, labels); | 192 result.loopInformation = new HLoopInformation(result, target, labels); |
193 return result; | 193 return result; |
194 } | 194 } |
195 | 195 |
196 HConstant addConstant(ConstantValue constant, Compiler compiler, | 196 HConstant addConstant(ConstantValue constant, Compiler compiler, |
197 {SourceInformation sourceInformation}) { | 197 {SourceInformation sourceInformation}) { |
198 HConstant result = constants[constant]; | 198 HConstant result = constants[constant]; |
199 // TODO(johnniwinther): Support source information per constant reference. | 199 // TODO(johnniwinther): Support source information per constant reference. |
200 if (result == null) { | 200 if (result == null) { |
| 201 if (!constant.isConstant) { |
| 202 // We use `null` as the value for invalid constant expressions. |
| 203 constant = const NullConstantValue(); |
| 204 } |
201 TypeMask type = computeTypeMask(compiler, constant); | 205 TypeMask type = computeTypeMask(compiler, constant); |
202 result = new HConstant.internal(constant, type) | 206 result = new HConstant.internal(constant, type) |
203 ..sourceInformation = sourceInformation; | 207 ..sourceInformation = sourceInformation; |
204 entry.addAtExit(result); | 208 entry.addAtExit(result); |
205 constants[constant] = result; | 209 constants[constant] = result; |
206 } else if (result.block == null) { | 210 } else if (result.block == null) { |
207 // The constant was not used anymore. | 211 // The constant was not used anymore. |
208 entry.addAtExit(result); | 212 entry.addAtExit(result); |
209 } | 213 } |
210 return result; | 214 return result; |
(...skipping 3061 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3272 class HDynamicType extends HRuntimeType { | 3276 class HDynamicType extends HRuntimeType { |
3273 HDynamicType(DynamicType dartType, TypeMask instructionType) | 3277 HDynamicType(DynamicType dartType, TypeMask instructionType) |
3274 : super(const <HInstruction>[], dartType, instructionType); | 3278 : super(const <HInstruction>[], dartType, instructionType); |
3275 | 3279 |
3276 accept(HVisitor visitor) => visitor.visitDynamicType(this); | 3280 accept(HVisitor visitor) => visitor.visitDynamicType(this); |
3277 | 3281 |
3278 int typeCode() => HInstruction.DYNAMIC_TYPE_TYPECODE; | 3282 int typeCode() => HInstruction.DYNAMIC_TYPE_TYPECODE; |
3279 | 3283 |
3280 bool typeEquals(HInstruction other) => other is HDynamicType; | 3284 bool typeEquals(HInstruction other) => other is HDynamicType; |
3281 } | 3285 } |
OLD | NEW |