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 interface HVisitor<R> { | 5 interface HVisitor<R> { |
6 R visitAdd(HAdd node); | 6 R visitAdd(HAdd node); |
7 R visitBailoutTarget(HBailoutTarget node); | 7 R visitBailoutTarget(HBailoutTarget node); |
8 R visitBitAnd(HBitAnd node); | 8 R visitBitAnd(HBitAnd node); |
9 R visitBitNot(HBitNot node); | 9 R visitBitNot(HBitNot node); |
10 R visitBitOr(HBitOr node); | 10 R visitBitOr(HBitOr node); |
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
156 } | 156 } |
157 | 157 |
158 static HType mapConstantTypeToSsaType(Constant constant) { | 158 static HType mapConstantTypeToSsaType(Constant constant) { |
159 if (constant.isNull()) return HType.NULL; | 159 if (constant.isNull()) return HType.NULL; |
160 if (constant.isBool()) return HType.BOOLEAN; | 160 if (constant.isBool()) return HType.BOOLEAN; |
161 if (constant.isInt()) return HType.INTEGER; | 161 if (constant.isInt()) return HType.INTEGER; |
162 if (constant.isDouble()) return HType.DOUBLE; | 162 if (constant.isDouble()) return HType.DOUBLE; |
163 if (constant.isString()) return HType.STRING; | 163 if (constant.isString()) return HType.STRING; |
164 if (constant.isList()) return HType.READABLE_ARRAY; | 164 if (constant.isList()) return HType.READABLE_ARRAY; |
165 if (constant.isFunction()) return HType.UNKNOWN; | 165 if (constant.isFunction()) return HType.UNKNOWN; |
| 166 // Give a primitive type to the sentinel to avoid Dart semantics |
| 167 // for equality check. |
| 168 if (constant.isSentinel()) return HType.STRING; |
166 ObjectConstant objectConstant = constant; | 169 ObjectConstant objectConstant = constant; |
167 return new HBoundedType.exact(objectConstant.type); | 170 return new HBoundedType.exact(objectConstant.type); |
168 } | 171 } |
169 | 172 |
170 HConstant addConstant(Constant constant) { | 173 HConstant addConstant(Constant constant) { |
171 HConstant result = constants[constant]; | 174 HConstant result = constants[constant]; |
172 if (result === null) { | 175 if (result === null) { |
173 HType type = mapConstantTypeToSsaType(constant); | 176 HType type = mapConstantTypeToSsaType(constant); |
174 result = new HConstant.internal(constant, type); | 177 result = new HConstant.internal(constant, type); |
175 entry.addAtExit(result); | 178 entry.addAtExit(result); |
(...skipping 2623 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2799 HBasicBlock get start => expression.start; | 2802 HBasicBlock get start => expression.start; |
2800 HBasicBlock get end { | 2803 HBasicBlock get end { |
2801 // We don't create a switch block if there are no cases. | 2804 // We don't create a switch block if there are no cases. |
2802 assert(!statements.isEmpty()); | 2805 assert(!statements.isEmpty()); |
2803 return statements.last().end; | 2806 return statements.last().end; |
2804 } | 2807 } |
2805 | 2808 |
2806 bool accept(HStatementInformationVisitor visitor) => | 2809 bool accept(HStatementInformationVisitor visitor) => |
2807 visitor.visitSwitchInfo(this); | 2810 visitor.visitSwitchInfo(this); |
2808 } | 2811 } |
OLD | NEW |