| 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 1119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1130 } | 1130 } |
| 1131 | 1131 |
| 1132 void emitAssignment(String destination, String source) { | 1132 void emitAssignment(String destination, String source) { |
| 1133 assignVariable(destination, new js.VariableUse(source)); | 1133 assignVariable(destination, new js.VariableUse(source)); |
| 1134 } | 1134 } |
| 1135 | 1135 |
| 1136 /** | 1136 /** |
| 1137 * Sequentialize a list of conceptually parallel copies. Parallel | 1137 * Sequentialize a list of conceptually parallel copies. Parallel |
| 1138 * copies may contain cycles, that this method breaks. | 1138 * copies may contain cycles, that this method breaks. |
| 1139 */ | 1139 */ |
| 1140 void sequentializeCopies(List<Copy> copies, | 1140 void sequentializeCopies(Iterable<Copy> copies, |
| 1141 String tempName, | 1141 String tempName, |
| 1142 void doAssignment(String target, String source)) { | 1142 void doAssignment(String target, String source)) { |
| 1143 // Map to keep track of the current location (ie the variable that | 1143 // Map to keep track of the current location (ie the variable that |
| 1144 // holds the initial value) of a variable. | 1144 // holds the initial value) of a variable. |
| 1145 Map<String, String> currentLocation = new Map<String, String>(); | 1145 Map<String, String> currentLocation = new Map<String, String>(); |
| 1146 | 1146 |
| 1147 // Map to keep track of the initial value of a variable. | 1147 // Map to keep track of the initial value of a variable. |
| 1148 Map<String, String> initialValue = new Map<String, String>(); | 1148 Map<String, String> initialValue = new Map<String, String>(); |
| 1149 | 1149 |
| 1150 // List of variables to assign a value. | 1150 // List of variables to assign a value. |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1213 ready.add(current); | 1213 ready.add(current); |
| 1214 } | 1214 } |
| 1215 } | 1215 } |
| 1216 } | 1216 } |
| 1217 | 1217 |
| 1218 void assignPhisOfSuccessors(HBasicBlock node) { | 1218 void assignPhisOfSuccessors(HBasicBlock node) { |
| 1219 CopyHandler handler = variableNames.getCopyHandler(node); | 1219 CopyHandler handler = variableNames.getCopyHandler(node); |
| 1220 if (handler == null) return; | 1220 if (handler == null) return; |
| 1221 | 1221 |
| 1222 // Map the instructions to strings. | 1222 // Map the instructions to strings. |
| 1223 List<Copy> copies = handler.copies.mappedBy((Copy copy) { | 1223 Iterable<Copy> copies = handler.copies.mappedBy((Copy copy) { |
| 1224 return new Copy(variableNames.getName(copy.source), | 1224 return new Copy(variableNames.getName(copy.source), |
| 1225 variableNames.getName(copy.destination)); | 1225 variableNames.getName(copy.destination)); |
| 1226 }); | 1226 }); |
| 1227 | 1227 |
| 1228 sequentializeCopies(copies, variableNames.getSwapTemp(), emitAssignment); | 1228 sequentializeCopies(copies, variableNames.getSwapTemp(), emitAssignment); |
| 1229 | 1229 |
| 1230 for (Copy copy in handler.assignments) { | 1230 for (Copy copy in handler.assignments) { |
| 1231 String name = variableNames.getName(copy.destination); | 1231 String name = variableNames.getName(copy.destination); |
| 1232 use(copy.source); | 1232 use(copy.source); |
| 1233 assignVariable(name, pop()); | 1233 assignVariable(name, pop()); |
| (...skipping 1867 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3101 if (leftType.canBeNull() && rightType.canBeNull()) { | 3101 if (leftType.canBeNull() && rightType.canBeNull()) { |
| 3102 if (left.isConstantNull() || right.isConstantNull() || | 3102 if (left.isConstantNull() || right.isConstantNull() || |
| 3103 (leftType.isPrimitive() && leftType == rightType)) { | 3103 (leftType.isPrimitive() && leftType == rightType)) { |
| 3104 return '=='; | 3104 return '=='; |
| 3105 } | 3105 } |
| 3106 return null; | 3106 return null; |
| 3107 } else { | 3107 } else { |
| 3108 return '==='; | 3108 return '==='; |
| 3109 } | 3109 } |
| 3110 } | 3110 } |
| OLD | NEW |