Index: dart/sdk/lib/_internal/compiler/implementation/ssa/nodes.dart |
diff --git a/dart/sdk/lib/_internal/compiler/implementation/ssa/nodes.dart b/dart/sdk/lib/_internal/compiler/implementation/ssa/nodes.dart |
index e13b16dc249f452ded8a400df2e156c97cc2f8f3..736ced4786c18ffb43ae58d182b3d758f36e8574 100644 |
--- a/dart/sdk/lib/_internal/compiler/implementation/ssa/nodes.dart |
+++ b/dart/sdk/lib/_internal/compiler/implementation/ssa/nodes.dart |
@@ -68,6 +68,11 @@ abstract class HVisitor<R> { |
R visitTry(HTry node); |
R visitTypeConversion(HTypeConversion node); |
R visitTypeKnown(HTypeKnown node); |
+ R visitReadTypeVariable(HReadTypeVariable node); |
+ R visitFunctionType(HFunctionType node); |
+ R visitVoidType(HVoidType node); |
+ R visitInterfaceType(HInterfaceType node); |
+ R visitDynamicType(HDynamicType node); |
} |
abstract class HGraphVisitor { |
@@ -330,6 +335,11 @@ class HBaseVisitor extends HGraphVisitor implements HVisitor { |
visitIs(HIs node) => visitInstruction(node); |
visitTypeConversion(HTypeConversion node) => visitCheck(node); |
visitTypeKnown(HTypeKnown node) => visitCheck(node); |
+ visitReadTypeVariable(HReadTypeVariable node) => visitInstruction(node); |
+ visitFunctionType(HFunctionType node) => visitInstruction(node); |
+ visitVoidType(HVoidType node) => visitInstruction(node); |
+ visitInterfaceType(HInterfaceType node) => visitInstruction(node); |
+ visitDynamicType(HDynamicType node) => visitInstruction(node); |
} |
class SubGraph { |
@@ -783,6 +793,11 @@ abstract class HInstruction implements Spannable { |
static const int IS_TYPECODE = 28; |
static const int INVOKE_DYNAMIC_TYPECODE = 29; |
static const int SHIFT_RIGHT_TYPECODE = 30; |
+ static const int READ_TYPE_VARIABLE_TYPECODE = 31; |
+ static const int FUNCTION_TYPE_TYPECODE = 32; |
+ static const int VOID_TYPE_TYPECODE = 33; |
+ static const int INTERFACE_TYPE_TYPECODE = 34; |
+ static const int DYNAMIC_TYPE_TYPECODE = 35; |
HInstruction(this.inputs, this.instructionType) |
: id = idCounter++, usedBy = <HInstruction>[] { |
@@ -966,7 +981,7 @@ abstract class HInstruction implements Spannable { |
} |
/** |
- * Type of the unstruction. |
+ * Type of the instruction. |
*/ |
TypeMask instructionType; |
@@ -2747,8 +2762,6 @@ class HTryBlockInformation implements HStatementInformation { |
visitor.visitTryInfo(this); |
} |
- |
- |
class HSwitchBlockInformation implements HStatementInformation { |
final HExpressionInformation expression; |
final List<HStatementInformation> statements; |
@@ -2770,3 +2783,111 @@ class HSwitchBlockInformation implements HStatementInformation { |
bool accept(HStatementInformationVisitor visitor) => |
visitor.visitSwitchInfo(this); |
} |
+ |
+class HReadTypeVariable extends HInstruction { |
+ /// The type variable being read. |
+ final TypeVariableType dartType; |
+ |
+ final bool hasReceiver; |
+ |
+ HReadTypeVariable(this.dartType, |
+ HInstruction receiver, |
+ TypeMask instructionType) |
+ : hasReceiver = true, |
+ super(<HInstruction>[receiver], instructionType) { |
+ setUseGvn(); |
+ } |
+ |
+ HReadTypeVariable.noReceiver(this.dartType, |
+ HInstruction typeArgument, |
+ TypeMask instructionType) |
+ : hasReceiver = false, |
+ super(<HInstruction>[typeArgument], instructionType) { |
+ setUseGvn(); |
+ } |
+ |
+ accept(HVisitor visitor) => visitor.visitReadTypeVariable(this); |
+ |
+ bool canThrow() => false; |
+ |
+ int typeCode() => HInstruction.READ_TYPE_VARIABLE_TYPECODE; |
+ bool typeEquals(HInstruction other) => other is HReadTypeVariable; |
+ |
+ bool dataEquals(HReadTypeVariable other) { |
+ return dartType.element == other.dartType.element |
+ && hasReceiver == other.hasReceiver; |
+ } |
+} |
+ |
+abstract class HRuntimeType extends HInstruction { |
+ final DartType dartType; |
+ |
+ HRuntimeType(List<HInstruction> inputs, |
+ this.dartType, |
+ TypeMask instructionType) |
+ : super(inputs, instructionType) { |
+ setUseGvn(); |
+ } |
+ |
+ bool canThrow() => false; |
+ |
+ int typeCode() { |
+ throw 'abstract method'; |
+ } |
+ |
+ bool typeEquals(HInstruction other) { |
+ throw 'abstract method'; |
+ } |
+ |
+ bool dataEquals(HRuntimeType other) { |
+ return dartType == other.dartType; |
+ } |
+} |
+ |
+class HFunctionType extends HRuntimeType { |
+ HFunctionType(List<HInstruction> inputs, |
+ FunctionType dartType, |
+ TypeMask instructionType) |
+ : super(inputs, dartType, instructionType); |
+ |
+ accept(HVisitor visitor) => visitor.visitFunctionType(this); |
+ |
+ int typeCode() => HInstruction.FUNCTION_TYPE_TYPECODE; |
+ |
+ bool typeEquals(HInstruction other) => other is HFunctionType; |
+} |
+ |
+class HVoidType extends HRuntimeType { |
+ HVoidType(VoidType dartType, TypeMask instructionType) |
+ : super(const <HInstruction>[], dartType, instructionType); |
+ |
+ accept(HVisitor visitor) => visitor.visitVoidType(this); |
+ |
+ int typeCode() => HInstruction.VOID_TYPE_TYPECODE; |
+ |
+ bool typeEquals(HInstruction other) => other is HVoidType; |
+} |
+ |
+class HInterfaceType extends HRuntimeType { |
+ HInterfaceType(List<HInstruction> inputs, |
+ InterfaceType dartType, |
+ TypeMask instructionType) |
+ : super(inputs, dartType, instructionType); |
+ |
+ accept(HVisitor visitor) => visitor.visitInterfaceType(this); |
+ |
+ int typeCode() => HInstruction.INTERFACE_TYPE_TYPECODE; |
+ |
+ bool typeEquals(HInstruction other) => other is HInterfaceType; |
+} |
+ |
+class HDynamicType extends HRuntimeType { |
+ HDynamicType(DynamicType dartType, TypeMask instructionType) |
+ : super(const <HInstruction>[], dartType, instructionType); |
+ |
+ accept(HVisitor visitor) => visitor.visitDynamicType(this); |
+ |
+ int typeCode() => HInstruction.DYNAMIC_TYPE_TYPECODE; |
+ |
+ bool typeEquals(HInstruction other) => other is HDynamicType; |
+} |