Chromium Code Reviews| Index: pkg/compiler/lib/src/cps_ir/cps_ir_nodes.dart |
| diff --git a/pkg/compiler/lib/src/cps_ir/cps_ir_nodes.dart b/pkg/compiler/lib/src/cps_ir/cps_ir_nodes.dart |
| index 19b0543c179877ab2a4d7ba2c7061d8822b6f116..dbc84fb2479f84f99196b9ada33b08f26725e543 100644 |
| --- a/pkg/compiler/lib/src/cps_ir/cps_ir_nodes.dart |
| +++ b/pkg/compiler/lib/src/cps_ir/cps_ir_nodes.dart |
| @@ -587,6 +587,7 @@ class Refinement extends Primitive { |
| /// to simplify code generation for type tests. |
| class TypeTest extends Primitive { |
| Reference<Primitive> value; |
| + |
|
Kevin Millikin (Google)
2015/10/07 14:10:49
Not sure why there's a space here (there isn't one
sra1
2015/10/07 17:45:57
Done.
|
| final DartType dartType; |
| /// If [type] is an [InterfaceType], this holds the internal representation of |
|
Kevin Millikin (Google)
2015/10/07 14:10:49
Hmm, [type] in the doc comment didn't get renamed
sra1
2015/10/07 17:45:58
Done.
|
| @@ -602,11 +603,13 @@ class TypeTest extends Primitive { |
| /// Otherwise the list is empty. |
| final List<Reference<Primitive>> typeArguments; |
| + Reference<Primitive> interceptor; |
|
Kevin Millikin (Google)
2015/10/07 14:10:49
Needs some documentation: how do I interpret a non
sra1
2015/10/07 17:45:58
Done.
|
| + |
| TypeTest(Primitive value, |
| this.dartType, |
| List<Primitive> typeArguments) |
| - : this.value = new Reference<Primitive>(value), |
| - this.typeArguments = _referenceList(typeArguments); |
| + : this.value = new Reference<Primitive>(value), |
| + this.typeArguments = _referenceList(typeArguments); |
| accept(Visitor visitor) => visitor.visitTypeTest(this); |
| @@ -614,6 +617,22 @@ class TypeTest extends Primitive { |
| bool get isSafeForReordering => true; |
| } |
| +/// An "is" type test for a raw type, performed by testing a flag property. |
| +/// |
| +/// Returns `true` if [interceptor] is for [dartType]. |
| +class TypeTestViaFlag extends Primitive { |
| + Reference<Primitive> interceptor; |
| + final DartType dartType; |
| + |
| + TypeTestViaFlag(Primitive interceptor, this.dartType) |
| + : this.interceptor = new Reference<Primitive>(interceptor); |
| + |
| + accept(Visitor visitor) => visitor.visitTypeTestViaFlag(this); |
| + |
| + bool get isSafeForElimination => true; |
| + bool get isSafeForReordering => true; |
| +} |
| + |
| /// An "as" type cast. |
| /// |
| /// If [value] is `null` or is an instance of [type], [continuation] is invoked |
| @@ -1371,6 +1390,7 @@ abstract class Visitor<T> { |
| T visitTypeExpression(TypeExpression node); |
| T visitCreateInvocationMirror(CreateInvocationMirror node); |
| T visitTypeTest(TypeTest node); |
| + T visitTypeTestViaFlag(TypeTestViaFlag node); |
| T visitApplyBuiltinOperator(ApplyBuiltinOperator node); |
| T visitApplyBuiltinMethod(ApplyBuiltinMethod node); |
| T visitGetLength(GetLength node); |
| @@ -1496,9 +1516,16 @@ class LeafVisitor implements Visitor { |
| visitTypeTest(TypeTest node) { |
| processTypeTest(node); |
| processReference(node.value); |
| + if (node.interceptor != null) processReference(node.interceptor); |
| node.typeArguments.forEach(processReference); |
| } |
| + processTypeTestViaFlag(TypeTestViaFlag node) {} |
| + visitTypeTestViaFlag(TypeTestViaFlag node) { |
| + processTypeTestViaFlag(node); |
| + processReference(node.interceptor); |
| + } |
| + |
| processSetMutable(SetMutable node) {} |
| visitSetMutable(SetMutable node) { |
| processSetMutable(node); |