Chromium Code Reviews| 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 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 155 return result; | 155 return result; |
| 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; | |
|
kasperl
2012/08/27 13:17:26
I guess it could be represented as a HBoundType us
| |
| 165 ObjectConstant objectConstant = constant; | 166 ObjectConstant objectConstant = constant; |
| 166 return new HBoundedType.exact(objectConstant.type); | 167 return new HBoundedType.exact(objectConstant.type); |
| 167 } | 168 } |
| 168 | 169 |
| 169 HConstant addConstant(Constant constant) { | 170 HConstant addConstant(Constant constant) { |
| 170 HConstant result = constants[constant]; | 171 HConstant result = constants[constant]; |
| 171 if (result === null) { | 172 if (result === null) { |
| 172 HType type = mapConstantTypeToSsaType(constant); | 173 HType type = mapConstantTypeToSsaType(constant); |
| 173 result = new HConstant.internal(constant, type); | 174 result = new HConstant.internal(constant, type); |
| 174 entry.addAtExit(result); | 175 entry.addAtExit(result); |
| (...skipping 2623 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2798 HBasicBlock get start => expression.start; | 2799 HBasicBlock get start => expression.start; |
| 2799 HBasicBlock get end { | 2800 HBasicBlock get end { |
| 2800 // We don't create a switch block if there are no cases. | 2801 // We don't create a switch block if there are no cases. |
| 2801 assert(!statements.isEmpty()); | 2802 assert(!statements.isEmpty()); |
| 2802 return statements.last().end; | 2803 return statements.last().end; |
| 2803 } | 2804 } |
| 2804 | 2805 |
| 2805 bool accept(HStatementInformationVisitor visitor) => | 2806 bool accept(HStatementInformationVisitor visitor) => |
| 2806 visitor.visitSwitchInfo(this); | 2807 visitor.visitSwitchInfo(this); |
| 2807 } | 2808 } |
| OLD | NEW |