Chromium Code Reviews| Index: lib/compiler/implementation/ssa/nodes.dart |
| diff --git a/lib/compiler/implementation/ssa/nodes.dart b/lib/compiler/implementation/ssa/nodes.dart |
| index 81fe9e4854c84e7a1a9e627fc09684de6e2af008..5a316fbfab1d52e574bde8fde1c085f1d6ddcfa2 100644 |
| --- a/lib/compiler/implementation/ssa/nodes.dart |
| +++ b/lib/compiler/implementation/ssa/nodes.dart |
| @@ -178,26 +178,6 @@ class HGraph { |
| return result; |
| } |
| - HConstant addConstantInt(int i) { |
|
ngeoffray
2012/09/05 11:20:36
I would keep these helpers, and pass the backend o
floitsch
2012/09/05 16:12:01
Kept them, but they want the constantSystem.
|
| - return addConstant(new IntConstant(i)); |
| - } |
| - |
| - HConstant addConstantDouble(double d) { |
| - return addConstant(new DoubleConstant(d)); |
| - } |
| - |
| - HConstant addConstantString(DartString str, Node node) { |
| - return addConstant(new StringConstant(str, node)); |
| - } |
| - |
| - HConstant addConstantBool(bool value) { |
| - return addConstant(new BoolConstant(value)); |
| - } |
| - |
| - HConstant addConstantNull() { |
| - return addConstant(new NullConstant()); |
| - } |
| - |
| void finalize() { |
| addBlock(exit); |
| exit.open(); |
| @@ -1515,7 +1495,7 @@ class HInvokeBinary extends HInvokeStatic { |
| HInstruction get left => inputs[1]; |
| HInstruction get right => inputs[2]; |
| - abstract BinaryOperation get operation; |
| + abstract BinaryOperation operation(ConstantSystem constantSystem); |
| abstract isBuiltin(HTypeMap types); |
| } |
| @@ -1576,7 +1556,7 @@ class HBinaryArithmetic extends HInvokeBinary { |
| } |
| // TODO(1603): The class should be marked as abstract. |
| - abstract BinaryOperation get operation; |
| + abstract BinaryOperation operation(ConstantSystem constantSystem); |
| } |
| class HAdd extends HBinaryArithmetic { |
| @@ -1584,7 +1564,8 @@ class HAdd extends HBinaryArithmetic { |
| : super(target, left, right); |
| accept(HVisitor visitor) => visitor.visitAdd(this); |
| - AddOperation get operation => const AddOperation(); |
| + BinaryOperation operation(ConstantSystem constantSystem) |
| + => constantSystem.add; |
| int typeCode() => HInstruction.ADD_TYPECODE; |
| bool typeEquals(other) => other is HAdd; |
| bool dataEquals(HInstruction other) => true; |
| @@ -1607,7 +1588,8 @@ class HDivide extends HBinaryArithmetic { |
| return super.computeDesiredTypeForNonTargetInput(input, types); |
| } |
| - DivideOperation get operation => const DivideOperation(); |
| + BinaryOperation operation(ConstantSystem constantSystem) |
| + => constantSystem.divide; |
| int typeCode() => HInstruction.DIVIDE_TYPECODE; |
| bool typeEquals(other) => other is HDivide; |
| bool dataEquals(HInstruction other) => true; |
| @@ -1618,7 +1600,8 @@ class HModulo extends HBinaryArithmetic { |
| : super(target, left, right); |
| accept(HVisitor visitor) => visitor.visitModulo(this); |
| - ModuloOperation get operation => const ModuloOperation(); |
| + BinaryOperation operation(ConstantSystem constantSystem) |
| + => constantSystem.modulo; |
| int typeCode() => HInstruction.MODULO_TYPECODE; |
| bool typeEquals(other) => other is HModulo; |
| bool dataEquals(HInstruction other) => true; |
| @@ -1629,7 +1612,8 @@ class HMultiply extends HBinaryArithmetic { |
| : super(target, left, right); |
| accept(HVisitor visitor) => visitor.visitMultiply(this); |
| - MultiplyOperation get operation => const MultiplyOperation(); |
| + BinaryOperation operation(ConstantSystem operations) |
| + => operations.multiply; |
| int typeCode() => HInstruction.MULTIPLY_TYPECODE; |
| bool typeEquals(other) => other is HMultiply; |
| bool dataEquals(HInstruction other) => true; |
| @@ -1640,7 +1624,8 @@ class HSubtract extends HBinaryArithmetic { |
| : super(target, left, right); |
| accept(HVisitor visitor) => visitor.visitSubtract(this); |
| - SubtractOperation get operation => const SubtractOperation(); |
| + BinaryOperation operation(ConstantSystem constantSystem) |
| + => constantSystem.subtract; |
| int typeCode() => HInstruction.SUBTRACT_TYPECODE; |
| bool typeEquals(other) => other is HSubtract; |
| bool dataEquals(HInstruction other) => true; |
| @@ -1674,8 +1659,8 @@ class HTruncatingDivide extends HBinaryArithmetic { |
| : super(target, left, right); |
| accept(HVisitor visitor) => visitor.visitTruncatingDivide(this); |
| - TruncatingDivideOperation get operation |
| - => const TruncatingDivideOperation(); |
| + BinaryOperation operation(ConstantSystem constantSystem) |
| + => constantSystem.truncatingDivide; |
| int typeCode() => HInstruction.TRUNCATING_DIVIDE_TYPECODE; |
| bool typeEquals(other) => other is HTruncatingDivide; |
| bool dataEquals(HInstruction other) => true; |
| @@ -1731,7 +1716,8 @@ class HShiftLeft extends HBinaryBitOp { |
| return count >= 0 && count <= 31; |
| } |
| - ShiftLeftOperation get operation => const ShiftLeftOperation(); |
| + BinaryOperation operation(ConstantSystem constantSystem) |
| + => constantSystem.shiftLeft; |
| int typeCode() => HInstruction.SHIFT_LEFT_TYPECODE; |
| bool typeEquals(other) => other is HShiftLeft; |
| bool dataEquals(HInstruction other) => true; |
| @@ -1745,7 +1731,8 @@ class HShiftRight extends HBinaryBitOp { |
| // Shift right cannot be mapped to the native operator easily. |
| bool isBuiltin(HTypeMap types) => false; |
| - ShiftRightOperation get operation => const ShiftRightOperation(); |
| + BinaryOperation operation(ConstantSystem constantSystem) |
| + => constantSystem.shiftRight; |
| int typeCode() => HInstruction.SHIFT_RIGHT_TYPECODE; |
| bool typeEquals(other) => other is HShiftRight; |
| bool dataEquals(HInstruction other) => true; |
| @@ -1756,7 +1743,8 @@ class HBitOr extends HBinaryBitOp { |
| : super(target, left, right); |
| accept(HVisitor visitor) => visitor.visitBitOr(this); |
| - BitOrOperation get operation => const BitOrOperation(); |
| + BinaryOperation operation(ConstantSystem constantSystem) |
| + => constantSystem.bitOr; |
| int typeCode() => HInstruction.BIT_OR_TYPECODE; |
| bool typeEquals(other) => other is HBitOr; |
| bool dataEquals(HInstruction other) => true; |
| @@ -1767,7 +1755,8 @@ class HBitAnd extends HBinaryBitOp { |
| : super(target, left, right); |
| accept(HVisitor visitor) => visitor.visitBitAnd(this); |
| - BitAndOperation get operation => const BitAndOperation(); |
| + BinaryOperation operation(ConstantSystem constantSystem) |
| + => constantSystem.bitAnd; |
| int typeCode() => HInstruction.BIT_AND_TYPECODE; |
| bool typeEquals(other) => other is HBitAnd; |
| bool dataEquals(HInstruction other) => true; |
| @@ -1778,7 +1767,8 @@ class HBitXor extends HBinaryBitOp { |
| : super(target, left, right); |
| accept(HVisitor visitor) => visitor.visitBitXor(this); |
| - BitXorOperation get operation => const BitXorOperation(); |
| + BinaryOperation operation(ConstantSystem constantSystem) |
| + => constantSystem.bitXor; |
| int typeCode() => HInstruction.BIT_XOR_TYPECODE; |
| bool typeEquals(other) => other is HBitXor; |
| bool dataEquals(HInstruction other) => true; |
| @@ -1823,14 +1813,15 @@ class HInvokeUnary extends HInvokeStatic { |
| HType computeLikelyType(HTypeMap types) => HType.NUMBER; |
| - abstract UnaryOperation get operation; |
| + abstract UnaryOperation operation(ConstantSystem constantSystem); |
| } |
| 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(ConstantSystem constantSystem) |
| + => constantSystem.negate; |
| int typeCode() => HInstruction.NEGATE_TYPECODE; |
| bool typeEquals(other) => other is HNegate; |
| bool dataEquals(HInstruction other) => true; |
| @@ -1858,7 +1849,8 @@ class HBitNot extends HInvokeUnary { |
| return HType.UNKNOWN; |
| } |
| - BitNotOperation get operation => const BitNotOperation(); |
| + UnaryOperation operation(ConstantSystem constantSystem) |
| + => constantSystem.bitNot; |
| int typeCode() => HInstruction.BIT_NOT_TYPECODE; |
| bool typeEquals(other) => other is HBitNot; |
| bool dataEquals(HInstruction other) => true; |
| @@ -2157,7 +2149,7 @@ class HRelational extends HInvokeBinary { |
| bool isBuiltin(HTypeMap types) |
| => left.isNumber(types) && right.isNumber(types); |
| // TODO(1603): the class should be marked as abstract. |
| - abstract BinaryOperation get operation; |
| + abstract BinaryOperation operation(ConstantSystem constantSystem); |
| } |
| class HEquals extends HRelational { |
| @@ -2206,7 +2198,8 @@ class HEquals extends HRelational { |
| return HType.UNKNOWN; |
| } |
| - EqualsOperation get operation => const EqualsOperation(); |
| + BinaryOperation operation(ConstantSystem constantSystem) |
| + => constantSystem.equal; |
| int typeCode() => HInstruction.EQUALS_TYPECODE; |
| bool typeEquals(other) => other is HEquals; |
| bool dataEquals(HInstruction other) => true; |
| @@ -2226,7 +2219,8 @@ class HIdentity extends HRelational { |
| HType computeDesiredTypeForInput(HInstruction input, HTypeMap types) |
| => HType.UNKNOWN; |
| - IdentityOperation get operation => const IdentityOperation(); |
| + BinaryOperation operation(ConstantSystem constantSystem) |
| + => constantSystem.identity; |
| int typeCode() => HInstruction.IDENTITY_TYPECODE; |
| bool typeEquals(other) => other is HIdentity; |
| bool dataEquals(HInstruction other) => true; |
| @@ -2237,7 +2231,8 @@ class HGreater extends HRelational { |
| : super(target, left, right); |
| accept(HVisitor visitor) => visitor.visitGreater(this); |
| - GreaterOperation get operation => const GreaterOperation(); |
| + BinaryOperation operation(ConstantSystem constantSystem) |
| + => constantSystem.greater; |
| int typeCode() => HInstruction.GREATER_TYPECODE; |
| bool typeEquals(other) => other is HGreater; |
| bool dataEquals(HInstruction other) => true; |
| @@ -2248,7 +2243,8 @@ class HGreaterEqual extends HRelational { |
| : super(target, left, right); |
| accept(HVisitor visitor) => visitor.visitGreaterEqual(this); |
| - GreaterEqualOperation get operation => const GreaterEqualOperation(); |
| + BinaryOperation operation(ConstantSystem constantSystem) |
| + => constantSystem.greaterEqual; |
| int typeCode() => HInstruction.GREATER_EQUAL_TYPECODE; |
| bool typeEquals(other) => other is HGreaterEqual; |
| bool dataEquals(HInstruction other) => true; |
| @@ -2259,7 +2255,8 @@ class HLess extends HRelational { |
| : super(target, left, right); |
| accept(HVisitor visitor) => visitor.visitLess(this); |
| - LessOperation get operation => const LessOperation(); |
| + BinaryOperation operation(ConstantSystem constantSystem) |
| + => constantSystem.less; |
| int typeCode() => HInstruction.LESS_TYPECODE; |
| bool typeEquals(other) => other is HLess; |
| bool dataEquals(HInstruction other) => true; |
| @@ -2270,7 +2267,8 @@ class HLessEqual extends HRelational { |
| : super(target, left, right); |
| accept(HVisitor visitor) => visitor.visitLessEqual(this); |
| - LessEqualOperation get operation => const LessEqualOperation(); |
| + BinaryOperation operation(ConstantSystem constantSystem) |
| + => constantSystem.lessEqual; |
| int typeCode() => HInstruction.LESS_EQUAL_TYPECODE; |
| bool typeEquals(other) => other is HLessEqual; |
| bool dataEquals(HInstruction other) => true; |