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

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

Issue 40593002: Revert "Separate HTypeConversion checked type from output type." (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 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 visitBitAnd(HBitAnd node); 9 R visitBitAnd(HBitAnd node);
10 R visitBitNot(HBitNot node); 10 R visitBitNot(HBitNot node);
(...skipping 2233 matching lines...) Expand 10 before | Expand all | Expand 10 after
2244 return typeExpression == other.typeExpression 2244 return typeExpression == other.typeExpression
2245 && kind == other.kind; 2245 && kind == other.kind;
2246 } 2246 }
2247 } 2247 }
2248 2248
2249 class HTypeConversion extends HCheck { 2249 class HTypeConversion extends HCheck {
2250 final DartType typeExpression; 2250 final DartType typeExpression;
2251 final int kind; 2251 final int kind;
2252 final Selector receiverTypeCheckSelector; 2252 final Selector receiverTypeCheckSelector;
2253 final bool contextIsTypeArguments; 2253 final bool contextIsTypeArguments;
2254 HType checkedType; // Not final because we refine it.
2255 2254
2256 static const int CHECKED_MODE_CHECK = 0; 2255 static const int CHECKED_MODE_CHECK = 0;
2257 static const int ARGUMENT_TYPE_CHECK = 1; 2256 static const int ARGUMENT_TYPE_CHECK = 1;
2258 static const int CAST_TYPE_CHECK = 2; 2257 static const int CAST_TYPE_CHECK = 2;
2259 static const int BOOLEAN_CONVERSION_CHECK = 3; 2258 static const int BOOLEAN_CONVERSION_CHECK = 3;
2260 static const int RECEIVER_TYPE_CHECK = 4; 2259 static const int RECEIVER_TYPE_CHECK = 4;
2261 2260
2262 HTypeConversion(this.typeExpression, this.kind, 2261 HTypeConversion(this.typeExpression, this.kind,
2263 HType type, HInstruction input, 2262 HType type, HInstruction input,
2264 [this.receiverTypeCheckSelector]) 2263 [this.receiverTypeCheckSelector])
2265 : contextIsTypeArguments = false, 2264 : contextIsTypeArguments = false,
2266 checkedType = type,
2267 super(<HInstruction>[input]) { 2265 super(<HInstruction>[input]) {
2268 assert(!isReceiverTypeCheck || receiverTypeCheckSelector != null); 2266 assert(!isReceiverTypeCheck || receiverTypeCheckSelector != null);
2269 assert(typeExpression == null || 2267 assert(typeExpression == null ||
2270 typeExpression.kind != TypeKind.TYPEDEF); 2268 typeExpression.kind != TypeKind.TYPEDEF);
2271 sourceElement = input.sourceElement; 2269 sourceElement = input.sourceElement;
2272 instructionType = type; 2270 instructionType = type;
2273 } 2271 }
2274 2272
2275 HTypeConversion.withTypeRepresentation(this.typeExpression, this.kind, 2273 HTypeConversion.withTypeRepresentation(this.typeExpression, this.kind,
2276 HType type, HInstruction input, 2274 HType type, HInstruction input,
2277 HInstruction typeRepresentation) 2275 HInstruction typeRepresentation)
2278 : contextIsTypeArguments = false, 2276 : contextIsTypeArguments = false,
2279 checkedType = type,
2280 super(<HInstruction>[input, typeRepresentation]), 2277 super(<HInstruction>[input, typeRepresentation]),
2281 receiverTypeCheckSelector = null { 2278 receiverTypeCheckSelector = null {
2282 assert(typeExpression.kind != TypeKind.TYPEDEF); 2279 assert(typeExpression.kind != TypeKind.TYPEDEF);
2283 sourceElement = input.sourceElement; 2280 sourceElement = input.sourceElement;
2284 instructionType = type; 2281 instructionType = type;
2285 } 2282 }
2286 2283
2287 HTypeConversion.withContext(this.typeExpression, this.kind, 2284 HTypeConversion.withContext(this.typeExpression, this.kind,
2288 HType type, HInstruction input, 2285 HType type, HInstruction input,
2289 HInstruction context, 2286 HInstruction context,
2290 {bool this.contextIsTypeArguments}) 2287 {bool this.contextIsTypeArguments})
2291 : super(<HInstruction>[input, context]), 2288 : super(<HInstruction>[input, context]),
2292 checkedType = type,
2293 receiverTypeCheckSelector = null { 2289 receiverTypeCheckSelector = null {
2294 assert(typeExpression.kind != TypeKind.TYPEDEF); 2290 assert(typeExpression.kind != TypeKind.TYPEDEF);
2295 sourceElement = input.sourceElement; 2291 sourceElement = input.sourceElement;
2296 instructionType = type; 2292 instructionType = type;
2297 } 2293 }
2298 2294
2299 bool get hasTypeRepresentation { 2295 bool get hasTypeRepresentation {
2300 return typeExpression.kind == TypeKind.INTERFACE && inputs.length > 1; 2296 return typeExpression.kind == TypeKind.INTERFACE && inputs.length > 1;
2301 } 2297 }
2302 HInstruction get typeRepresentation => inputs[1]; 2298 HInstruction get typeRepresentation => inputs[1];
(...skipping 22 matching lines...) Expand all
2325 bool isJsStatement() => isControlFlow(); 2321 bool isJsStatement() => isControlFlow();
2326 bool isControlFlow() => isArgumentTypeCheck || isReceiverTypeCheck; 2322 bool isControlFlow() => isArgumentTypeCheck || isReceiverTypeCheck;
2327 2323
2328 int typeCode() => HInstruction.TYPE_CONVERSION_TYPECODE; 2324 int typeCode() => HInstruction.TYPE_CONVERSION_TYPECODE;
2329 bool typeEquals(HInstruction other) => other is HTypeConversion; 2325 bool typeEquals(HInstruction other) => other is HTypeConversion;
2330 bool isCodeMotionInvariant() => false; 2326 bool isCodeMotionInvariant() => false;
2331 2327
2332 bool dataEquals(HTypeConversion other) { 2328 bool dataEquals(HTypeConversion other) {
2333 return kind == other.kind 2329 return kind == other.kind
2334 && typeExpression == other.typeExpression 2330 && typeExpression == other.typeExpression
2335 && checkedType == other.checkedType; 2331 && instructionType == other.instructionType;
2336 } 2332 }
2337 } 2333 }
2338 2334
2339 /// The [HTypeKnown] instruction marks a value with a refined type. 2335 /// The [HTypeKnown] instruction marks a value with a refined type.
2340 class HTypeKnown extends HCheck { 2336 class HTypeKnown extends HCheck {
2341 HType knownType; 2337 HType knownType;
2342 HTypeKnown(HType this.knownType, HInstruction input) 2338 HTypeKnown(HType this.knownType, HInstruction input)
2343 : super(<HInstruction>[input]) { 2339 : super(<HInstruction>[input]) {
2344 instructionType = knownType; 2340 instructionType = knownType;
2345 } 2341 }
(...skipping 389 matching lines...) Expand 10 before | Expand all | Expand 10 after
2735 HBasicBlock get start => expression.start; 2731 HBasicBlock get start => expression.start;
2736 HBasicBlock get end { 2732 HBasicBlock get end {
2737 // We don't create a switch block if there are no cases. 2733 // We don't create a switch block if there are no cases.
2738 assert(!statements.isEmpty); 2734 assert(!statements.isEmpty);
2739 return statements.last.end; 2735 return statements.last.end;
2740 } 2736 }
2741 2737
2742 bool accept(HStatementInformationVisitor visitor) => 2738 bool accept(HStatementInformationVisitor visitor) =>
2743 visitor.visitSwitchInfo(this); 2739 visitor.visitSwitchInfo(this);
2744 } 2740 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698