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

Side by Side Diff: pkg/compiler/lib/src/cps_ir/cps_ir_nodes.dart

Issue 1161793002: Revert "dart2js cps: 'is' checks on types with type arguments." (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 7 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
OLDNEW
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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 // IrNodes are kept in a separate library to have precise control over their 5 // IrNodes are kept in a separate library to have precise control over their
6 // dependencies on other parts of the system. 6 // dependencies on other parts of the system.
7 library dart2js.ir_nodes; 7 library dart2js.ir_nodes;
8 8
9 import '../constants/expressions.dart'; 9 import '../constants/expressions.dart';
10 import '../constants/values.dart' as values show ConstantValue; 10 import '../constants/values.dart' as values show ConstantValue;
(...skipping 384 matching lines...) Expand 10 before | Expand all | Expand 10 after
395 } 395 }
396 396
397 accept(Visitor visitor) => visitor.visitInvokeConstructor(this); 397 accept(Visitor visitor) => visitor.visitInvokeConstructor(this);
398 } 398 }
399 399
400 /// "as" casts and "is" checks. 400 /// "as" casts and "is" checks.
401 // We might want to turn "is"-checks into a [Primitive] as it can never diverge. 401 // We might want to turn "is"-checks into a [Primitive] as it can never diverge.
402 // But then we need to special-case for is-checks with an erroneous .type as 402 // But then we need to special-case for is-checks with an erroneous .type as
403 // these will throw. 403 // these will throw.
404 class TypeOperator extends Expression { 404 class TypeOperator extends Expression {
405 Reference<Primitive> value; 405 Reference<Primitive> receiver;
406 final DartType type; 406 final DartType type;
407 /// Type arguments to [type]. Since [type] may reference type variables in the
408 /// enclosing class, these are not constant.
409 final List<Reference<Primitive>> typeArguments;
410 final Reference<Continuation> continuation; 407 final Reference<Continuation> continuation;
411 // TODO(johnniwinther): Use `Operator` class to encapsule the operator type. 408 // TODO(johnniwinther): Use `Operator` class to encapsule the operator type.
412 final bool isTypeTest; 409 final bool isTypeTest;
413 410
414 TypeOperator(Primitive value, 411 TypeOperator(Primitive receiver,
415 this.type, 412 this.type,
416 List<Primitive> typeArguments,
417 Continuation cont, 413 Continuation cont,
418 {bool this.isTypeTest}) 414 {bool this.isTypeTest})
419 : this.value = new Reference<Primitive>(value), 415 : this.receiver = new Reference<Primitive>(receiver),
420 this.typeArguments = _referenceList(typeArguments),
421 this.continuation = new Reference<Continuation>(cont) { 416 this.continuation = new Reference<Continuation>(cont) {
422 assert(isTypeTest != null); 417 assert(isTypeTest != null);
423 } 418 }
424 419
425 bool get isTypeCast => !isTypeTest; 420 bool get isTypeCast => !isTypeTest;
426 421
427 accept(Visitor visitor) => visitor.visitTypeOperator(this); 422 accept(Visitor visitor) => visitor.visitTypeOperator(this);
428 } 423 }
429 424
430 /// Invoke [toString] on each argument and concatenate the results. 425 /// Invoke [toString] on each argument and concatenate the results.
(...skipping 811 matching lines...) Expand 10 before | Expand all | Expand 10 after
1242 processBranch(node); 1237 processBranch(node);
1243 processReference(node.trueContinuation); 1238 processReference(node.trueContinuation);
1244 processReference(node.falseContinuation); 1239 processReference(node.falseContinuation);
1245 visit(node.condition); 1240 visit(node.condition);
1246 } 1241 }
1247 1242
1248 processTypeOperator(TypeOperator node) {} 1243 processTypeOperator(TypeOperator node) {}
1249 visitTypeOperator(TypeOperator node) { 1244 visitTypeOperator(TypeOperator node) {
1250 processTypeOperator(node); 1245 processTypeOperator(node);
1251 processReference(node.continuation); 1246 processReference(node.continuation);
1252 processReference(node.value); 1247 processReference(node.receiver);
1253 node.typeArguments.forEach(processReference);
1254 } 1248 }
1255 1249
1256 processSetMutableVariable(SetMutableVariable node) {} 1250 processSetMutableVariable(SetMutableVariable node) {}
1257 visitSetMutableVariable(SetMutableVariable node) { 1251 visitSetMutableVariable(SetMutableVariable node) {
1258 processSetMutableVariable(node); 1252 processSetMutableVariable(node);
1259 processReference(node.variable); 1253 processReference(node.variable);
1260 processReference(node.value); 1254 processReference(node.value);
1261 visit(node.body); 1255 visit(node.body);
1262 } 1256 }
1263 1257
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
1414 processNonTailThrow(node); 1408 processNonTailThrow(node);
1415 processReference(node.value); 1409 processReference(node.value);
1416 } 1410 }
1417 1411
1418 processCreateInvocationMirror(CreateInvocationMirror node) {} 1412 processCreateInvocationMirror(CreateInvocationMirror node) {}
1419 visitCreateInvocationMirror(CreateInvocationMirror node) { 1413 visitCreateInvocationMirror(CreateInvocationMirror node) {
1420 processCreateInvocationMirror(node); 1414 processCreateInvocationMirror(node);
1421 node.arguments.forEach(processReference); 1415 node.arguments.forEach(processReference);
1422 } 1416 }
1423 } 1417 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/cps_ir/cps_ir_builder_task.dart ('k') | pkg/compiler/lib/src/cps_ir/cps_ir_nodes_sexpr.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698