Chromium Code Reviews| Index: lib/compiler/implementation/ssa/codegen.dart |
| diff --git a/lib/compiler/implementation/ssa/codegen.dart b/lib/compiler/implementation/ssa/codegen.dart |
| index 94c13c606302476eb09f8abc939e83d83bd85821..59bee92119f6ab817aa728209247a639ee661146 100644 |
| --- a/lib/compiler/implementation/ssa/codegen.dart |
| +++ b/lib/compiler/implementation/ssa/codegen.dart |
| @@ -1397,10 +1397,34 @@ class SsaCodeGenerator implements HVisitor, HBlockInformationVisitor { |
| visitNot(HNot node) { |
| assert(node.inputs.length == 1); |
| - beginExpression(JSPrecedence.PREFIX_PRECEDENCE); |
| - buffer.add('!'); |
| - use(node.inputs[0], JSPrecedence.PREFIX_PRECEDENCE); |
| - endExpression(JSPrecedence.PREFIX_PRECEDENCE); |
| + HInstruction input = node.inputs[0]; |
| + if (input is HBoolify && isGenerateAtUseSite(input)) { |
| + beginExpression(JSPrecedence.EQUALITY_PRECEDENCE); |
| + assert(node.inputs.length == 1); |
| + use(node.inputs[0], JSPrecedence.EQUALITY_PRECEDENCE); |
| + buffer.add(' !== true'); |
| + endExpression(JSPrecedence.EQUALITY_PRECEDENCE); |
| + } else if (input is HRelational && |
| + input.builtin && |
| + isGenerateAtUseSite(input)) { |
| + Map<String, String> inverseOperator = const <String>{ |
| + "==" : "!=", |
| + "!=" : "==", |
| + "===": "!==", |
| + "!==": "===", |
| + "<" : ">=", |
| + "<=" : ">", |
| + ">" : "<=", |
| + ">=" : "<" |
| + }; |
| + visitInvokeBinary(input, |
|
sra1
2012/05/08 17:47:52
I can't tell from the code, do the preconditions e
Lasse Reichstein Nielsen
2012/05/09 20:13:25
Well spotted. No, it's not excluded. I'll have to
|
| + inverseOperator[input.operation.name.stringValue]); |
| + } else { |
| + beginExpression(JSPrecedence.PREFIX_PRECEDENCE); |
| + buffer.add('!'); |
| + use(input, JSPrecedence.PREFIX_PRECEDENCE); |
| + endExpression(JSPrecedence.PREFIX_PRECEDENCE); |
| + } |
| } |
| visitParameterValue(HParameterValue node) { |