| 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 450 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 461 } | 461 } |
| 462 | 462 |
| 463 void declareVariable(String variableName) { | 463 void declareVariable(String variableName) { |
| 464 if (isGeneratingExpression()) { | 464 if (isGeneratingExpression()) { |
| 465 if (generationState == STATE_FIRST_DECLARATION) { | 465 if (generationState == STATE_FIRST_DECLARATION) { |
| 466 generationState = STATE_DECLARATION; | 466 generationState = STATE_DECLARATION; |
| 467 if (!isVariableDeclared(variableName)) { | 467 if (!isVariableDeclared(variableName)) { |
| 468 declaredVariables.add(variableName); | 468 declaredVariables.add(variableName); |
| 469 buffer.add("var "); | 469 buffer.add("var "); |
| 470 } | 470 } |
| 471 } else if (!isGeneratingDeclaration() | 471 } else if (!isVariableDeclared(variableName)) { |
| 472 && !isVariableDeclared(variableName)) { | 472 if (!isGeneratingDeclaration()) { |
| 473 delayedVariablesDeclaration.add(variableName); | 473 delayedVariablesDeclaration.add(variableName); |
| 474 } else { |
| 475 declaredVariables.add(variableName); |
| 476 } |
| 474 } | 477 } |
| 475 } else if (!isVariableDeclared(variableName)) { | 478 } else if (!isVariableDeclared(variableName)) { |
| 476 declaredVariables.add(variableName); | 479 declaredVariables.add(variableName); |
| 477 buffer.add("var "); | 480 buffer.add("var "); |
| 478 } | 481 } |
| 479 buffer.add(variableName); | 482 buffer.add(variableName); |
| 480 } | 483 } |
| 481 | 484 |
| 482 void declareInstruction(HInstruction instruction) { | 485 void declareInstruction(HInstruction instruction) { |
| 483 declareVariable(variableNames.getName(instruction)); | 486 declareVariable(variableNames.getName(instruction)); |
| (...skipping 2011 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2495 startBailoutSwitch(); | 2498 startBailoutSwitch(); |
| 2496 } | 2499 } |
| 2497 } | 2500 } |
| 2498 | 2501 |
| 2499 void endLabeledBlock(HLabeledBlockInformation labeledBlockInfo) { | 2502 void endLabeledBlock(HLabeledBlockInformation labeledBlockInfo) { |
| 2500 if (labeledBlockInfo.body.start.hasGuards()) { | 2503 if (labeledBlockInfo.body.start.hasGuards()) { |
| 2501 endBailoutSwitch(); | 2504 endBailoutSwitch(); |
| 2502 } | 2505 } |
| 2503 } | 2506 } |
| 2504 } | 2507 } |
| OLD | NEW |