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..a6ec43c938d1f5312d50ff27d16ba4895b76db2a 100644 |
| --- a/lib/compiler/implementation/ssa/codegen.dart |
| +++ b/lib/compiler/implementation/ssa/codegen.dart |
| @@ -1397,9 +1397,35 @@ class SsaCodeGenerator implements HVisitor, HBlockInformationVisitor { |
| visitNot(HNot node) { |
| assert(node.inputs.length == 1); |
| + 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); |
| + return; |
|
ngeoffray
2012/05/08 09:27:24
I prefer else if than return.
Lasse Reichstein Nielsen
2012/05/08 10:03:33
Done.
|
| + } |
| + if (input is HRelational && |
| + input.builtin && |
| + isGenerateAtUseSite(input)) { |
| + Map<String, String> inverseOperator = const <String>{ |
| + "==" : "!=", |
| + "!=" : "==", |
| + "===": "!==", |
| + "!==": "===", |
| + "<" : ">=", |
| + "<=" : ">", |
| + ">" : "<=", |
| + ">=" : "<" |
| + }; |
| + visitInvokeBinary(input, |
| + inverseOperator[input.operation.name.stringValue]); |
| + return; |
|
ngeoffray
2012/05/08 09:27:24
ditto.
Lasse Reichstein Nielsen
2012/05/08 10:03:33
Done.
|
| + } |
| beginExpression(JSPrecedence.PREFIX_PRECEDENCE); |
| buffer.add('!'); |
| - use(node.inputs[0], JSPrecedence.PREFIX_PRECEDENCE); |
| + use(input, JSPrecedence.PREFIX_PRECEDENCE); |
| endExpression(JSPrecedence.PREFIX_PRECEDENCE); |
| } |