| 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(FunctionElement element, TreeElements elements) { | 9 HGraph build(FunctionElement element, TreeElements elements) { |
| 10 return measure(() { | 10 return measure(() { |
| 11 FunctionExpression function = element.node; | 11 FunctionExpression function = element.node; |
| 12 HInstruction.idCounter = 0; | 12 HInstruction.idCounter = 0; |
| 13 SsaBuilder builder = new SsaBuilder(compiler, elements); | 13 SsaBuilder builder = new SsaBuilder(compiler, elements); |
| 14 HGraph graph; | 14 HGraph graph; |
| 15 switch (element.kind) { | 15 switch (element.kind) { |
| 16 case ElementKind.CONSTRUCTOR: | 16 case ElementKind.GENERATIVE_CONSTRUCTOR: |
| 17 graph = compileConstructor(builder, function, element, elements); | 17 graph = compileConstructor(builder, function, element, elements); |
| 18 break; | 18 break; |
| 19 case ElementKind.CONSTRUCTOR_BODY: | 19 case ElementKind.GENERATIVE_CONSTRUCTOR_BODY: |
| 20 graph = compileConstructorBody(builder, function, element, elements); | 20 graph = compileConstructorBody(builder, function, element, elements); |
| 21 break; | 21 break; |
| 22 case ElementKind.FUNCTION: | 22 case ElementKind.FUNCTION: |
| 23 graph = compileMethod(builder, function, element, elements); | 23 graph = compileMethod(builder, function, element, elements); |
| 24 break; | 24 break; |
| 25 } | 25 } |
| 26 assert(graph.isValid()); | 26 assert(graph.isValid()); |
| 27 if (GENERATE_SSA_TRACE) { | 27 if (GENERATE_SSA_TRACE) { |
| 28 String name; | 28 String name; |
| 29 if (element.enclosingElement !== null) { | 29 if (element.enclosingElement !== null) { |
| 30 name = "${element.enclosingElement.name}.${element.name}"; | 30 name = "${element.enclosingElement.name}.${element.name}"; |
| 31 if (element.kind == ElementKind.CONSTRUCTOR_BODY) { | 31 if (element.kind == ElementKind.GENERATIVE_CONSTRUCTOR_BODY) { |
| 32 name = "$name (body)"; | 32 name = "$name (body)"; |
| 33 } | 33 } |
| 34 } else { | 34 } else { |
| 35 name = "${element.name}"; | 35 name = "${element.name}"; |
| 36 } | 36 } |
| 37 new HTracer.singleton().traceCompilation(name); | 37 new HTracer.singleton().traceCompilation(name); |
| 38 new HTracer.singleton().traceGraph('builder', graph); | 38 new HTracer.singleton().traceGraph('builder', graph); |
| 39 } | 39 } |
| 40 return graph; | 40 return graph; |
| 41 }); | 41 }); |
| (...skipping 1048 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1090 } | 1090 } |
| 1091 | 1091 |
| 1092 visitCatchBlock(CatchBlock node) { | 1092 visitCatchBlock(CatchBlock node) { |
| 1093 compiler.unimplemented('SsaBuilder.visitCatchBlock', node: node); | 1093 compiler.unimplemented('SsaBuilder.visitCatchBlock', node: node); |
| 1094 } | 1094 } |
| 1095 | 1095 |
| 1096 visitTypedef(Typedef node) { | 1096 visitTypedef(Typedef node) { |
| 1097 compiler.unimplemented('SsaBuilder.visitTypedef', node: node); | 1097 compiler.unimplemented('SsaBuilder.visitTypedef', node: node); |
| 1098 } | 1098 } |
| 1099 } | 1099 } |
| OLD | NEW |