Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(569)

Side by Side Diff: pkg/compiler/lib/src/js_backend/codegen/task.dart

Issue 955543004: Pass SourceInformation through the CPS IR. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Update comments Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 12 matching lines...) Expand all
23 import '../../dart_backend/backend_ast_emitter.dart' as backend_ast_emitter; 23 import '../../dart_backend/backend_ast_emitter.dart' as backend_ast_emitter;
24 import '../../cps_ir/optimizers.dart'; 24 import '../../cps_ir/optimizers.dart';
25 import '../../tracer.dart'; 25 import '../../tracer.dart';
26 import '../../js_backend/codegen/codegen.dart'; 26 import '../../js_backend/codegen/codegen.dart';
27 import '../../ssa/ssa.dart' as ssa; 27 import '../../ssa/ssa.dart' as ssa;
28 import '../../tree_ir/optimization/optimization.dart'; 28 import '../../tree_ir/optimization/optimization.dart';
29 import '../../cps_ir/cps_ir_nodes_sexpr.dart'; 29 import '../../cps_ir/cps_ir_nodes_sexpr.dart';
30 import 'js_tree_builder.dart'; 30 import 'js_tree_builder.dart';
31 31
32 class CpsFunctionCompiler implements FunctionCompiler { 32 class CpsFunctionCompiler implements FunctionCompiler {
33 final IrBuilderTask irBuilderTask;
34 final ConstantSystem constantSystem; 33 final ConstantSystem constantSystem;
35 final Compiler compiler; 34 final Compiler compiler;
36 final Glue glue; 35 final Glue glue;
37 36
38 TypeSystem types; 37 TypeSystem types;
39 38
40 // TODO(karlklose,sigurm): remove and update dart-doc of [compile]. 39 // TODO(karlklose,sigurm): remove and update dart-doc of [compile].
41 final FunctionCompiler fallbackCompiler; 40 final FunctionCompiler fallbackCompiler;
42 41
43 Tracer get tracer => compiler.tracer; 42 Tracer get tracer => compiler.tracer;
44 43
45 CpsFunctionCompiler(Compiler compiler, JavaScriptBackend backend) 44 IrBuilderTask get irBuilderTask => compiler.irBuilder;
46 : irBuilderTask = new IrBuilderTask(compiler), 45
47 fallbackCompiler = new ssa.SsaFunctionCompiler(backend, true), 46 CpsFunctionCompiler(Compiler compiler, JavaScriptBackend backend,
47 {bool generateSourceMap: true})
48 : fallbackCompiler =
49 new ssa.SsaFunctionCompiler(backend, generateSourceMap),
48 constantSystem = backend.constantSystem, 50 constantSystem = backend.constantSystem,
49 compiler = compiler, 51 compiler = compiler,
50 glue = new Glue(compiler); 52 glue = new Glue(compiler);
51 53
52 String get name => 'CPS Ir pipeline'; 54 String get name => 'CPS Ir pipeline';
53 55
54 /// Generates JavaScript code for `work.element`. First tries to use the 56 /// Generates JavaScript code for `work.element`. First tries to use the
55 /// Cps Ir -> tree ir -> js pipeline, and if that fails due to language 57 /// Cps Ir -> tree ir -> js pipeline, and if that fails due to language
56 /// features not implemented it will fall back to the ssa pipeline (for 58 /// features not implemented it will fall back to the ssa pipeline (for
57 /// platform code) or will cancel compilation (for user code). 59 /// platform code) or will cancel compilation (for user code).
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
201 Iterable<CompilerTask> get tasks { 203 Iterable<CompilerTask> get tasks {
202 // TODO(sigurdm): Make a better list of tasks. 204 // TODO(sigurdm): Make a better list of tasks.
203 return <CompilerTask>[irBuilderTask]..addAll(fallbackCompiler.tasks); 205 return <CompilerTask>[irBuilderTask]..addAll(fallbackCompiler.tasks);
204 } 206 }
205 207
206 js.Node attachPosition(js.Node node, AstElement element) { 208 js.Node attachPosition(js.Node node, AstElement element) {
207 return node.withSourceInformation( 209 return node.withSourceInformation(
208 StartEndSourceInformation.computeSourceInformation(element)); 210 StartEndSourceInformation.computeSourceInformation(element));
209 } 211 }
210 } 212 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698