Chromium Code Reviews| Index: frog/leg/ssa/optimize.dart |
| diff --git a/frog/leg/ssa/optimize.dart b/frog/leg/ssa/optimize.dart |
| index e6fb69f4f69c940fdbf6dddc59ad90da52dac8b4..c0cc81e620827e6ddb2c6e4b3ec4d5269d949365 100644 |
| --- a/frog/leg/ssa/optimize.dart |
| +++ b/frog/leg/ssa/optimize.dart |
| @@ -89,7 +89,7 @@ class SsaConstantFolder extends HBaseVisitor { |
| // TODO(floitsch): is String + literal a compile-time expression? If not |
| // we must pay attention not to canonicalize the concatenated string with |
| // an already existing string. |
| - if (node.left.isLiteralString() && node.right is HLiteral) { |
| + if (node.left.isString() && node.right is HLiteral) { |
|
karlklose
2012/01/06 09:58:38
Remove accidental edit.
Lasse Reichstein
2012/01/06 10:01:07
Done.
|
| // TODO(lrn): Perform concatenation in Dart. |
| } |
| return visitInvokeBinary(node); |
| @@ -99,7 +99,13 @@ class SsaConstantFolder extends HBaseVisitor { |
| if (node.left is HLiteral && node.right is HLiteral) { |
| HLiteral op1 = node.left; |
| HLiteral op2 = node.right; |
| - return new HLiteral(op1.value == op2.value, HType.BOOLEAN); |
| + if (op1.isLiteralString()) { |
| + if (op2.isLiteralString() && op1.value.definitlyEquals(op2.value)) { |
| + return new HLiteral(true, HType.BOOLEAN); |
| + } |
| + } else { |
| + return new HLiteral(op1.value == op2.value, HType.BOOLEAN); |
| + } |
| } |
| return node; |
| } |