| 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 class SsaCodeGeneratorTask extends CompilerTask { | 5 class SsaCodeGeneratorTask extends CompilerTask { |
| 6 final JavaScriptBackend backend; | 6 final JavaScriptBackend backend; |
| 7 SsaCodeGeneratorTask(JavaScriptBackend backend) | 7 SsaCodeGeneratorTask(JavaScriptBackend backend) |
| 8 : this.backend = backend, | 8 : this.backend = backend, |
| 9 super(backend.compiler); | 9 super(backend.compiler); |
| 10 String get name() => 'SSA code generator'; | 10 String get name() => 'SSA code generator'; |
| (...skipping 1057 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1068 } | 1068 } |
| 1069 } | 1069 } |
| 1070 | 1070 |
| 1071 // Check if we have a cycle. | 1071 // Check if we have a cycle. |
| 1072 String current = worklist.removeLast(); | 1072 String current = worklist.removeLast(); |
| 1073 // If [current] is used as a source, and the assignment has been | 1073 // If [current] is used as a source, and the assignment has been |
| 1074 // done, we are done with this variable. Otherwise there is a | 1074 // done, we are done with this variable. Otherwise there is a |
| 1075 // cycle that we break by using a temporary name. | 1075 // cycle that we break by using a temporary name. |
| 1076 if (currentLocation[current] !== null | 1076 if (currentLocation[current] !== null |
| 1077 && current != currentLocation[initialValue[current]]) { | 1077 && current != currentLocation[initialValue[current]]) { |
| 1078 String tempName = VariableNames.SWAP_TEMP; | 1078 String tempName = variableNames.swapTemp; |
| 1079 emitAssignment(tempName, current); | 1079 emitAssignment(tempName, current); |
| 1080 currentLocation[current] = tempName; | 1080 currentLocation[current] = tempName; |
| 1081 // [current] can now be safely updated. Copies of [current] | 1081 // [current] can now be safely updated. Copies of [current] |
| 1082 // will now use [tempName]. | 1082 // will now use [tempName]. |
| 1083 ready.add(current); | 1083 ready.add(current); |
| 1084 } | 1084 } |
| 1085 } | 1085 } |
| 1086 } | 1086 } |
| 1087 | 1087 |
| 1088 void assignPhisOfSuccessors(HBasicBlock node) { | 1088 void assignPhisOfSuccessors(HBasicBlock node) { |
| (...skipping 1584 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2673 startBailoutSwitch(); | 2673 startBailoutSwitch(); |
| 2674 } | 2674 } |
| 2675 } | 2675 } |
| 2676 | 2676 |
| 2677 void endLabeledBlock(HLabeledBlockInformation labeledBlockInfo) { | 2677 void endLabeledBlock(HLabeledBlockInformation labeledBlockInfo) { |
| 2678 if (labeledBlockInfo.body.start.hasGuards()) { | 2678 if (labeledBlockInfo.body.start.hasGuards()) { |
| 2679 endBailoutSwitch(); | 2679 endBailoutSwitch(); |
| 2680 } | 2680 } |
| 2681 } | 2681 } |
| 2682 } | 2682 } |
| OLD | NEW |