Chromium Code Reviews| 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 875 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 886 } | 886 } |
| 887 // Flow based traversal. | 887 // Flow based traversal. |
| 888 if (node.isLoopHeader() && | 888 if (node.isLoopHeader() && |
| 889 node.loopInformation.loopBlockInformation !== currentBlockInformation) { | 889 node.loopInformation.loopBlockInformation !== currentBlockInformation) { |
| 890 beginLoop(node); | 890 beginLoop(node); |
| 891 } | 891 } |
| 892 iterateBasicBlock(node); | 892 iterateBasicBlock(node); |
| 893 } | 893 } |
| 894 | 894 |
| 895 void emitAssignment(String destination, String source) { | 895 void emitAssignment(String destination, String source) { |
| 896 if (isGeneratingExpression()) { | 896 if (isGeneratingExpression()) { |
| 897 addExpressionSeparator(); | 897 addExpressionSeparator(); |
| 898 } else { | 898 } else { |
| 899 addIndentation(); | 899 addIndentation(); |
| 900 } | 900 } |
| 901 declareVariable(destination); | 901 declareVariable(destination); |
| 902 buffer.add(' = $source'); | 902 buffer.add(' = $source'); |
| 903 if (!isGeneratingExpression()) { | 903 if (!isGeneratingExpression()) { |
| 904 buffer.add(';\n'); | 904 buffer.add(';\n'); |
| 905 } | 905 } |
| 906 } | 906 } |
| (...skipping 324 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1231 | 1231 |
| 1232 visitTry(HTry node) { | 1232 visitTry(HTry node) { |
| 1233 // We should never get here. Try/catch/finally is always handled using block | 1233 // We should never get here. Try/catch/finally is always handled using block |
| 1234 // information in [visitTryInfo], or not at all, in the case of the bailout | 1234 // information in [visitTryInfo], or not at all, in the case of the bailout |
| 1235 // generator. | 1235 // generator. |
| 1236 compiler.internalError('visitTry should not be called', instruction: node); | 1236 compiler.internalError('visitTry should not be called', instruction: node); |
| 1237 } | 1237 } |
| 1238 | 1238 |
| 1239 bool isEmptyElse(HBasicBlock start, HBasicBlock end) { | 1239 bool isEmptyElse(HBasicBlock start, HBasicBlock end) { |
| 1240 if (start !== end) return false; | 1240 if (start !== end) return false; |
| 1241 if (start.last is !HGoto | 1241 if (start.last is !HGoto) { |
| 1242 || start.last is HBreak | |
| 1243 || start.last is HContinue) { | |
| 1244 return false; | 1242 return false; |
|
ngeoffray
2012/06/06 11:05:29
one line?
Lasse Reichstein Nielsen
2012/06/06 13:04:07
NEVER!
Ahem.
I'd actually rather combine it with
| |
| 1245 } | 1243 } |
| 1246 for (HInstruction instruction = start.first; | 1244 for (HInstruction instruction = start.first; |
| 1247 instruction != start.last; | 1245 instruction != start.last; |
| 1248 instruction = instruction.next) { | 1246 instruction = instruction.next) { |
| 1249 // Instructions generated at use site are okay because they do | 1247 // Instructions generated at use site are okay because they do |
| 1250 // not generate code in this else block. | 1248 // not generate code in this else block. |
| 1251 if (!isGenerateAtUseSite(instruction)) return false; | 1249 if (!isGenerateAtUseSite(instruction)) return false; |
| 1252 } | 1250 } |
| 1253 CopyHandler handler = variableNames.getCopyHandler(start); | 1251 CopyHandler handler = variableNames.getCopyHandler(start); |
| 1254 if (handler == null || handler.isEmpty()) return true; | 1252 if (handler == null || handler.isEmpty()) return true; |
| (...skipping 1262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2517 startBailoutSwitch(); | 2515 startBailoutSwitch(); |
| 2518 } | 2516 } |
| 2519 } | 2517 } |
| 2520 | 2518 |
| 2521 void endLabeledBlock(HLabeledBlockInformation labeledBlockInfo) { | 2519 void endLabeledBlock(HLabeledBlockInformation labeledBlockInfo) { |
| 2522 if (labeledBlockInfo.body.start.hasGuards()) { | 2520 if (labeledBlockInfo.body.start.hasGuards()) { |
| 2523 endBailoutSwitch(); | 2521 endBailoutSwitch(); |
| 2524 } | 2522 } |
| 2525 } | 2523 } |
| 2526 } | 2524 } |
| OLD | NEW |