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 SsaCodeGeneratorTask(Compiler compiler) : super(compiler); | 6 SsaCodeGeneratorTask(Compiler compiler) : super(compiler); |
7 String get name() => 'SSA code generator'; | 7 String get name() => 'SSA code generator'; |
8 | 8 |
9 | 9 |
10 String generateMethod(WorkItem work, HGraph graph) { | 10 String generateMethod(WorkItem work, HGraph graph) { |
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
165 } | 165 } |
166 | 166 |
167 String temporary(HInstruction instruction) { | 167 String temporary(HInstruction instruction) { |
168 int id = instruction.id; | 168 int id = instruction.id; |
169 String name = names[id]; | 169 String name = names[id]; |
170 if (name !== null) return name; | 170 if (name !== null) return name; |
171 | 171 |
172 if (instruction is HPhi) { | 172 if (instruction is HPhi) { |
173 HPhi phi = instruction; | 173 HPhi phi = instruction; |
174 Element element = phi.element; | 174 Element element = phi.element; |
175 if (element != null && element.kind == ElementKind.PARAMETER) { | |
176 name = parameterNames[element]; | |
177 names[id] = name; | |
178 return name; | |
179 } | |
180 | |
181 String prefix; | 175 String prefix; |
182 if (element !== null && !element.name.isEmpty()) { | 176 if (element !== null && !element.name.isEmpty()) { |
183 prefix = element.name.slowToString(); | 177 prefix = element.name.slowToString(); |
184 } else { | 178 } else { |
185 prefix = 'v'; | 179 prefix = 'v'; |
186 } | 180 } |
187 if (!prefixes.containsKey(prefix)) { | 181 if (!prefixes.containsKey(prefix)) { |
188 prefixes[prefix] = 0; | 182 prefixes[prefix] = 0; |
189 return newName(id, prefix); | 183 return newName(id, prefix); |
190 } else { | 184 } else { |
(...skipping 1370 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1561 startBailoutSwitch(); | 1555 startBailoutSwitch(); |
1562 } | 1556 } |
1563 } | 1557 } |
1564 | 1558 |
1565 void endElse(HIf node) { | 1559 void endElse(HIf node) { |
1566 if (node.elseBlock.hasGuards()) { | 1560 if (node.elseBlock.hasGuards()) { |
1567 endBailoutSwitch(); | 1561 endBailoutSwitch(); |
1568 } | 1562 } |
1569 } | 1563 } |
1570 } | 1564 } |
OLD | NEW |