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

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

Issue 725293004: Add support for if, while, break, continue to js-cps (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Address comments Created 6 years 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 10
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after
181 traceGraph('Logical rewriter', treeNode); 181 traceGraph('Logical rewriter', treeNode);
182 new backend_ast_emitter.UnshadowParameters().unshadow(treeNode); 182 new backend_ast_emitter.UnshadowParameters().unshadow(treeNode);
183 traceGraph('Unshadow parameters', treeNode); 183 traceGraph('Unshadow parameters', treeNode);
184 return treeNode; 184 return treeNode;
185 } 185 }
186 186
187 js.Fun compileToJavaScript(CodegenWorkItem work, 187 js.Fun compileToJavaScript(CodegenWorkItem work,
188 tree_ir.FunctionDefinition definition) { 188 tree_ir.FunctionDefinition definition) {
189 CodeGenerator codeGen = new CodeGenerator(glue, work.registry); 189 CodeGenerator codeGen = new CodeGenerator(glue, work.registry);
190 190
191 codeGen.buildFunction(definition); 191 return attachPosition(codeGen.buildFunction(definition), work.element);
192 return buildJavaScriptFunction(work.element,
193 codeGen.parameters,
194 codeGen.body);
195 } 192 }
196 193
197 Iterable<CompilerTask> get tasks { 194 Iterable<CompilerTask> get tasks {
198 // TODO(sigurdm): Make a better list of tasks. 195 // TODO(sigurdm): Make a better list of tasks.
199 return <CompilerTask>[irBuilderTask]..addAll(fallbackCompiler.tasks); 196 return <CompilerTask>[irBuilderTask]..addAll(fallbackCompiler.tasks);
200 } 197 }
201 198
202 js.Node attachPosition(js.Node node, AstElement element) { 199 js.Node attachPosition(js.Node node, AstElement element) {
203 // TODO(sra): Attaching positions might be cleaner if the source position 200 // TODO(sra): Attaching positions might be cleaner if the source position
204 // was on a wrapping node. 201 // was on a wrapping node.
(...skipping 21 matching lines...) Expand all
226 endSourcePosition = 223 endSourcePosition =
227 new TokenSourceFileLocation(sourceFile, endToken, name); 224 new TokenSourceFileLocation(sourceFile, endToken, name);
228 } 225 }
229 return node.withPosition(sourcePosition, endSourcePosition); 226 return node.withPosition(sourcePosition, endSourcePosition);
230 } 227 }
231 228
232 SourceFile sourceFileOfElement(Element element) { 229 SourceFile sourceFileOfElement(Element element) {
233 return element.implementation.compilationUnit.script.file; 230 return element.implementation.compilationUnit.script.file;
234 } 231 }
235 232
236 js.Fun buildJavaScriptFunction(FunctionElement element,
237 List<js.Parameter> parameters,
238 js.Block body) {
239 return attachPosition(new js.Fun(parameters, body), element);
240 }
241 } 233 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/js_backend/codegen/codegen.dart ('k') | tests/compiler/dart2js/js_backend_cps_ir_control_flow.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698