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

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

Issue 12207081: Add a type kind to TypedSelector. A typed selector can either be (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 10 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 1134 matching lines...) Expand 10 before | Expand all | Expand 10 after
1145 } 1145 }
1146 1146
1147 1147
1148 HInstruction convertType(Compiler compiler, DartType type, int kind) { 1148 HInstruction convertType(Compiler compiler, DartType type, int kind) {
1149 if (type == null) return this; 1149 if (type == null) return this;
1150 if (identical(type.element, compiler.dynamicClass)) return this; 1150 if (identical(type.element, compiler.dynamicClass)) return this;
1151 if (identical(type.element, compiler.objectClass)) return this; 1151 if (identical(type.element, compiler.objectClass)) return this;
1152 1152
1153 // If the original can't be null, type conversion also can't produce null. 1153 // If the original can't be null, type conversion also can't produce null.
1154 bool canBeNull = this.guaranteedType.canBeNull(); 1154 bool canBeNull = this.guaranteedType.canBeNull();
1155 HType convertedType = 1155 HType convertedType = new HType.fromBoundedType(
kasperl 2013/02/11 08:18:12 This one would have to be: new HType.subtype(t
ngeoffray 2013/02/11 10:20:55 Done.
1156 new HType.fromBoundedType(type, compiler, canBeNull); 1156 type,
1157 compiler,
1158 canBeNull: canBeNull,
1159 isExact: false,
1160 isInterfaceType: true);
1157 1161
1158 // No need to convert if we know the instruction has 1162 // No need to convert if we know the instruction has
1159 // [convertedType] as a bound. 1163 // [convertedType] as a bound.
1160 if (this.guaranteedType == convertedType) { 1164 if (this.guaranteedType == convertedType) {
1161 return this; 1165 return this;
1162 } 1166 }
1163 1167
1164 return new HTypeConversion(convertedType, this, kind); 1168 return new HTypeConversion(convertedType, this, kind);
1165 } 1169 }
1166 1170
(...skipping 1128 matching lines...) Expand 10 before | Expand all | Expand 10 after
2295 2299
2296 int typeCode() => HInstruction.IS_TYPECODE; 2300 int typeCode() => HInstruction.IS_TYPECODE;
2297 bool typeEquals(HInstruction other) => other is HIs; 2301 bool typeEquals(HInstruction other) => other is HIs;
2298 bool dataEquals(HIs other) { 2302 bool dataEquals(HIs other) {
2299 return typeExpression == other.typeExpression 2303 return typeExpression == other.typeExpression
2300 && nullOk == other.nullOk; 2304 && nullOk == other.nullOk;
2301 } 2305 }
2302 } 2306 }
2303 2307
2304 class HTypeConversion extends HCheck { 2308 class HTypeConversion extends HCheck {
2305 HType type; 2309 final HType type;
2306 final int kind; 2310 final int kind;
2307 2311
2308 static const int NO_CHECK = 0; 2312 static const int NO_CHECK = 0;
2309 static const int CHECKED_MODE_CHECK = 1; 2313 static const int CHECKED_MODE_CHECK = 1;
2310 static const int ARGUMENT_TYPE_CHECK = 2; 2314 static const int ARGUMENT_TYPE_CHECK = 2;
2311 static const int CAST_TYPE_CHECK = 3; 2315 static const int CAST_TYPE_CHECK = 3;
2312 static const int BOOLEAN_CONVERSION_CHECK = 4; 2316 static const int BOOLEAN_CONVERSION_CHECK = 4;
2313 2317
2314 HTypeConversion(this.type, HInstruction input, [this.kind = NO_CHECK]) 2318 HTypeConversion(this.type, HInstruction input, [this.kind = NO_CHECK])
2315 : super(<HInstruction>[input]) { 2319 : super(<HInstruction>[input]) {
2320 assert(type != null);
2316 sourceElement = input.sourceElement; 2321 sourceElement = input.sourceElement;
2317 } 2322 }
2318 HTypeConversion.checkedModeCheck(HType type, HInstruction input) 2323 HTypeConversion.checkedModeCheck(HType type, HInstruction input)
2319 : this(type, input, CHECKED_MODE_CHECK); 2324 : this(type, input, CHECKED_MODE_CHECK);
2320 HTypeConversion.argumentTypeCheck(HType type, HInstruction input) 2325 HTypeConversion.argumentTypeCheck(HType type, HInstruction input)
2321 : this(type, input, ARGUMENT_TYPE_CHECK); 2326 : this(type, input, ARGUMENT_TYPE_CHECK);
2322 HTypeConversion.castCheck(HType type, HInstruction input) 2327 HTypeConversion.castCheck(HType type, HInstruction input)
2323 : this(type, input, CAST_TYPE_CHECK); 2328 : this(type, input, CAST_TYPE_CHECK);
2324 2329
2325 2330
(...skipping 376 matching lines...) Expand 10 before | Expand all | Expand 10 after
2702 HBasicBlock get start => expression.start; 2707 HBasicBlock get start => expression.start;
2703 HBasicBlock get end { 2708 HBasicBlock get end {
2704 // We don't create a switch block if there are no cases. 2709 // We don't create a switch block if there are no cases.
2705 assert(!statements.isEmpty); 2710 assert(!statements.isEmpty);
2706 return statements.last.end; 2711 return statements.last.end;
2707 } 2712 }
2708 2713
2709 bool accept(HStatementInformationVisitor visitor) => 2714 bool accept(HStatementInformationVisitor visitor) =>
2710 visitor.visitSwitchInfo(this); 2715 visitor.visitSwitchInfo(this);
2711 } 2716 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698