| Index: lib/compiler/implementation/ssa/nodes.dart
|
| diff --git a/lib/compiler/implementation/ssa/nodes.dart b/lib/compiler/implementation/ssa/nodes.dart
|
| index 57827cd6308ede8189374692ed557e396b42f5a4..f05c8d4b7294d0031424140b0ec68bcd11b0a3d6 100644
|
| --- a/lib/compiler/implementation/ssa/nodes.dart
|
| +++ b/lib/compiler/implementation/ssa/nodes.dart
|
| @@ -758,6 +758,40 @@ class HInstruction implements Hashable {
|
| // Other flags.
|
| static final int FLAG_USE_GVN = FLAG_DEPENDS_ON_SOMETHING + 1;
|
|
|
| + // Type codes.
|
| + static final int UNDEFINED_TYPECODE = -1;
|
| + static final int BOOLIFY_TYPECODE = 0;
|
| + static final int TYPE_GUARD_TYPECODE = 1;
|
| + static final int BOUNDS_CHECK_TYPECODE = 2;
|
| + static final int INTEGER_CHECK_TYPECODE = 3;
|
| + static final int INVOKE_INTERCEPTOR_TYPECODE = 4;
|
| + static final int ADD_TYPECODE = 5;
|
| + static final int DIVIDE_TYPECODE = 6;
|
| + static final int MODULO_TYPECODE = 7;
|
| + static final int MULTIPLY_TYPECODE = 8;
|
| + static final int SUBTRACT_TYPECODE = 9;
|
| + static final int TRUNCATING_DIVIDE_TYPECODE = 10;
|
| + static final int SHIFT_LEFT_TYPECODE = 11;
|
| + static final int SHIFT_RIGHT_TYPECODE = 12;
|
| + static final int BIT_OR_TYPECODE = 13;
|
| + static final int BIT_AND_TYPECODE = 14;
|
| + static final int BIT_XOR_TYPECODE = 15;
|
| + static final int NEGATE_TYPECODE = 16;
|
| + static final int BIT_NOT_TYPECODE = 17;
|
| + static final int NOT_TYPECODE = 18;
|
| + static final int EQUALS_TYPECODE = 19;
|
| + static final int IDENTITY_TYPECODE = 20;
|
| + static final int GREATER_TYPECODE = 21;
|
| + static final int GREATER_EQUAL_TYPECODE = 22;
|
| + static final int LESS_TYPECODE = 23;
|
| + static final int LESS_EQUAL_TYPECODE = 24;
|
| + static final int STATIC_TYPECODE = 25;
|
| + static final int STATIC_STORE_TYPECODE = 26;
|
| + static final int FIELD_GET_TYPECODE = 27;
|
| + static final int TYPE_CONVERSION_TYPECODE = 28;
|
| + static final int BAILOUT_TARGET_TYPECODE = 29;
|
| + static final int INVOKE_STATIC_TYPECODE = 30;
|
| +
|
| HInstruction(this.inputs)
|
| : id = idCounter++,
|
| usedBy = <HInstruction>[];
|
| @@ -890,7 +924,7 @@ class HInstruction implements Hashable {
|
|
|
| // These methods should be overwritten by instructions that
|
| // participate in global value numbering.
|
| - int typeCode() => -1;
|
| + int typeCode() => HInstruction.UNDEFINED_TYPECODE;
|
| bool typeEquals(HInstruction other) => false;
|
| bool dataEquals(HInstruction other) => false;
|
|
|
| @@ -1056,7 +1090,7 @@ class HBoolify extends HInstruction {
|
| HType get guaranteedType => HType.BOOLEAN;
|
|
|
| accept(HVisitor visitor) => visitor.visitBoolify(this);
|
| - int typeCode() => 0;
|
| + int typeCode() => HInstruction.BOOLIFY_TYPECODE;
|
| bool typeEquals(other) => other is HBoolify;
|
| bool dataEquals(HInstruction other) => true;
|
| }
|
| @@ -1091,7 +1125,7 @@ class HBailoutTarget extends HInstruction {
|
| bool isStatement(HTypeMap types) => isEnabled;
|
|
|
| accept(HVisitor visitor) => visitor.visitBailoutTarget(this);
|
| - int typeCode() => 29;
|
| + int typeCode() => HInstruction.BAILOUT_TARGET_TYPECODE;
|
| bool typeEquals(other) => other is HBailoutTarget;
|
| bool dataEquals(HBailoutTarget other) => other.state == state;
|
| }
|
| @@ -1119,7 +1153,7 @@ class HTypeGuard extends HCheck {
|
| bool isStatement(HTypeMap types) => isEnabled;
|
|
|
| accept(HVisitor visitor) => visitor.visitTypeGuard(this);
|
| - int typeCode() => 1;
|
| + int typeCode() => HInstruction.TYPE_GUARD_TYPECODE;
|
| bool typeEquals(other) => other is HTypeGuard;
|
| bool dataEquals(HTypeGuard other) => guardedType == other.guardedType;
|
| }
|
| @@ -1144,7 +1178,7 @@ class HBoundsCheck extends HCheck {
|
| HType get guaranteedType => HType.INTEGER;
|
|
|
| accept(HVisitor visitor) => visitor.visitBoundsCheck(this);
|
| - int typeCode() => 2;
|
| + int typeCode() => HInstruction.BOUNDS_CHECK_TYPECODE;
|
| bool typeEquals(other) => other is HBoundsCheck;
|
| bool dataEquals(HInstruction other) => true;
|
| }
|
| @@ -1168,7 +1202,7 @@ class HIntegerCheck extends HCheck {
|
| }
|
|
|
| accept(HVisitor visitor) => visitor.visitIntegerCheck(this);
|
| - int typeCode() => 3;
|
| + int typeCode() => HInstruction.INTEGER_CHECK_TYPECODE;
|
| bool typeEquals(other) => other is HIntegerCheck;
|
| bool dataEquals(HInstruction other) => true;
|
| }
|
| @@ -1255,9 +1289,6 @@ class HInvokeDynamicSetter extends HInvokeDynamicField {
|
| }
|
|
|
| class HInvokeStatic extends HInvoke {
|
| - static final int INVOKE_INTERCEPTOR_TYPECODE = 4;
|
| - static final int INVOKE_STATIC_TYPECODE = 30;
|
| -
|
| /** The first input must be the target. */
|
| HInvokeStatic(inputs, [HType knownType = HType.UNKNOWN]) : super(inputs) {
|
| guaranteedType = knownType;
|
| @@ -1265,7 +1296,7 @@ class HInvokeStatic extends HInvoke {
|
|
|
| toString() => 'invoke static: ${element.name}';
|
| accept(HVisitor visitor) => visitor.visitInvokeStatic(this);
|
| - int typeCode() => INVOKE_STATIC_TYPECODE;
|
| + int typeCode() => HInstruction.INVOKE_STATIC_TYPECODE;
|
| Element get element => target.element;
|
| HStatic get target => inputs[0];
|
|
|
| @@ -1354,7 +1385,7 @@ class HInvokeInterceptor extends HInvokeStatic {
|
| }
|
| }
|
|
|
| - int typeCode() => HInvokeStatic.INVOKE_INTERCEPTOR_TYPECODE;
|
| + int typeCode() => HInstruction.INVOKE_INTERCEPTOR_TYPECODE;
|
| bool typeEquals(other) => other is HInvokeInterceptor;
|
| bool dataEquals(HInvokeInterceptor other) {
|
| return getter == other.getter && name == other.name;
|
| @@ -1397,7 +1428,7 @@ class HFieldGet extends HFieldAccess {
|
| if (!isFinalOrConst) setDependsOnSomething();
|
| }
|
|
|
| - int typeCode() => 27;
|
| + int typeCode() => HInstruction.FIELD_GET_TYPECODE;
|
| bool typeEquals(other) => other is HFieldGet;
|
| bool dataEquals(HFieldGet other) => element == other.element;
|
| String toString() => "FieldGet ${element == null ? fieldName : element}";
|
| @@ -1573,7 +1604,7 @@ class HAdd extends HBinaryArithmetic {
|
| accept(HVisitor visitor) => visitor.visitAdd(this);
|
|
|
| AddOperation get operation => const AddOperation();
|
| - int typeCode() => 5;
|
| + int typeCode() => HInstruction.ADD_TYPECODE;
|
| bool typeEquals(other) => other is HAdd;
|
| bool dataEquals(HInstruction other) => true;
|
| }
|
| @@ -1596,7 +1627,7 @@ class HDivide extends HBinaryArithmetic {
|
| }
|
|
|
| DivideOperation get operation => const DivideOperation();
|
| - int typeCode() => 6;
|
| + int typeCode() => HInstruction.DIVIDE_TYPECODE;
|
| bool typeEquals(other) => other is HDivide;
|
| bool dataEquals(HInstruction other) => true;
|
| }
|
| @@ -1607,7 +1638,7 @@ class HModulo extends HBinaryArithmetic {
|
| accept(HVisitor visitor) => visitor.visitModulo(this);
|
|
|
| ModuloOperation get operation => const ModuloOperation();
|
| - int typeCode() => 7;
|
| + int typeCode() => HInstruction.MODULO_TYPECODE;
|
| bool typeEquals(other) => other is HModulo;
|
| bool dataEquals(HInstruction other) => true;
|
| }
|
| @@ -1618,7 +1649,7 @@ class HMultiply extends HBinaryArithmetic {
|
| accept(HVisitor visitor) => visitor.visitMultiply(this);
|
|
|
| MultiplyOperation get operation => const MultiplyOperation();
|
| - int typeCode() => 8;
|
| + int typeCode() => HInstruction.MULTIPLY_TYPECODE;
|
| bool typeEquals(other) => other is HMultiply;
|
| bool dataEquals(HInstruction other) => true;
|
| }
|
| @@ -1629,7 +1660,7 @@ class HSubtract extends HBinaryArithmetic {
|
| accept(HVisitor visitor) => visitor.visitSubtract(this);
|
|
|
| SubtractOperation get operation => const SubtractOperation();
|
| - int typeCode() => 9;
|
| + int typeCode() => HInstruction.SUBTRACT_TYPECODE;
|
| bool typeEquals(other) => other is HSubtract;
|
| bool dataEquals(HInstruction other) => true;
|
| }
|
| @@ -1664,7 +1695,7 @@ class HTruncatingDivide extends HBinaryArithmetic {
|
|
|
| TruncatingDivideOperation get operation
|
| => const TruncatingDivideOperation();
|
| - int typeCode() => 10;
|
| + int typeCode() => HInstruction.TRUNCATING_DIVIDE_TYPECODE;
|
| bool typeEquals(other) => other is HTruncatingDivide;
|
| bool dataEquals(HInstruction other) => true;
|
| }
|
| @@ -1720,7 +1751,7 @@ class HShiftLeft extends HBinaryBitOp {
|
| }
|
|
|
| ShiftLeftOperation get operation => const ShiftLeftOperation();
|
| - int typeCode() => 11;
|
| + int typeCode() => HInstruction.SHIFT_LEFT_TYPECODE;
|
| bool typeEquals(other) => other is HShiftLeft;
|
| bool dataEquals(HInstruction other) => true;
|
| }
|
| @@ -1734,7 +1765,7 @@ class HShiftRight extends HBinaryBitOp {
|
| bool isBuiltin(HTypeMap types) => false;
|
|
|
| ShiftRightOperation get operation => const ShiftRightOperation();
|
| - int typeCode() => 12;
|
| + int typeCode() => HInstruction.SHIFT_RIGHT_TYPECODE;
|
| bool typeEquals(other) => other is HShiftRight;
|
| bool dataEquals(HInstruction other) => true;
|
| }
|
| @@ -1745,7 +1776,7 @@ class HBitOr extends HBinaryBitOp {
|
| accept(HVisitor visitor) => visitor.visitBitOr(this);
|
|
|
| BitOrOperation get operation => const BitOrOperation();
|
| - int typeCode() => 13;
|
| + int typeCode() => HInstruction.BIT_OR_TYPECODE;
|
| bool typeEquals(other) => other is HBitOr;
|
| bool dataEquals(HInstruction other) => true;
|
| }
|
| @@ -1756,7 +1787,7 @@ class HBitAnd extends HBinaryBitOp {
|
| accept(HVisitor visitor) => visitor.visitBitAnd(this);
|
|
|
| BitAndOperation get operation => const BitAndOperation();
|
| - int typeCode() => 14;
|
| + int typeCode() => HInstruction.BIT_AND_TYPECODE;
|
| bool typeEquals(other) => other is HBitAnd;
|
| bool dataEquals(HInstruction other) => true;
|
| }
|
| @@ -1767,7 +1798,7 @@ class HBitXor extends HBinaryBitOp {
|
| accept(HVisitor visitor) => visitor.visitBitXor(this);
|
|
|
| BitXorOperation get operation => const BitXorOperation();
|
| - int typeCode() => 15;
|
| + int typeCode() => HInstruction.BIT_XOR_TYPECODE;
|
| bool typeEquals(other) => other is HBitXor;
|
| bool dataEquals(HInstruction other) => true;
|
| }
|
| @@ -1819,7 +1850,7 @@ class HNegate extends HInvokeUnary {
|
| accept(HVisitor visitor) => visitor.visitNegate(this);
|
|
|
| NegateOperation get operation => const NegateOperation();
|
| - int typeCode() => 16;
|
| + int typeCode() => HInstruction.NEGATE_TYPECODE;
|
| bool typeEquals(other) => other is HNegate;
|
| bool dataEquals(HInstruction other) => true;
|
| }
|
| @@ -1847,7 +1878,7 @@ class HBitNot extends HInvokeUnary {
|
| }
|
|
|
| BitNotOperation get operation => const BitNotOperation();
|
| - int typeCode() => 17;
|
| + int typeCode() => HInstruction.BIT_NOT_TYPECODE;
|
| bool typeEquals(other) => other is HBitNot;
|
| bool dataEquals(HInstruction other) => true;
|
| }
|
| @@ -1975,7 +2006,7 @@ class HNot extends HInstruction {
|
| }
|
|
|
| accept(HVisitor visitor) => visitor.visitNot(this);
|
| - int typeCode() => 18;
|
| + int typeCode() => HInstruction.NOT_TYPECODE;
|
| bool typeEquals(other) => other is HNot;
|
| bool dataEquals(HInstruction other) => true;
|
| }
|
| @@ -2195,7 +2226,7 @@ class HEquals extends HRelational {
|
| }
|
|
|
| EqualsOperation get operation => const EqualsOperation();
|
| - int typeCode() => 19;
|
| + int typeCode() => HInstruction.EQUALS_TYPECODE;
|
| bool typeEquals(other) => other is HEquals;
|
| bool dataEquals(HInstruction other) => true;
|
| }
|
| @@ -2215,7 +2246,7 @@ class HIdentity extends HRelational {
|
| => HType.UNKNOWN;
|
|
|
| IdentityOperation get operation => const IdentityOperation();
|
| - int typeCode() => 20;
|
| + int typeCode() => HInstruction.IDENTITY_TYPECODE;
|
| bool typeEquals(other) => other is HIdentity;
|
| bool dataEquals(HInstruction other) => true;
|
| }
|
| @@ -2226,7 +2257,7 @@ class HGreater extends HRelational {
|
| accept(HVisitor visitor) => visitor.visitGreater(this);
|
|
|
| GreaterOperation get operation => const GreaterOperation();
|
| - int typeCode() => 21;
|
| + int typeCode() => HInstruction.GREATER_TYPECODE;
|
| bool typeEquals(other) => other is HGreater;
|
| bool dataEquals(HInstruction other) => true;
|
| }
|
| @@ -2237,7 +2268,7 @@ class HGreaterEqual extends HRelational {
|
| accept(HVisitor visitor) => visitor.visitGreaterEqual(this);
|
|
|
| GreaterEqualOperation get operation => const GreaterEqualOperation();
|
| - int typeCode() => 22;
|
| + int typeCode() => HInstruction.GREATER_EQUAL_TYPECODE;
|
| bool typeEquals(other) => other is HGreaterEqual;
|
| bool dataEquals(HInstruction other) => true;
|
| }
|
| @@ -2248,7 +2279,7 @@ class HLess extends HRelational {
|
| accept(HVisitor visitor) => visitor.visitLess(this);
|
|
|
| LessOperation get operation => const LessOperation();
|
| - int typeCode() => 23;
|
| + int typeCode() => HInstruction.LESS_TYPECODE;
|
| bool typeEquals(other) => other is HLess;
|
| bool dataEquals(HInstruction other) => true;
|
| }
|
| @@ -2259,7 +2290,7 @@ class HLessEqual extends HRelational {
|
| accept(HVisitor visitor) => visitor.visitLessEqual(this);
|
|
|
| LessEqualOperation get operation => const LessEqualOperation();
|
| - int typeCode() => 24;
|
| + int typeCode() => HInstruction.LESS_EQUAL_TYPECODE;
|
| bool typeEquals(other) => other is HLessEqual;
|
| bool dataEquals(HInstruction other) => true;
|
| }
|
| @@ -2291,7 +2322,7 @@ class HStatic extends HInstruction {
|
| accept(HVisitor visitor) => visitor.visitStatic(this);
|
|
|
| int gvnHashCode() => super.gvnHashCode() ^ element.hashCode();
|
| - int typeCode() => 25;
|
| + int typeCode() => HInstruction.STATIC_TYPECODE;
|
| bool typeEquals(other) => other is HStatic;
|
| bool dataEquals(HStatic other) => element == other.element;
|
| bool isCodeMotionInvariant() => !element.isAssignable();
|
| @@ -2303,7 +2334,7 @@ class HStaticStore extends HInstruction {
|
| toString() => 'static store ${element.name}';
|
| accept(HVisitor visitor) => visitor.visitStaticStore(this);
|
|
|
| - int typeCode() => 26;
|
| + int typeCode() => HInstruction.STATIC_STORE_TYPECODE;
|
| bool typeEquals(other) => other is HStaticStore;
|
| bool dataEquals(HStaticStore other) => element == other.element;
|
| bool isStatement(HTypeMap types) => true;
|
| @@ -2444,7 +2475,7 @@ class HTypeConversion extends HCheck {
|
| bool isStatement(HTypeMap types) => kind == ARGUMENT_TYPE_CHECK;
|
| bool isControlFlow() => kind == ARGUMENT_TYPE_CHECK;
|
|
|
| - int typeCode() => 28;
|
| + int typeCode() => HInstruction.TYPE_CONVERSION_TYPECODE;
|
| bool typeEquals(HInstruction other) => other is HTypeConversion;
|
| bool dataEquals(HTypeConversion other) {
|
| return type == other.type && kind == other.kind;
|
|
|