Chromium Code Reviews| Index: frog/leg/ssa/nodes.dart |
| diff --git a/frog/leg/ssa/nodes.dart b/frog/leg/ssa/nodes.dart |
| index 9657192e0ab9f538fa21b398e125f20d321abe67..80dfedbe90cca3e83d014502b5b40efc6c163994 100644 |
| --- a/frog/leg/ssa/nodes.dart |
| +++ b/frog/leg/ssa/nodes.dart |
| @@ -1387,6 +1387,28 @@ class HAdd extends HBinaryArithmetic { |
| } |
| AddOperation get operation() => const AddOperation(); |
| + |
| + HInstruction fold(HGraph graph) { |
|
ngeoffray
2012/03/14 12:29:58
Is that dead code? There is no fold method in the
Lasse Reichstein Nielsen
2012/03/14 13:04:49
It's probably dead, just leftover of a merge that
|
| + // TODO(floitsch): move this code to the compile-time-constant handler. |
| + if (left.isConstantString() && right is HConstant) { |
| + HConstant op1 = left; |
| + HConstant op2 = right; |
| + DartString leftString = op1.constant.value; |
| + DartString otherString = null; |
| + if (right.isConstantString()) { |
| + otherString = op2.constant.value; |
| + } else { |
| + assert(op2.isConstantNumber() || |
| + op2.isConstantBoolean() || |
| + op2.isConstantNull()); |
| + otherString = new DartString.literal(op2.constant.value.toString()); |
| + } |
| + DartString cons = new DartString.concat(leftString, otherString); |
| + return graph.addConstantString(cons); |
| + } |
| + return super.fold(graph); |
| + } |
| + |
| int typeCode() => 5; |
| bool typeEquals(other) => other is HAdd; |
| bool dataEquals(HInstruction other) => true; |