Chromium Code Reviews| Index: pkg/compiler/lib/src/cps_ir/constant_propagation.dart |
| diff --git a/pkg/compiler/lib/src/cps_ir/constant_propagation.dart b/pkg/compiler/lib/src/cps_ir/constant_propagation.dart |
| index daadc5be55bc3d349502d3a5fd014ee564c18977..fcf5c1b8bb482cf7e31a748ef1afb5b0aba3b3a2 100644 |
| --- a/pkg/compiler/lib/src/cps_ir/constant_propagation.dart |
| +++ b/pkg/compiler/lib/src/cps_ir/constant_propagation.dart |
| @@ -607,7 +607,23 @@ class _ConstPropagationVisitor extends Visitor { |
| // JavaScript specific nodes. |
| void visitIdentical(Identical node) { |
| - setValue(node, _ConstnessLattice.NonConst); |
| + _ConstnessLattice leftConst = getValue(node.left.definition); |
|
karlklose
2014/11/26 08:16:00
Indentation is correct, the highlighting hides the
|
| + _ConstnessLattice rightConst = getValue(node.left.definition); |
| + ConstantValue leftValue = leftConst.constant; |
| + ConstantValue rightValue = rightConst.constant; |
| + if (leftConst.isUnknown || rightConst.isUnknown) { |
| + // Come back later. |
| + return; |
| + } else if (!leftConst.isConstant || !rightConst.isConstant) { |
| + setValue(node, _ConstnessLattice.NonConst); |
| + } else if (leftValue.isPrimitive && rightValue.isPrimitive) { |
| + assert(leftConst.isConstant && rightConst.isConstant); |
| + PrimitiveConstantValue left = leftValue; |
| + PrimitiveConstantValue right = rightValue; |
| + ConstantValue result = |
| + new BoolConstantValue(left.primitiveValue == right.primitiveValue); |
| + setValue(node, new _ConstnessLattice(result)); |
| + } |
| } |
| } |