Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, 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 SsaBuilderTask extends CompilerTask { | 5 class SsaBuilderTask extends CompilerTask { |
| 6 SsaBuilderTask(Compiler compiler) : super(compiler); | 6 SsaBuilderTask(Compiler compiler) : super(compiler); |
| 7 String get name() => 'SSA builder'; | 7 String get name() => 'SSA builder'; |
| 8 | 8 |
| 9 HGraph build(Node tree, Map<Node, Element> elements) { | 9 HGraph build(Node tree, Map<Node, Element> elements) { |
| 10 return measure(() { | 10 return measure(() { |
| (...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 213 block = null; | 213 block = null; |
| 214 } else { | 214 } else { |
| 215 block = joinBlock; | 215 block = joinBlock; |
| 216 if (thenBlockJoined && elseBlockJoined) { | 216 if (thenBlockJoined && elseBlockJoined) { |
| 217 thenExitBlock.addGoto(graph, joinBlock); | 217 thenExitBlock.addGoto(graph, joinBlock); |
| 218 if (hasElse) elseExitBlock.addGoto(graph, joinBlock); | 218 if (hasElse) elseExitBlock.addGoto(graph, joinBlock); |
| 219 definitions = | 219 definitions = |
| 220 joinDefinitions(joinBlock, thenDefinitions, elseDefinitions); | 220 joinDefinitions(joinBlock, thenDefinitions, elseDefinitions); |
| 221 } else if (thenBlockJoined) { | 221 } else if (thenBlockJoined) { |
| 222 thenExitBlock.addGoto(graph, joinBlock); | 222 thenExitBlock.addGoto(graph, joinBlock); |
| 223 } else if (elseBlockJoined) { | 223 } else if (elseBlockJoined && hasElse) { |
| 224 elseExitBlock.addGoto(graph, joinBlock); | 224 elseExitBlock.addGoto(graph, joinBlock); |
| 225 } | 225 } |
| 226 } | 226 } |
| 227 } | 227 } |
| 228 | 228 |
| 229 SourceString unquote(LiteralString literal) { | 229 SourceString unquote(LiteralString literal) { |
| 230 String str = '${literal.value}'; | 230 String str = '${literal.value}'; |
| 231 compiler.ensure(str[0] == '@'); | 231 compiler.ensure(str[0] == '@'); |
| 232 int quotes = 1; | 232 int quotes = 1; |
| 233 String quote = str[1]; | 233 String quote = str[1]; |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 318 visitReturn(Return node) { | 318 visitReturn(Return node) { |
| 319 visit(node.expression); | 319 visit(node.expression); |
| 320 var value = pop(); | 320 var value = pop(); |
| 321 add(new HReturn(value)); | 321 add(new HReturn(value)); |
| 322 graph.setSuccessors(block, <HBasicBlock>[graph.exit]); | 322 graph.setSuccessors(block, <HBasicBlock>[graph.exit]); |
| 323 // A return aborts the building of the current block. | 323 // A return aborts the building of the current block. |
| 324 block = null; | 324 block = null; |
| 325 } | 325 } |
| 326 | 326 |
| 327 visitThrow(Throw node) { | 327 visitThrow(Throw node) { |
| 328 compiler.unimplemented("SsaBuilder.visitThrow"); | 328 visit(node.expression); |
|
ngeoffray
2011/11/10 13:22:37
Note that expression may be null.
floitsch
2011/11/10 14:02:22
Done.
| |
| 329 add(new HThrow(pop())); | |
| 330 // A throw aborts the building of the current block. | |
| 331 block = null; | |
| 329 } | 332 } |
| 330 | 333 |
| 331 visitTypeAnnotation(TypeAnnotation node) { | 334 visitTypeAnnotation(TypeAnnotation node) { |
| 332 // We currently ignore type annotations for generating code. | 335 // We currently ignore type annotations for generating code. |
| 333 } | 336 } |
| 334 | 337 |
| 335 HInstruction updateDefinition(SendSet node) { | 338 HInstruction updateDefinition(SendSet node) { |
| 336 if (node.receiver != null) { | 339 if (node.receiver != null) { |
| 337 compiler.unimplemented("SsaBuilder: property access"); | 340 compiler.unimplemented("SsaBuilder: property access"); |
| 338 } | 341 } |
| (...skipping 12 matching lines...) Expand all Loading... | |
| 351 if (definition is Identifier) { | 354 if (definition is Identifier) { |
| 352 compiler.unimplemented( | 355 compiler.unimplemented( |
| 353 "SsaBuilder.visitVariableDefinitions without initial value"); | 356 "SsaBuilder.visitVariableDefinitions without initial value"); |
| 354 } else { | 357 } else { |
| 355 assert(definition is SendSet); | 358 assert(definition is SendSet); |
| 356 updateDefinition(definition); | 359 updateDefinition(definition); |
| 357 } | 360 } |
| 358 } | 361 } |
| 359 } | 362 } |
| 360 } | 363 } |
| OLD | NEW |