| 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 2500 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2511 addIndented('}\n'); // Close 'switch'. | 2511 addIndented('}\n'); // Close 'switch'. |
| 2512 setup.add(' }\n'); | 2512 setup.add(' }\n'); |
| 2513 } | 2513 } |
| 2514 | 2514 |
| 2515 bool visitAndOrInfo(HAndOrBlockInformation info) => false; | 2515 bool visitAndOrInfo(HAndOrBlockInformation info) => false; |
| 2516 bool visitIfInfo(HIfBlockInformation info) => false; | 2516 bool visitIfInfo(HIfBlockInformation info) => false; |
| 2517 bool visitLoopInfo(HLoopBlockInformation info) => false; | 2517 bool visitLoopInfo(HLoopBlockInformation info) => false; |
| 2518 bool visitTryInfo(HTryBlockInformation info) => false; | 2518 bool visitTryInfo(HTryBlockInformation info) => false; |
| 2519 bool visitSequenceInfo(HStatementSequenceInformation info) => false; | 2519 bool visitSequenceInfo(HStatementSequenceInformation info) => false; |
| 2520 | 2520 |
| 2521 // For instructions that reference a guard or a check, we change that» | 2521 // If argument is a [HCheck] and it does not have a name, we try to |
| 2522 // reference to the instruction they guard against. Therefore, we must» | 2522 // find the name of its checked input. Note that there must be a |
| 2523 // use that instruction when restoring the environment.» | 2523 // name, otherwise the instruction would not be in the live |
| 2524 // environment. |
| 2524 HInstruction unwrap(argument) { | 2525 HInstruction unwrap(argument) { |
| 2525 while (argument is HCheck) argument = argument.checkedInput;» | 2526 while (argument is HCheck && !variableNames.hasName(argument)) { |
| 2527 argument = argument.checkedInput; |
| 2528 } |
| 2529 assert(variableNames.hasName(argument)); |
| 2526 return argument; | 2530 return argument; |
| 2527 } | 2531 } |
| 2528 | 2532 |
| 2529 void visitTypeGuard(HTypeGuard node) { | 2533 void visitTypeGuard(HTypeGuard node) { |
| 2530 indent--; | 2534 indent--; |
| 2531 addIndented('case ${node.state}:\n'); | 2535 addIndented('case ${node.state}:\n'); |
| 2532 indent++; | 2536 indent++; |
| 2533 addIndented('state = 0;\n'); | 2537 addIndented('state = 0;\n'); |
| 2534 | 2538 |
| 2535 setup.add(' case ${node.state}:\n'); | 2539 setup.add(' case ${node.state}:\n'); |
| (...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2688 startBailoutSwitch(); | 2692 startBailoutSwitch(); |
| 2689 } | 2693 } |
| 2690 } | 2694 } |
| 2691 | 2695 |
| 2692 void endLabeledBlock(HLabeledBlockInformation labeledBlockInfo) { | 2696 void endLabeledBlock(HLabeledBlockInformation labeledBlockInfo) { |
| 2693 if (labeledBlockInfo.body.start.hasGuards()) { | 2697 if (labeledBlockInfo.body.start.hasGuards()) { |
| 2694 endBailoutSwitch(); | 2698 endBailoutSwitch(); |
| 2695 } | 2699 } |
| 2696 } | 2700 } |
| 2697 } | 2701 } |
| OLD | NEW |