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

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

Issue 1305863010: dart2js cps: Store the TypeMask for each primitive in a field. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Rebase Created 5 years, 3 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
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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 42
43 class CpsFunctionCompiler implements FunctionCompiler { 43 class CpsFunctionCompiler implements FunctionCompiler {
44 final ConstantSystem constantSystem; 44 final ConstantSystem constantSystem;
45 // TODO(karlklose): remove the compiler. 45 // TODO(karlklose): remove the compiler.
46 final Compiler compiler; 46 final Compiler compiler;
47 final Glue glue; 47 final Glue glue;
48 final SourceInformationStrategy sourceInformationFactory; 48 final SourceInformationStrategy sourceInformationFactory;
49 49
50 // TODO(karlklose,sigurdm): remove and update dart-doc of [compile]. 50 // TODO(karlklose,sigurdm): remove and update dart-doc of [compile].
51 final FunctionCompiler fallbackCompiler; 51 final FunctionCompiler fallbackCompiler;
52 TypeMaskSystem typeSystem;
52 53
53 Tracer get tracer => compiler.tracer; 54 Tracer get tracer => compiler.tracer;
54 55
55 IrBuilderTask get irBuilderTask => compiler.irBuilder; 56 IrBuilderTask get irBuilderTask => compiler.irBuilder;
56 57
57 CpsFunctionCompiler(Compiler compiler, JavaScriptBackend backend, 58 CpsFunctionCompiler(Compiler compiler, JavaScriptBackend backend,
58 SourceInformationStrategy sourceInformationFactory) 59 SourceInformationStrategy sourceInformationFactory)
59 : fallbackCompiler = 60 : fallbackCompiler =
60 new ssa.SsaFunctionCompiler(backend, sourceInformationFactory), 61 new ssa.SsaFunctionCompiler(backend, sourceInformationFactory),
61 this.sourceInformationFactory = sourceInformationFactory, 62 this.sourceInformationFactory = sourceInformationFactory,
62 constantSystem = backend.constantSystem, 63 constantSystem = backend.constantSystem,
63 compiler = compiler, 64 compiler = compiler,
64 glue = new Glue(compiler); 65 glue = new Glue(compiler);
65 66
66 String get name => 'CPS Ir pipeline'; 67 String get name => 'CPS Ir pipeline';
67 68
68 JavaScriptBackend get backend => compiler.backend; 69 JavaScriptBackend get backend => compiler.backend;
69 70
70 /// Generates JavaScript code for `work.element`. 71 /// Generates JavaScript code for `work.element`.
71 js.Fun compile(CodegenWorkItem work) { 72 js.Fun compile(CodegenWorkItem work) {
72 AstElement element = work.element; 73 AstElement element = work.element;
73 return compiler.withCurrentElement(element, () { 74 return compiler.withCurrentElement(element, () {
75 typeSystem = new TypeMaskSystem(compiler);
74 try { 76 try {
75 // TODO(karlklose): remove this fallback when we do not need it for 77 // TODO(karlklose): remove this fallback when we do not need it for
76 // testing anymore. 78 // testing anymore.
77 if (false) { 79 if (false) {
78 compiler.log('Using SSA compiler for platform element $element'); 80 compiler.log('Using SSA compiler for platform element $element');
79 return fallbackCompiler.compile(work); 81 return fallbackCompiler.compile(work);
80 } 82 }
81 83
82 if (tracer != null) { 84 if (tracer != null) {
83 tracer.traceCompilation(element.name, null); 85 tracer.traceCompilation(element.name, null);
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after
240 // TODO(sigurdm): Make a better list of tasks. 242 // TODO(sigurdm): Make a better list of tasks.
241 return <CompilerTask>[irBuilderTask]..addAll(fallbackCompiler.tasks); 243 return <CompilerTask>[irBuilderTask]..addAll(fallbackCompiler.tasks);
242 } 244 }
243 245
244 js.Node attachPosition(js.Node node, AstElement element) { 246 js.Node attachPosition(js.Node node, AstElement element) {
245 return node.withSourceInformation( 247 return node.withSourceInformation(
246 sourceInformationFactory.createBuilderForContext(element) 248 sourceInformationFactory.createBuilderForContext(element)
247 .buildDeclaration(element)); 249 .buildDeclaration(element));
248 } 250 }
249 } 251 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/cps_ir/type_propagation.dart ('k') | pkg/compiler/lib/src/tree_ir/tree_ir_builder.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698