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

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

Issue 1068243002: Overhaul tree IR visitor and rename IR classes. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Add dummy use for RootVisitor and InitializerVisitor without arguments Created 5 years, 8 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
« no previous file with comments | « pkg/compiler/lib/src/js_backend/codegen/codegen.dart ('k') | pkg/compiler/lib/src/tracer.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 ? nodeOrRef.definition 149 ? nodeOrRef.definition
150 : nodeOrRef; 150 : nodeOrRef;
151 var type = typePropagator.getType(node); 151 var type = typePropagator.getType(node);
152 return type == null ? s : "$s:${formatTypeMask(type.type)}"; 152 return type == null ? s : "$s:${formatTypeMask(type.type)}";
153 } 153 }
154 DEBUG_MODE = true; 154 DEBUG_MODE = true;
155 print(new SExpressionStringifier(printType).visit(cpsNode)); 155 print(new SExpressionStringifier(printType).visit(cpsNode));
156 } 156 }
157 } 157 }
158 158
159 static bool checkCpsIntegrity(cps.ExecutableDefinition node) { 159 static bool checkCpsIntegrity(cps.RootNode node) {
160 new CheckCpsIntegrity().check(node); 160 new CheckCpsIntegrity().check(node);
161 return true; // So this can be used from assert(). 161 return true; // So this can be used from assert().
162 } 162 }
163 163
164 cps.FunctionDefinition optimizeCpsIR(cps.FunctionDefinition cpsNode) { 164 cps.FunctionDefinition optimizeCpsIR(cps.FunctionDefinition cpsNode) {
165 // Transformations on the CPS IR. 165 // Transformations on the CPS IR.
166 void applyCpsPass(cps_opt.Pass pass) { 166 void applyCpsPass(cps_opt.Pass pass) {
167 pass.rewrite(cpsNode); 167 pass.rewrite(cpsNode);
168 traceGraph(pass.passName, cpsNode); 168 traceGraph(pass.passName, cpsNode);
169 assert(checkCpsIntegrity(cpsNode)); 169 assert(checkCpsIntegrity(cpsNode));
(...skipping 15 matching lines...) Expand all
185 tree_ir.FunctionDefinition compileToTreeIR(cps.FunctionDefinition cpsNode) { 185 tree_ir.FunctionDefinition compileToTreeIR(cps.FunctionDefinition cpsNode) {
186 tree_builder.Builder builder = new JsTreeBuilder( 186 tree_builder.Builder builder = new JsTreeBuilder(
187 compiler.internalError, compiler.identicalFunction, glue); 187 compiler.internalError, compiler.identicalFunction, glue);
188 tree_ir.FunctionDefinition treeNode = builder.buildFunction(cpsNode); 188 tree_ir.FunctionDefinition treeNode = builder.buildFunction(cpsNode);
189 assert(treeNode != null); 189 assert(treeNode != null);
190 traceGraph('Tree builder', treeNode); 190 traceGraph('Tree builder', treeNode);
191 assert(checkTreeIntegrity(treeNode)); 191 assert(checkTreeIntegrity(treeNode));
192 return treeNode; 192 return treeNode;
193 } 193 }
194 194
195 static bool checkTreeIntegrity(tree_ir.ExecutableDefinition node) { 195 static bool checkTreeIntegrity(tree_ir.RootNode node) {
196 new CheckTreeIntegrity().check(node); 196 new CheckTreeIntegrity().check(node);
197 return true; // So this can be used from assert(). 197 return true; // So this can be used from assert().
198 } 198 }
199 199
200 tree_ir.FunctionDefinition optimizeTreeIR(tree_ir.FunctionDefinition node) { 200 tree_ir.FunctionDefinition optimizeTreeIR(tree_ir.FunctionDefinition node) {
201 void applyTreePass(tree_opt.Pass pass) { 201 void applyTreePass(tree_opt.Pass pass) {
202 pass.rewrite(node); 202 pass.rewrite(node);
203 traceGraph(pass.passName, node); 203 traceGraph(pass.passName, node);
204 assert(checkTreeIntegrity(node)); 204 assert(checkTreeIntegrity(node));
205 } 205 }
(...skipping 16 matching lines...) Expand all
222 Iterable<CompilerTask> get tasks { 222 Iterable<CompilerTask> get tasks {
223 // TODO(sigurdm): Make a better list of tasks. 223 // TODO(sigurdm): Make a better list of tasks.
224 return <CompilerTask>[irBuilderTask]..addAll(fallbackCompiler.tasks); 224 return <CompilerTask>[irBuilderTask]..addAll(fallbackCompiler.tasks);
225 } 225 }
226 226
227 js.Node attachPosition(js.Node node, AstElement element) { 227 js.Node attachPosition(js.Node node, AstElement element) {
228 return node.withSourceInformation( 228 return node.withSourceInformation(
229 StartEndSourceInformation.computeSourceInformation(element)); 229 StartEndSourceInformation.computeSourceInformation(element));
230 } 230 }
231 } 231 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/js_backend/codegen/codegen.dart ('k') | pkg/compiler/lib/src/tracer.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698