| 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 part of ssa; | 5 part of ssa; |
| 6 | 6 |
| 7 class SsaFunctionCompiler implements FunctionCompiler { |
| 8 SsaCodeGeneratorTask generator; |
| 9 SsaBuilderTask builder; |
| 10 SsaOptimizerTask optimizer; |
| 11 |
| 12 SsaFunctionCompiler(JavaScriptBackend backend) |
| 13 : generator = new SsaCodeGeneratorTask(backend), |
| 14 builder = new SsaBuilderTask(backend), |
| 15 optimizer = new SsaOptimizerTask(backend); |
| 16 |
| 17 /// Generates JavaScript code for `work.element`. |
| 18 /// Using the ssa builder, optimizer and codegenerator. |
| 19 js.Fun compile(CodegenWorkItem work) { |
| 20 HGraph graph = builder.build(work); |
| 21 optimizer.optimize(work, graph); |
| 22 return generator.generateCode(work, graph); |
| 23 } |
| 24 |
| 25 Iterable<CompilerTask> get tasks { |
| 26 return <CompilerTask>[builder, optimizer, generator]; |
| 27 } |
| 28 } |
| 29 |
| 7 /// A synthetic local variable only used with the SSA graph. | 30 /// A synthetic local variable only used with the SSA graph. |
| 8 /// | 31 /// |
| 9 /// For instance used for holding return value of function or the exception of a | 32 /// For instance used for holding return value of function or the exception of a |
| 10 /// try-catch statement. | 33 /// try-catch statement. |
| 11 class SyntheticLocal extends Local { | 34 class SyntheticLocal extends Local { |
| 12 final String name; | 35 final String name; |
| 13 final ExecutableElement executableContext; | 36 final ExecutableElement executableContext; |
| 14 | 37 |
| 15 SyntheticLocal(this.name, this.executableContext); | 38 SyntheticLocal(this.name, this.executableContext); |
| 16 } | 39 } |
| (...skipping 6552 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6569 if (unaliased is TypedefType) throw 'unable to unalias $type'; | 6592 if (unaliased is TypedefType) throw 'unable to unalias $type'; |
| 6570 unaliased.accept(this, builder); | 6593 unaliased.accept(this, builder); |
| 6571 } | 6594 } |
| 6572 | 6595 |
| 6573 void visitDynamicType(DynamicType type, SsaBuilder builder) { | 6596 void visitDynamicType(DynamicType type, SsaBuilder builder) { |
| 6574 JavaScriptBackend backend = builder.compiler.backend; | 6597 JavaScriptBackend backend = builder.compiler.backend; |
| 6575 ClassElement cls = backend.findHelper('DynamicRuntimeType'); | 6598 ClassElement cls = backend.findHelper('DynamicRuntimeType'); |
| 6576 builder.push(new HDynamicType(type, new TypeMask.exact(cls, classWorld))); | 6599 builder.push(new HDynamicType(type, new TypeMask.exact(cls, classWorld))); |
| 6577 } | 6600 } |
| 6578 } | 6601 } |
| OLD | NEW |