| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 part of ssa; | 5 part of ssa; |
| 6 | 6 |
| 7 class SsaCodeGeneratorTask extends CompilerTask { | 7 class SsaCodeGeneratorTask extends CompilerTask { |
| 8 | 8 |
| 9 final JavaScriptBackend backend; | 9 final JavaScriptBackend backend; |
| 10 | 10 |
| (...skipping 813 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 824 currentBlockInformation = info.body.start.blockFlow.body; | 824 currentBlockInformation = info.body.start.blockFlow.body; |
| 825 generateStatements(info.body); | 825 generateStatements(info.body); |
| 826 currentBlockInformation = oldInfo; | 826 currentBlockInformation = oldInfo; |
| 827 } else { | 827 } else { |
| 828 generateStatements(info.body); | 828 generateStatements(info.body); |
| 829 } | 829 } |
| 830 } | 830 } |
| 831 | 831 |
| 832 bool visitLoopInfo(HLoopBlockInformation info) { | 832 bool visitLoopInfo(HLoopBlockInformation info) { |
| 833 HExpressionInformation condition = info.condition; | 833 HExpressionInformation condition = info.condition; |
| 834 bool isConditionExpression = condition == null || isJSCondition(condition); | 834 bool isConditionExpression = isJSCondition(condition); |
| 835 | 835 |
| 836 js.Loop loop; | 836 js.Loop loop; |
| 837 | 837 |
| 838 switch (info.kind) { | 838 switch (info.kind) { |
| 839 // Treate all three "test-first" loops the same way. | 839 // Treate all three "test-first" loops the same way. |
| 840 case HLoopBlockInformation.FOR_LOOP: | 840 case HLoopBlockInformation.FOR_LOOP: |
| 841 case HLoopBlockInformation.WHILE_LOOP: | 841 case HLoopBlockInformation.WHILE_LOOP: |
| 842 case HLoopBlockInformation.FOR_IN_LOOP: | 842 case HLoopBlockInformation.FOR_IN_LOOP: |
| 843 HBlockInformation initialization = info.initializer; | 843 HBlockInformation initialization = info.initializer; |
| 844 int initializationType = TYPE_STATEMENT; | 844 int initializationType = TYPE_STATEMENT; |
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 955 js.Statement body = new js.Block.empty(); | 955 js.Statement body = new js.Block.empty(); |
| 956 currentContainer = body; | 956 currentContainer = body; |
| 957 if (!isConditionExpression || info.updates != null) { | 957 if (!isConditionExpression || info.updates != null) { |
| 958 wrapLoopBodyForContinue(info); | 958 wrapLoopBodyForContinue(info); |
| 959 } else { | 959 } else { |
| 960 visitBodyIgnoreLabels(info); | 960 visitBodyIgnoreLabels(info); |
| 961 } | 961 } |
| 962 if (info.updates != null) { | 962 if (info.updates != null) { |
| 963 generateStatements(info.updates); | 963 generateStatements(info.updates); |
| 964 } | 964 } |
| 965 if (condition == null) { | 965 if (isConditionExpression) { |
| 966 push(newLiteralBool(false)); | |
| 967 } else if (isConditionExpression) { | |
| 968 push(generateExpression(condition)); | 966 push(generateExpression(condition)); |
| 969 } else { | 967 } else { |
| 970 generateStatements(condition); | 968 generateStatements(condition); |
| 971 use(condition.conditionExpression); | 969 use(condition.conditionExpression); |
| 972 } | 970 } |
| 973 js.Expression jsCondition = pop(); | 971 js.Expression jsCondition = pop(); |
| 974 currentContainer = oldContainer; | 972 currentContainer = oldContainer; |
| 975 body = unwrapStatement(body); | 973 body = unwrapStatement(body); |
| 976 loop = new js.Do(body, jsCondition); | 974 loop = new js.Do(body, jsCondition); |
| 977 break; | 975 break; |
| (...skipping 2125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3103 if (leftType.canBeNull() && rightType.canBeNull()) { | 3101 if (leftType.canBeNull() && rightType.canBeNull()) { |
| 3104 if (left.isConstantNull() || right.isConstantNull() || | 3102 if (left.isConstantNull() || right.isConstantNull() || |
| 3105 (leftType.isPrimitive() && leftType == rightType)) { | 3103 (leftType.isPrimitive() && leftType == rightType)) { |
| 3106 return '=='; | 3104 return '=='; |
| 3107 } | 3105 } |
| 3108 return null; | 3106 return null; |
| 3109 } else { | 3107 } else { |
| 3110 return '==='; | 3108 return '==='; |
| 3111 } | 3109 } |
| 3112 } | 3110 } |
| OLD | NEW |