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 HVisitor<R> { | 7 abstract class HVisitor<R> { |
8 R visitAdd(HAdd node); | 8 R visitAdd(HAdd node); |
9 R visitAwait(HAwait node); | 9 R visitAwait(HAwait node); |
10 R visitBitAnd(HBitAnd node); | 10 R visitBitAnd(HBitAnd node); |
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
167 HBasicBlock addNewLoopHeaderBlock(JumpTarget target, | 167 HBasicBlock addNewLoopHeaderBlock(JumpTarget target, |
168 List<LabelDefinition> labels) { | 168 List<LabelDefinition> labels) { |
169 HBasicBlock result = addNewBlock(); | 169 HBasicBlock result = addNewBlock(); |
170 result.loopInformation = | 170 result.loopInformation = |
171 new HLoopInformation(result, target, labels); | 171 new HLoopInformation(result, target, labels); |
172 return result; | 172 return result; |
173 } | 173 } |
174 | 174 |
175 HConstant addConstant(ConstantValue constant, Compiler compiler, | 175 HConstant addConstant(ConstantValue constant, Compiler compiler, |
176 {SourceInformation sourceInformation}) { | 176 {SourceInformation sourceInformation}) { |
| 177 if (!constant.isConstant) { |
| 178 constant = compiler.backend.constantSystem.createNull(); |
| 179 } |
177 HConstant result = constants[constant]; | 180 HConstant result = constants[constant]; |
178 // TODO(johnniwinther): Support source information per constant reference. | 181 // TODO(johnniwinther): Support source information per constant reference. |
179 if (result == null) { | 182 if (result == null) { |
180 TypeMask type = computeTypeMask(compiler, constant); | 183 TypeMask type = computeTypeMask(compiler, constant); |
181 result = new HConstant.internal(constant, type) | 184 result = new HConstant.internal(constant, type) |
182 ..sourceInformation = sourceInformation; | 185 ..sourceInformation = sourceInformation; |
183 entry.addAtExit(result); | 186 entry.addAtExit(result); |
184 constants[constant] = result; | 187 constants[constant] = result; |
185 } else if (result.block == null) { | 188 } else if (result.block == null) { |
186 // The constant was not used anymore. | 189 // The constant was not used anymore. |
(...skipping 3140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3327 class HDynamicType extends HRuntimeType { | 3330 class HDynamicType extends HRuntimeType { |
3328 HDynamicType(DynamicType dartType, TypeMask instructionType) | 3331 HDynamicType(DynamicType dartType, TypeMask instructionType) |
3329 : super(const <HInstruction>[], dartType, instructionType); | 3332 : super(const <HInstruction>[], dartType, instructionType); |
3330 | 3333 |
3331 accept(HVisitor visitor) => visitor.visitDynamicType(this); | 3334 accept(HVisitor visitor) => visitor.visitDynamicType(this); |
3332 | 3335 |
3333 int typeCode() => HInstruction.DYNAMIC_TYPE_TYPECODE; | 3336 int typeCode() => HInstruction.DYNAMIC_TYPE_TYPECODE; |
3334 | 3337 |
3335 bool typeEquals(HInstruction other) => other is HDynamicType; | 3338 bool typeEquals(HInstruction other) => other is HDynamicType; |
3336 } | 3339 } |
OLD | NEW |