| Index: lib/compiler/implementation/ssa/nodes.dart
|
| diff --git a/lib/compiler/implementation/ssa/nodes.dart b/lib/compiler/implementation/ssa/nodes.dart
|
| index 77b80e087fec3d1d4e154052a3886f5cdecb1f33..0f38c99282b43b673c6db0d02b79d1b4b00856c9 100644
|
| --- a/lib/compiler/implementation/ssa/nodes.dart
|
| +++ b/lib/compiler/implementation/ssa/nodes.dart
|
| @@ -1457,7 +1457,7 @@ class HInvokeBinary extends HInvokeStatic {
|
| HInstruction get left() => inputs[1];
|
| HInstruction get right() => inputs[2];
|
|
|
| - abstract BinaryOperation get operation();
|
| + abstract BinaryOperation operation(FoldingOperations foldingOperations);
|
| abstract get builtin();
|
| }
|
|
|
| @@ -1515,7 +1515,7 @@ class HBinaryArithmetic extends HInvokeBinary {
|
| }
|
|
|
| // TODO(1603): The class should be marked as abstract.
|
| - abstract BinaryOperation get operation();
|
| + abstract BinaryOperation operation(FoldingOperations foldingOperations);
|
| }
|
|
|
| class HAdd extends HBinaryArithmetic {
|
| @@ -1523,7 +1523,8 @@ class HAdd extends HBinaryArithmetic {
|
| : super(target, left, right);
|
| accept(HVisitor visitor) => visitor.visitAdd(this);
|
|
|
| - AddOperation get operation() => const AddOperation();
|
| + BinaryOperation operation(FoldingOperations foldingOperations)
|
| + => foldingOperations.add;
|
| int typeCode() => 5;
|
| bool typeEquals(other) => other is HAdd;
|
| bool dataEquals(HInstruction other) => true;
|
| @@ -1545,7 +1546,8 @@ class HDivide extends HBinaryArithmetic {
|
| return super.computeDesiredTypeForNonTargetInput(input);
|
| }
|
|
|
| - DivideOperation get operation() => const DivideOperation();
|
| + BinaryOperation operation(FoldingOperations foldingOperations)
|
| + => foldingOperations.divide;
|
| int typeCode() => 6;
|
| bool typeEquals(other) => other is HDivide;
|
| bool dataEquals(HInstruction other) => true;
|
| @@ -1556,7 +1558,8 @@ class HModulo extends HBinaryArithmetic {
|
| : super(target, left, right);
|
| accept(HVisitor visitor) => visitor.visitModulo(this);
|
|
|
| - ModuloOperation get operation() => const ModuloOperation();
|
| + BinaryOperation operation(FoldingOperations foldingOperations)
|
| + => foldingOperations.modulo;
|
| int typeCode() => 7;
|
| bool typeEquals(other) => other is HModulo;
|
| bool dataEquals(HInstruction other) => true;
|
| @@ -1567,7 +1570,8 @@ class HMultiply extends HBinaryArithmetic {
|
| : super(target, left, right);
|
| accept(HVisitor visitor) => visitor.visitMultiply(this);
|
|
|
| - MultiplyOperation get operation() => const MultiplyOperation();
|
| + BinaryOperation operation(FoldingOperations operations)
|
| + => operations.multiply;
|
| int typeCode() => 8;
|
| bool typeEquals(other) => other is HMultiply;
|
| bool dataEquals(HInstruction other) => true;
|
| @@ -1578,7 +1582,8 @@ class HSubtract extends HBinaryArithmetic {
|
| : super(target, left, right);
|
| accept(HVisitor visitor) => visitor.visitSubtract(this);
|
|
|
| - SubtractOperation get operation() => const SubtractOperation();
|
| + BinaryOperation operation(FoldingOperations foldingOperations)
|
| + => foldingOperations.subtract;
|
| int typeCode() => 9;
|
| bool typeEquals(other) => other is HSubtract;
|
| bool dataEquals(HInstruction other) => true;
|
| @@ -1612,8 +1617,8 @@ class HTruncatingDivide extends HBinaryArithmetic {
|
| : super(target, left, right);
|
| accept(HVisitor visitor) => visitor.visitTruncatingDivide(this);
|
|
|
| - TruncatingDivideOperation get operation()
|
| - => const TruncatingDivideOperation();
|
| + BinaryOperation operation(FoldingOperations foldingOperations)
|
| + => foldingOperations.truncatingDivide;
|
| int typeCode() => 10;
|
| bool typeEquals(other) => other is HTruncatingDivide;
|
| bool dataEquals(HInstruction other) => true;
|
| @@ -1667,7 +1672,8 @@ class HShiftLeft extends HBinaryBitOp {
|
| return count >= 0 && count <= 31;
|
| }
|
|
|
| - ShiftLeftOperation get operation() => const ShiftLeftOperation();
|
| + BinaryOperation operation(FoldingOperations foldingOperations)
|
| + => foldingOperations.shiftLeft;
|
| int typeCode() => 11;
|
| bool typeEquals(other) => other is HShiftLeft;
|
| bool dataEquals(HInstruction other) => true;
|
| @@ -1681,7 +1687,8 @@ class HShiftRight extends HBinaryBitOp {
|
| // Shift right cannot be mapped to the native operator easily.
|
| bool get builtin() => false;
|
|
|
| - ShiftRightOperation get operation() => const ShiftRightOperation();
|
| + BinaryOperation operation(FoldingOperations foldingOperations)
|
| + => foldingOperations.shiftRight;
|
| int typeCode() => 12;
|
| bool typeEquals(other) => other is HShiftRight;
|
| bool dataEquals(HInstruction other) => true;
|
| @@ -1692,7 +1699,8 @@ class HBitOr extends HBinaryBitOp {
|
| : super(target, left, right);
|
| accept(HVisitor visitor) => visitor.visitBitOr(this);
|
|
|
| - BitOrOperation get operation() => const BitOrOperation();
|
| + BinaryOperation operation(FoldingOperations foldingOperations)
|
| + => foldingOperations.bitOr;
|
| int typeCode() => 13;
|
| bool typeEquals(other) => other is HBitOr;
|
| bool dataEquals(HInstruction other) => true;
|
| @@ -1703,7 +1711,8 @@ class HBitAnd extends HBinaryBitOp {
|
| : super(target, left, right);
|
| accept(HVisitor visitor) => visitor.visitBitAnd(this);
|
|
|
| - BitAndOperation get operation() => const BitAndOperation();
|
| + BinaryOperation operation(FoldingOperations foldingOperations)
|
| + => foldingOperations.bitAnd;
|
| int typeCode() => 14;
|
| bool typeEquals(other) => other is HBitAnd;
|
| bool dataEquals(HInstruction other) => true;
|
| @@ -1714,7 +1723,8 @@ class HBitXor extends HBinaryBitOp {
|
| : super(target, left, right);
|
| accept(HVisitor visitor) => visitor.visitBitXor(this);
|
|
|
| - BitXorOperation get operation() => const BitXorOperation();
|
| + BinaryOperation operation(FoldingOperations foldingOperations)
|
| + => foldingOperations.bitXor;
|
| int typeCode() => 15;
|
| bool typeEquals(other) => other is HBitXor;
|
| bool dataEquals(HInstruction other) => true;
|
| @@ -1757,14 +1767,15 @@ class HInvokeUnary extends HInvokeStatic {
|
|
|
| HType get likelyType() => HType.NUMBER;
|
|
|
| - abstract UnaryOperation get operation();
|
| + abstract UnaryOperation operation(FoldingOperations foldingOperations);
|
| }
|
|
|
| class HNegate extends HInvokeUnary {
|
| HNegate(HStatic target, HInstruction input) : super(target, input);
|
| accept(HVisitor visitor) => visitor.visitNegate(this);
|
|
|
| - NegateOperation get operation() => const NegateOperation();
|
| + UnaryOperation operation(FoldingOperations foldingOperations)
|
| + => foldingOperations.negate;
|
| int typeCode() => 16;
|
| bool typeEquals(other) => other is HNegate;
|
| bool dataEquals(HInstruction other) => true;
|
| @@ -1790,7 +1801,8 @@ class HBitNot extends HInvokeUnary {
|
| return HType.UNKNOWN;
|
| }
|
|
|
| - BitNotOperation get operation() => const BitNotOperation();
|
| + UnaryOperation operation(FoldingOperations foldingOperations)
|
| + => foldingOperations.bitNot;
|
| int typeCode() => 17;
|
| bool typeEquals(other) => other is HBitNot;
|
| bool dataEquals(HInstruction other) => true;
|
| @@ -2083,7 +2095,7 @@ class HRelational extends HInvokeBinary {
|
|
|
| bool get builtin() => left.isNumber() && right.isNumber();
|
| // TODO(1603): the class should be marked as abstract.
|
| - abstract BinaryOperation get operation();
|
| + abstract BinaryOperation operation(FoldingOperations foldingOperations);
|
| }
|
|
|
| class HEquals extends HRelational {
|
| @@ -2130,7 +2142,8 @@ class HEquals extends HRelational {
|
| return HType.UNKNOWN;
|
| }
|
|
|
| - EqualsOperation get operation() => const EqualsOperation();
|
| + BinaryOperation operation(FoldingOperations foldingOperations)
|
| + => foldingOperations.equal;
|
| int typeCode() => 19;
|
| bool typeEquals(other) => other is HEquals;
|
| bool dataEquals(HInstruction other) => true;
|
| @@ -2148,7 +2161,8 @@ class HIdentity extends HRelational {
|
| // Note that the identity operator really does not care for its input types.
|
| HType computeDesiredTypeForInput(HInstruction input) => HType.UNKNOWN;
|
|
|
| - IdentityOperation get operation() => const IdentityOperation();
|
| + BinaryOperation operation(FoldingOperations foldingOperations)
|
| + => foldingOperations.identity;
|
| int typeCode() => 20;
|
| bool typeEquals(other) => other is HIdentity;
|
| bool dataEquals(HInstruction other) => true;
|
| @@ -2159,7 +2173,8 @@ class HGreater extends HRelational {
|
| : super(target, left, right);
|
| accept(HVisitor visitor) => visitor.visitGreater(this);
|
|
|
| - GreaterOperation get operation() => const GreaterOperation();
|
| + BinaryOperation operation(FoldingOperations foldingOperations)
|
| + => foldingOperations.greater;
|
| int typeCode() => 21;
|
| bool typeEquals(other) => other is HGreater;
|
| bool dataEquals(HInstruction other) => true;
|
| @@ -2170,7 +2185,8 @@ class HGreaterEqual extends HRelational {
|
| : super(target, left, right);
|
| accept(HVisitor visitor) => visitor.visitGreaterEqual(this);
|
|
|
| - GreaterEqualOperation get operation() => const GreaterEqualOperation();
|
| + BinaryOperation operation(FoldingOperations foldingOperations)
|
| + => foldingOperations.greaterEqual;
|
| int typeCode() => 22;
|
| bool typeEquals(other) => other is HGreaterEqual;
|
| bool dataEquals(HInstruction other) => true;
|
| @@ -2181,7 +2197,8 @@ class HLess extends HRelational {
|
| : super(target, left, right);
|
| accept(HVisitor visitor) => visitor.visitLess(this);
|
|
|
| - LessOperation get operation() => const LessOperation();
|
| + BinaryOperation operation(FoldingOperations foldingOperations)
|
| + => foldingOperations.less;
|
| int typeCode() => 23;
|
| bool typeEquals(other) => other is HLess;
|
| bool dataEquals(HInstruction other) => true;
|
| @@ -2192,7 +2209,8 @@ class HLessEqual extends HRelational {
|
| : super(target, left, right);
|
| accept(HVisitor visitor) => visitor.visitLessEqual(this);
|
|
|
| - LessEqualOperation get operation() => const LessEqualOperation();
|
| + BinaryOperation operation(FoldingOperations foldingOperations)
|
| + => foldingOperations.lessEqual;
|
| int typeCode() => 24;
|
| bool typeEquals(other) => other is HLessEqual;
|
| bool dataEquals(HInstruction other) => true;
|
|
|