| 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 426 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 437 indent--; | 437 indent--; |
| 438 | 438 |
| 439 if (node.finallyBlock != successors[1]) { | 439 if (node.finallyBlock != successors[1]) { |
| 440 // Printing the catch part. | 440 // Printing the catch part. |
| 441 addIndentation(); | 441 addIndentation(); |
| 442 String name = temporary(node.exception); | 442 String name = temporary(node.exception); |
| 443 parameterNames[node.exception.element] = name; | 443 parameterNames[node.exception.element] = name; |
| 444 buffer.add('} catch ($name) {\n'); | 444 buffer.add('} catch ($name) {\n'); |
| 445 indent++; | 445 indent++; |
| 446 addIndentation(); | 446 addIndentation(); |
| 447 buffer.add('$name = $name.dartException;\n'); | |
| 448 visitBasicBlock(successors[1]); | 447 visitBasicBlock(successors[1]); |
| 449 parameterNames.remove(node.exception.element); | 448 parameterNames.remove(node.exception.element); |
| 450 indent--; | 449 indent--; |
| 451 } | 450 } |
| 452 | 451 |
| 453 if (node.finallyBlock != null) { | 452 if (node.finallyBlock != null) { |
| 454 addIndentation(); | 453 addIndentation(); |
| 455 buffer.add('} finally {\n'); | 454 buffer.add('} finally {\n'); |
| 456 indent++; | 455 indent++; |
| 457 visitBasicBlock(node.finallyBlock); | 456 visitBasicBlock(node.finallyBlock); |
| (...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 710 use(node.inputs[0], JSPrecedence.EXPRESSION_PRECEDENCE); | 709 use(node.inputs[0], JSPrecedence.EXPRESSION_PRECEDENCE); |
| 711 buffer.add(';\n'); | 710 buffer.add(';\n'); |
| 712 } | 711 } |
| 713 } | 712 } |
| 714 | 713 |
| 715 visitThis(HThis node) { | 714 visitThis(HThis node) { |
| 716 buffer.add('this'); | 715 buffer.add('this'); |
| 717 } | 716 } |
| 718 | 717 |
| 719 visitThrow(HThrow node) { | 718 visitThrow(HThrow node) { |
| 720 generateThrowWithHelper('captureStackTrace', node.inputs[0]); | 719 if (node.isRethrow) { |
| 720 buffer.add('throw '); |
| 721 use(node.inputs[0], JSPrecedence.EXPRESSION_PRECEDENCE); |
| 722 } else { |
| 723 generateThrowWithHelper('captureStackTrace', node.inputs[0]); |
| 724 } |
| 721 buffer.add(';\n'); | 725 buffer.add(';\n'); |
| 722 } | 726 } |
| 723 | 727 |
| 724 visitBoundsCheck(HBoundsCheck node) { | 728 visitBoundsCheck(HBoundsCheck node) { |
| 725 buffer.add('if ('); | 729 buffer.add('if ('); |
| 726 use(node.index, JSPrecedence.RELATIONAL_PRECEDENCE); | 730 use(node.index, JSPrecedence.RELATIONAL_PRECEDENCE); |
| 727 buffer.add(' < 0 || '); | 731 buffer.add(' < 0 || '); |
| 728 use(node.index, JSPrecedence.RELATIONAL_PRECEDENCE); | 732 use(node.index, JSPrecedence.RELATIONAL_PRECEDENCE); |
| 729 buffer.add(' >= '); | 733 buffer.add(' >= '); |
| 730 use(node.length, JSPrecedence.SHIFT_PRECEDENCE); | 734 use(node.length, JSPrecedence.SHIFT_PRECEDENCE); |
| (...skipping 612 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1343 startBailoutSwitch(); | 1347 startBailoutSwitch(); |
| 1344 } | 1348 } |
| 1345 } | 1349 } |
| 1346 | 1350 |
| 1347 void endElse(HIf node) { | 1351 void endElse(HIf node) { |
| 1348 if (node.elseBlock.hasBailouts()) { | 1352 if (node.elseBlock.hasBailouts()) { |
| 1349 endBailoutSwitch(); | 1353 endBailoutSwitch(); |
| 1350 } | 1354 } |
| 1351 } | 1355 } |
| 1352 } | 1356 } |
| OLD | NEW |