Chromium Code Reviews| 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 9af57d76aab70d0f984a30e2e7aae83defd00a4a..d649d8c2d77a4ab56031e6865c76acda2268e95c 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>[] { |
| @@ -971,7 +986,7 @@ abstract class HInstruction implements Spannable { |
| } |
| /** |
| - * Type of the unstruction. |
| + * Type of the instruction. |
| */ |
| TypeMask instructionType; |
| @@ -2824,8 +2839,6 @@ class HTryBlockInformation implements HStatementInformation { |
| visitor.visitTryInfo(this); |
| } |
| - |
| - |
| class HSwitchBlockInformation implements HStatementInformation { |
| final HExpressionInformation expression; |
| final List<HStatementInformation> statements; |
| @@ -2847,3 +2860,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 typeArguments, |
|
Johnni Winther
2013/12/03 10:33:16
typeArguments -> typeArgument.
ahe
2013/12/05 14:24:23
Done.
|
| + TypeMask instructionType) |
| + : hasReceiver = false, |
| + super(<HInstruction>[typeArguments], 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; |
| +} |