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

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.subtype(type, compiler);
1156 new HType.fromBoundedType(type, compiler, canBeNull);
1157 1156
1158 // No need to convert if we know the instruction has 1157 // No need to convert if we know the instruction has
1159 // [convertedType] as a bound. 1158 // [convertedType] as a bound.
1160 if (this.guaranteedType == convertedType) { 1159 if (this.guaranteedType == convertedType) {
1161 return this; 1160 return this;
1162 } 1161 }
1163 1162
1164 return new HTypeConversion(convertedType, this, kind); 1163 return new HTypeConversion(convertedType, this, kind);
1165 } 1164 }
1166 1165
(...skipping 1128 matching lines...) Expand 10 before | Expand all | Expand 10 after
2295 2294
2296 int typeCode() => HInstruction.IS_TYPECODE; 2295 int typeCode() => HInstruction.IS_TYPECODE;
2297 bool typeEquals(HInstruction other) => other is HIs; 2296 bool typeEquals(HInstruction other) => other is HIs;
2298 bool dataEquals(HIs other) { 2297 bool dataEquals(HIs other) {
2299 return typeExpression == other.typeExpression 2298 return typeExpression == other.typeExpression
2300 && nullOk == other.nullOk; 2299 && nullOk == other.nullOk;
2301 } 2300 }
2302 } 2301 }
2303 2302
2304 class HTypeConversion extends HCheck { 2303 class HTypeConversion extends HCheck {
2305 HType type; 2304 final HType type;
2306 final int kind; 2305 final int kind;
2307 2306
2308 static const int NO_CHECK = 0; 2307 static const int NO_CHECK = 0;
2309 static const int CHECKED_MODE_CHECK = 1; 2308 static const int CHECKED_MODE_CHECK = 1;
2310 static const int ARGUMENT_TYPE_CHECK = 2; 2309 static const int ARGUMENT_TYPE_CHECK = 2;
2311 static const int CAST_TYPE_CHECK = 3; 2310 static const int CAST_TYPE_CHECK = 3;
2312 static const int BOOLEAN_CONVERSION_CHECK = 4; 2311 static const int BOOLEAN_CONVERSION_CHECK = 4;
2313 2312
2314 HTypeConversion(this.type, HInstruction input, [this.kind = NO_CHECK]) 2313 HTypeConversion(this.type, HInstruction input, [this.kind = NO_CHECK])
2315 : super(<HInstruction>[input]) { 2314 : super(<HInstruction>[input]) {
2315 assert(type != null);
2316 sourceElement = input.sourceElement; 2316 sourceElement = input.sourceElement;
2317 } 2317 }
2318 HTypeConversion.checkedModeCheck(HType type, HInstruction input) 2318 HTypeConversion.checkedModeCheck(HType type, HInstruction input)
2319 : this(type, input, CHECKED_MODE_CHECK); 2319 : this(type, input, CHECKED_MODE_CHECK);
2320 HTypeConversion.argumentTypeCheck(HType type, HInstruction input) 2320 HTypeConversion.argumentTypeCheck(HType type, HInstruction input)
2321 : this(type, input, ARGUMENT_TYPE_CHECK); 2321 : this(type, input, ARGUMENT_TYPE_CHECK);
2322 HTypeConversion.castCheck(HType type, HInstruction input) 2322 HTypeConversion.castCheck(HType type, HInstruction input)
2323 : this(type, input, CAST_TYPE_CHECK); 2323 : this(type, input, CAST_TYPE_CHECK);
2324 2324
2325 2325
(...skipping 376 matching lines...) Expand 10 before | Expand all | Expand 10 after
2702 HBasicBlock get start => expression.start; 2702 HBasicBlock get start => expression.start;
2703 HBasicBlock get end { 2703 HBasicBlock get end {
2704 // We don't create a switch block if there are no cases. 2704 // We don't create a switch block if there are no cases.
2705 assert(!statements.isEmpty); 2705 assert(!statements.isEmpty);
2706 return statements.last.end; 2706 return statements.last.end;
2707 } 2707 }
2708 2708
2709 bool accept(HStatementInformationVisitor visitor) => 2709 bool accept(HStatementInformationVisitor visitor) =>
2710 visitor.visitSwitchInfo(this); 2710 visitor.visitSwitchInfo(this);
2711 } 2711 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698