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

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

Issue 24952003: Change TypeMask.base to be a ClassElement. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Moar declaration. Created 7 years, 2 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 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 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
168 if (constant.isBool()) return HType.BOOLEAN; 168 if (constant.isBool()) return HType.BOOLEAN;
169 if (constant.isInt()) return HType.INTEGER; 169 if (constant.isInt()) return HType.INTEGER;
170 if (constant.isDouble()) return HType.DOUBLE; 170 if (constant.isDouble()) return HType.DOUBLE;
171 if (constant.isString()) return backend.stringType; 171 if (constant.isString()) return backend.stringType;
172 if (constant.isList()) return backend.readableArrayType; 172 if (constant.isList()) return backend.readableArrayType;
173 if (constant.isFunction()) return HType.UNKNOWN; 173 if (constant.isFunction()) return HType.UNKNOWN;
174 if (constant.isSentinel()) return HType.UNKNOWN; 174 if (constant.isSentinel()) return HType.UNKNOWN;
175 // TODO(sra): What is the type of the prototype of an interceptor? 175 // TODO(sra): What is the type of the prototype of an interceptor?
176 if (constant.isInterceptor()) return HType.UNKNOWN; 176 if (constant.isInterceptor()) return HType.UNKNOWN;
177 ObjectConstant objectConstant = constant; 177 ObjectConstant objectConstant = constant;
178 return new HBoundedType(new TypeMask.nonNullExact(objectConstant.type)); 178 TypeMask mask = new TypeMask.nonNullExact(objectConstant.type.element);
179 return new HBoundedType(mask);
179 } 180 }
180 181
181 HConstant addConstant(Constant constant, Compiler compiler) { 182 HConstant addConstant(Constant constant, Compiler compiler) {
182 HConstant result = constants[constant]; 183 HConstant result = constants[constant];
183 if (result == null) { 184 if (result == null) {
184 HType type = mapConstantTypeToSsaType(constant, compiler); 185 HType type = mapConstantTypeToSsaType(constant, compiler);
185 result = new HConstant.internal(constant, type); 186 result = new HConstant.internal(constant, type);
186 entry.addAtExit(result); 187 entry.addAtExit(result);
187 constants[constant] = result; 188 constants[constant] = result;
188 } else if (result.block == null) { 189 } else if (result.block == null) {
(...skipping 930 matching lines...) Expand 10 before | Expand all | Expand 10 after
1119 1120
1120 HInstruction convertType(Compiler compiler, DartType type, int kind) { 1121 HInstruction convertType(Compiler compiler, DartType type, int kind) {
1121 if (type == null) return this; 1122 if (type == null) return this;
1122 type = type.unalias(compiler); 1123 type = type.unalias(compiler);
1123 // Only the builder knows how to create [HTypeConversion] 1124 // Only the builder knows how to create [HTypeConversion]
1124 // instructions with generics. It has the generic type context 1125 // instructions with generics. It has the generic type context
1125 // available. 1126 // available.
1126 assert(type.kind != TypeKind.TYPE_VARIABLE); 1127 assert(type.kind != TypeKind.TYPE_VARIABLE);
1127 assert(type.isRaw || type.kind == TypeKind.FUNCTION); 1128 assert(type.isRaw || type.kind == TypeKind.FUNCTION);
1128 if (type.treatAsDynamic) return this; 1129 if (type.treatAsDynamic) return this;
1129 if (identical(type.element, compiler.objectClass)) return this; 1130 ClassElement element = type.element;
1131 if (identical(element, compiler.objectClass)) return this;
1130 if (type.kind != TypeKind.INTERFACE) { 1132 if (type.kind != TypeKind.INTERFACE) {
1131 return new HTypeConversion(type, kind, HType.UNKNOWN, this); 1133 return new HTypeConversion(type, kind, HType.UNKNOWN, this);
1132 } else if (kind == HTypeConversion.BOOLEAN_CONVERSION_CHECK) { 1134 } else if (kind == HTypeConversion.BOOLEAN_CONVERSION_CHECK) {
1133 // Boolean conversion checks work on non-nullable booleans. 1135 // Boolean conversion checks work on non-nullable booleans.
1134 return new HTypeConversion(type, kind, HType.BOOLEAN, this); 1136 return new HTypeConversion(type, kind, HType.BOOLEAN, this);
1135 } else if (kind == HTypeConversion.CHECKED_MODE_CHECK && !type.isRaw) { 1137 } else if (kind == HTypeConversion.CHECKED_MODE_CHECK && !type.isRaw) {
1136 throw 'creating compound check to $type (this = ${this})'; 1138 throw 'creating compound check to $type (this = ${this})';
1137 } else { 1139 } else {
1138 HType subtype = new HType.subtype(type, compiler); 1140 HType subtype = new HType.subtype(element, compiler);
1139 return new HTypeConversion(type, kind, subtype, this); 1141 return new HTypeConversion(type, kind, subtype, this);
1140 } 1142 }
1141 } 1143 }
1142 1144
1143 /** 1145 /**
1144 * Return whether the instructions do not belong to a loop or 1146 * Return whether the instructions do not belong to a loop or
1145 * belong to the same loop. 1147 * belong to the same loop.
1146 */ 1148 */
1147 bool hasSameLoopHeaderAs(HInstruction other) { 1149 bool hasSameLoopHeaderAs(HInstruction other) {
1148 return block.enclosingLoopHeader == other.block.enclosingLoopHeader; 1150 return block.enclosingLoopHeader == other.block.enclosingLoopHeader;
(...skipping 1627 matching lines...) Expand 10 before | Expand all | Expand 10 after
2776 HBasicBlock get start => expression.start; 2778 HBasicBlock get start => expression.start;
2777 HBasicBlock get end { 2779 HBasicBlock get end {
2778 // We don't create a switch block if there are no cases. 2780 // We don't create a switch block if there are no cases.
2779 assert(!statements.isEmpty); 2781 assert(!statements.isEmpty);
2780 return statements.last.end; 2782 return statements.last.end;
2781 } 2783 }
2782 2784
2783 bool accept(HStatementInformationVisitor visitor) => 2785 bool accept(HStatementInformationVisitor visitor) =>
2784 visitor.visitSwitchInfo(this); 2786 visitor.visitSwitchInfo(this);
2785 } 2787 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698