Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1)

Side by Side Diff: sdk/lib/_internal/compiler/implementation/ssa/nodes.dart

Issue 11299009: Support type literals as compile-time constants. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 visitBailoutTarget(HBailoutTarget node); 9 R visitBailoutTarget(HBailoutTarget node);
10 R visitBitAnd(HBitAnd node); 10 R visitBitAnd(HBitAnd node);
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
162 162
163 static HType mapConstantTypeToSsaType(Constant constant) { 163 static HType mapConstantTypeToSsaType(Constant constant) {
164 if (constant.isNull()) return HType.NULL; 164 if (constant.isNull()) return HType.NULL;
165 if (constant.isBool()) return HType.BOOLEAN; 165 if (constant.isBool()) return HType.BOOLEAN;
166 if (constant.isInt()) return HType.INTEGER; 166 if (constant.isInt()) return HType.INTEGER;
167 if (constant.isDouble()) return HType.DOUBLE; 167 if (constant.isDouble()) return HType.DOUBLE;
168 if (constant.isString()) return HType.STRING; 168 if (constant.isString()) return HType.STRING;
169 if (constant.isList()) return HType.READABLE_ARRAY; 169 if (constant.isList()) return HType.READABLE_ARRAY;
170 if (constant.isFunction()) return HType.UNKNOWN; 170 if (constant.isFunction()) return HType.UNKNOWN;
171 if (constant.isSentinel()) return HType.UNKNOWN; 171 if (constant.isSentinel()) return HType.UNKNOWN;
172 ObjectConstant objectConstant = constant; 172 if (constant.isType) {
ngeoffray 2012/11/15 16:07:24 You can remove this once TypeConstant extends Obje
karlklose 2012/11/19 15:08:58 Done.
173 return new HBoundedType.exact(objectConstant.type); 173 TypeConstant typeConstant = constant;
174 return new HBoundedType.exact(typeConstant.type);
175 } else {
176 ObjectConstant objectConstant = constant;
177 return new HBoundedType.exact(objectConstant.type);
178 }
174 } 179 }
175 180
176 HConstant addConstant(Constant constant) { 181 HConstant addConstant(Constant constant) {
177 HConstant result = constants[constant]; 182 HConstant result = constants[constant];
178 if (result == null) { 183 if (result == null) {
179 HType type = mapConstantTypeToSsaType(constant); 184 HType type = mapConstantTypeToSsaType(constant);
180 result = new HConstant.internal(constant, type); 185 result = new HConstant.internal(constant, type);
181 entry.addAtExit(result); 186 entry.addAtExit(result);
182 constants[constant] = result; 187 constants[constant] = result;
183 } 188 }
(...skipping 2830 matching lines...) Expand 10 before | Expand all | Expand 10 after
3014 HBasicBlock get start => expression.start; 3019 HBasicBlock get start => expression.start;
3015 HBasicBlock get end { 3020 HBasicBlock get end {
3016 // We don't create a switch block if there are no cases. 3021 // We don't create a switch block if there are no cases.
3017 assert(!statements.isEmpty); 3022 assert(!statements.isEmpty);
3018 return statements.last.end; 3023 return statements.last.end;
3019 } 3024 }
3020 3025
3021 bool accept(HStatementInformationVisitor visitor) => 3026 bool accept(HStatementInformationVisitor visitor) =>
3022 visitor.visitSwitchInfo(this); 3027 visitor.visitSwitchInfo(this);
3023 } 3028 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698