| OLD | NEW |
| 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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 /// Generate code using the cps-based IR pipeline. | 5 /// Generate code using the cps-based IR pipeline. |
| 6 library code_generator_task; | 6 library code_generator_task; |
| 7 | 7 |
| 8 import 'glue.dart'; | 8 import 'glue.dart'; |
| 9 import 'codegen.dart'; | 9 import 'codegen.dart'; |
| 10 import 'unsugar.dart'; | 10 import 'unsugar.dart'; |
| (...skipping 14 matching lines...) Expand all Loading... |
| 25 import '../../tree_ir/tree_ir_builder.dart' as tree_builder; | 25 import '../../tree_ir/tree_ir_builder.dart' as tree_builder; |
| 26 import '../../dart_backend/backend_ast_emitter.dart' as backend_ast_emitter; | 26 import '../../dart_backend/backend_ast_emitter.dart' as backend_ast_emitter; |
| 27 import '../../cps_ir/optimizers.dart'; | 27 import '../../cps_ir/optimizers.dart'; |
| 28 import '../../tracer.dart'; | 28 import '../../tracer.dart'; |
| 29 import '../../js_backend/codegen/codegen.dart'; | 29 import '../../js_backend/codegen/codegen.dart'; |
| 30 import '../../ssa/ssa.dart' as ssa; | 30 import '../../ssa/ssa.dart' as ssa; |
| 31 import '../../tree_ir/optimization/optimization.dart'; | 31 import '../../tree_ir/optimization/optimization.dart'; |
| 32 import '../../cps_ir/cps_ir_nodes_sexpr.dart'; | 32 import '../../cps_ir/cps_ir_nodes_sexpr.dart'; |
| 33 import 'js_tree_builder.dart'; | 33 import 'js_tree_builder.dart'; |
| 34 | 34 |
| 35 class CspFunctionCompiler implements FunctionCompiler { | 35 class CpsFunctionCompiler implements FunctionCompiler { |
| 36 final IrBuilderTask irBuilderTask; | 36 final IrBuilderTask irBuilderTask; |
| 37 final ConstantSystem constantSystem; | 37 final ConstantSystem constantSystem; |
| 38 final Compiler compiler; | 38 final Compiler compiler; |
| 39 final Glue glue; | 39 final Glue glue; |
| 40 | 40 |
| 41 TypeSystem types; | 41 TypeSystem types; |
| 42 | 42 |
| 43 // TODO(karlklose,sigurm): remove and update dart-doc of [compile]. | 43 // TODO(karlklose,sigurm): remove and update dart-doc of [compile]. |
| 44 final FunctionCompiler fallbackCompiler; | 44 final FunctionCompiler fallbackCompiler; |
| 45 | 45 |
| 46 Tracer get tracer => compiler.tracer; | 46 Tracer get tracer => compiler.tracer; |
| 47 | 47 |
| 48 CspFunctionCompiler(Compiler compiler, JavaScriptBackend backend) | 48 CpsFunctionCompiler(Compiler compiler, JavaScriptBackend backend) |
| 49 : irBuilderTask = new IrBuilderTask(compiler), | 49 : irBuilderTask = new IrBuilderTask(compiler), |
| 50 fallbackCompiler = new ssa.SsaFunctionCompiler(backend, true), | 50 fallbackCompiler = new ssa.SsaFunctionCompiler(backend, true), |
| 51 constantSystem = backend.constantSystem, | 51 constantSystem = backend.constantSystem, |
| 52 compiler = compiler, | 52 compiler = compiler, |
| 53 glue = new Glue(compiler); | 53 glue = new Glue(compiler); |
| 54 | 54 |
| 55 String get name => 'CPS Ir pipeline'; | 55 String get name => 'CPS Ir pipeline'; |
| 56 | 56 |
| 57 /// Generates JavaScript code for `work.element`. First tries to use the | 57 /// Generates JavaScript code for `work.element`. First tries to use the |
| 58 /// Cps Ir -> tree ir -> js pipeline, and if that fails due to language | 58 /// Cps Ir -> tree ir -> js pipeline, and if that fails due to language |
| (...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 233 endSourcePosition = | 233 endSourcePosition = |
| 234 new TokenSourceFileLocation(sourceFile, endToken, name); | 234 new TokenSourceFileLocation(sourceFile, endToken, name); |
| 235 } | 235 } |
| 236 return node.withPosition(sourcePosition, endSourcePosition); | 236 return node.withPosition(sourcePosition, endSourcePosition); |
| 237 } | 237 } |
| 238 | 238 |
| 239 SourceFile sourceFileOfElement(Element element) { | 239 SourceFile sourceFileOfElement(Element element) { |
| 240 return element.implementation.compilationUnit.script.file; | 240 return element.implementation.compilationUnit.script.file; |
| 241 } | 241 } |
| 242 } | 242 } |
| OLD | NEW |