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

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

Issue 10872059: Static and top-level methods can be compile time constants. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 3 months 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 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
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;
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
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 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698