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 933 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
944 currentContainer = oldContainer; | 944 currentContainer = oldContainer; |
945 body = unwrapStatement(body); | 945 body = unwrapStatement(body); |
946 loop = new js.While(jsCondition, body); | 946 loop = new js.While(jsCondition, body); |
947 } | 947 } |
948 break; | 948 break; |
949 case HLoopBlockInformation.DO_WHILE_LOOP: | 949 case HLoopBlockInformation.DO_WHILE_LOOP: |
950 if (info.initializer != null) { | 950 if (info.initializer != null) { |
951 generateStatements(info.initializer); | 951 generateStatements(info.initializer); |
952 } | 952 } |
953 js.Block oldContainer = currentContainer; | 953 js.Block oldContainer = currentContainer; |
954 js.Statement body = new js.Block.empty(); | 954 js.Block body = new js.Block.empty(); |
955 // If there are phi copies in the block that jumps to the | 955 // If there are phi copies in the block that jumps to the |
956 // loop entry, we must emit the condition like this: | 956 // loop entry, we must emit the condition like this: |
957 // do { | 957 // do { |
958 // body; | 958 // body; |
959 // if (condition) { | 959 // if (condition) { |
960 // phi updates; | 960 // phi updates; |
961 // continue; | 961 // continue; |
962 // } else { | 962 // } else { |
963 // break; | 963 // break; |
964 // } | 964 // } |
965 // } while (true); | 965 // } while (true); |
966 HBasicBlock avoidEdge = info.end.successors[0]; | 966 HBasicBlock avoidEdge = info.end.successors[0]; |
967 js.Statement updateBody = new js.Block.empty(); | 967 js.Block updateBody = new js.Block.empty(); |
968 currentContainer = updateBody; | 968 currentContainer = updateBody; |
969 assignPhisOfSuccessors(avoidEdge); | 969 assignPhisOfSuccessors(avoidEdge); |
970 bool hasPhiUpdates = !updateBody.statements.isEmpty; | 970 bool hasPhiUpdates = !updateBody.statements.isEmpty; |
971 currentContainer = body; | 971 currentContainer = body; |
972 if (hasPhiUpdates || !isConditionExpression || info.updates != null) { | 972 if (hasPhiUpdates || !isConditionExpression || info.updates != null) { |
973 wrapLoopBodyForContinue(info); | 973 wrapLoopBodyForContinue(info); |
974 } else { | 974 } else { |
975 visitBodyIgnoreLabels(info); | 975 visitBodyIgnoreLabels(info); |
976 } | 976 } |
977 if (info.updates != null) { | 977 if (info.updates != null) { |
(...skipping 2132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3110 if (leftType.canBeNull() && rightType.canBeNull()) { | 3110 if (leftType.canBeNull() && rightType.canBeNull()) { |
3111 if (left.isConstantNull() || right.isConstantNull() || | 3111 if (left.isConstantNull() || right.isConstantNull() || |
3112 (leftType.isPrimitive() && leftType == rightType)) { | 3112 (leftType.isPrimitive() && leftType == rightType)) { |
3113 return '=='; | 3113 return '=='; |
3114 } | 3114 } |
3115 return null; | 3115 return null; |
3116 } else { | 3116 } else { |
3117 return '==='; | 3117 return '==='; |
3118 } | 3118 } |
3119 } | 3119 } |
OLD | NEW |