| 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 518 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 529 name = "this"; | 529 name = "this"; |
| 530 } else if (input is HParameterValue) { | 530 } else if (input is HParameterValue) { |
| 531 HParameterValue parameter = input; | 531 HParameterValue parameter = input; |
| 532 name = parameterNames[parameter.element]; | 532 name = parameterNames[parameter.element]; |
| 533 } else { | 533 } else { |
| 534 assert(!input.generateAtUseSite()); | 534 assert(!input.generateAtUseSite()); |
| 535 name = temporary(input); | 535 name = temporary(input); |
| 536 } | 536 } |
| 537 code = code.replaceAll('\$$i', name); | 537 code = code.replaceAll('\$$i', name); |
| 538 } | 538 } |
| 539 buffer.add('($code)'); | 539 if (node.generateAtUseSite()) { |
| 540 buffer.add('($code)'); |
| 541 } else { |
| 542 buffer.add('$code'); |
| 543 } |
| 540 } | 544 } |
| 541 | 545 |
| 542 visitForeignNew(HForeignNew node) { | 546 visitForeignNew(HForeignNew node) { |
| 543 String jsClassReference = compiler.namer.isolateAccess(node.element); | 547 String jsClassReference = compiler.namer.isolateAccess(node.element); |
| 544 buffer.add('new $jsClassReference('); | 548 buffer.add('new $jsClassReference('); |
| 545 // We can't use 'visitArguments', since our arguments start at input[0]. | 549 // We can't use 'visitArguments', since our arguments start at input[0]. |
| 546 List<HInstruction> inputs = node.inputs; | 550 List<HInstruction> inputs = node.inputs; |
| 547 for (int i = 0; i < inputs.length; i++) { | 551 for (int i = 0; i < inputs.length; i++) { |
| 548 if (i != 0) buffer.add(', '); | 552 if (i != 0) buffer.add(', '); |
| 549 use(inputs[i]); | 553 use(inputs[i]); |
| (...skipping 595 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1145 startBailoutSwitch(); | 1149 startBailoutSwitch(); |
| 1146 } | 1150 } |
| 1147 } | 1151 } |
| 1148 | 1152 |
| 1149 void endElse(HIf node) { | 1153 void endElse(HIf node) { |
| 1150 if (node.elseBlock.hasBailouts()) { | 1154 if (node.elseBlock.hasBailouts()) { |
| 1151 endBailoutSwitch(); | 1155 endBailoutSwitch(); |
| 1152 } | 1156 } |
| 1153 } | 1157 } |
| 1154 } | 1158 } |
| OLD | NEW |