| 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 String generate(WorkItem work, HGraph graph) { | 9 String generate(WorkItem work, HGraph graph) { |
| 10 return measure(() { | 10 return measure(() { |
| (...skipping 591 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 602 String code = '${node.code}'; | 602 String code = '${node.code}'; |
| 603 List<HInstruction> inputs = node.inputs; | 603 List<HInstruction> inputs = node.inputs; |
| 604 for (int i = 0; i < inputs.length; i++) { | 604 for (int i = 0; i < inputs.length; i++) { |
| 605 HInstruction input = inputs[i]; | 605 HInstruction input = inputs[i]; |
| 606 String name; | 606 String name; |
| 607 if (input is HThis) { | 607 if (input is HThis) { |
| 608 name = "this"; | 608 name = "this"; |
| 609 } else if (input is HParameterValue) { | 609 } else if (input is HParameterValue) { |
| 610 HParameterValue parameter = input; | 610 HParameterValue parameter = input; |
| 611 name = parameterNames[parameter.element]; | 611 name = parameterNames[parameter.element]; |
| 612 } else if (input is HLoad) { |
| 613 Hload load = input; |
| 614 name = local(input.local); |
| 612 } else { | 615 } else { |
| 613 assert(!input.generateAtUseSite()); | 616 assert(!input.generateAtUseSite()); |
| 614 name = temporary(input); | 617 name = temporary(input); |
| 615 } | 618 } |
| 616 code = code.replaceAll('\$$i', name); | 619 code = code.replaceAll('\$$i', name); |
| 617 } | 620 } |
| 618 beginExpression(JSPrecedence.EXPRESSION_PRECEDENCE); | 621 beginExpression(JSPrecedence.EXPRESSION_PRECEDENCE); |
| 619 buffer.add(code); | 622 buffer.add(code); |
| 620 endExpression(JSPrecedence.EXPRESSION_PRECEDENCE); | 623 endExpression(JSPrecedence.EXPRESSION_PRECEDENCE); |
| 621 } | 624 } |
| (...skipping 753 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1375 startBailoutSwitch(); | 1378 startBailoutSwitch(); |
| 1376 } | 1379 } |
| 1377 } | 1380 } |
| 1378 | 1381 |
| 1379 void endElse(HIf node) { | 1382 void endElse(HIf node) { |
| 1380 if (node.elseBlock.hasBailouts()) { | 1383 if (node.elseBlock.hasBailouts()) { |
| 1381 endBailoutSwitch(); | 1384 endBailoutSwitch(); |
| 1382 } | 1385 } |
| 1383 } | 1386 } |
| 1384 } | 1387 } |
| OLD | NEW |