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 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
127 void applyCpsPass(cps_opt.Pass pass, cps.FunctionDefinition cpsFunction) { | 127 void applyCpsPass(cps_opt.Pass pass, cps.FunctionDefinition cpsFunction) { |
128 cpsOptimizationTask.measureSubtask(pass.passName, () { | 128 cpsOptimizationTask.measureSubtask(pass.passName, () { |
129 pass.rewrite(cpsFunction); | 129 pass.rewrite(cpsFunction); |
130 }); | 130 }); |
131 traceGraph(pass.passName, cpsFunction); | 131 traceGraph(pass.passName, cpsFunction); |
132 dumpTypedIr(pass.passName, cpsFunction); | 132 dumpTypedIr(pass.passName, cpsFunction); |
133 assert(checkCpsIntegrity(cpsFunction, pass.passName)); | 133 assert(checkCpsIntegrity(cpsFunction, pass.passName)); |
134 } | 134 } |
135 | 135 |
136 cps.FunctionDefinition compileToCpsIr(AstElement element) { | 136 cps.FunctionDefinition compileToCpsIr(AstElement element) { |
137 cps.FunctionDefinition cpsFunction = cpsBuilderTask.buildNode(element); | 137 cps.FunctionDefinition cpsFunction = |
| 138 cpsBuilderTask.buildNode(element, typeSystem); |
138 if (cpsFunction == null) { | 139 if (cpsFunction == null) { |
139 if (cpsBuilderTask.bailoutMessage == null) { | 140 if (cpsBuilderTask.bailoutMessage == null) { |
140 giveUp('unable to build cps definition of $element'); | 141 giveUp('unable to build cps definition of $element'); |
141 } else { | 142 } else { |
142 giveUp(cpsBuilderTask.bailoutMessage); | 143 giveUp(cpsBuilderTask.bailoutMessage); |
143 } | 144 } |
144 } | 145 } |
145 ParentVisitor.setParents(cpsFunction); | 146 ParentVisitor.setParents(cpsFunction); |
146 traceGraph('IR Builder', cpsFunction); | 147 traceGraph('IR Builder', cpsFunction); |
147 dumpTypedIr('IR Builder', cpsFunction); | 148 dumpTypedIr('IR Builder', cpsFunction); |
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
278 treeOptimizationTask] | 279 treeOptimizationTask] |
279 ..addAll(fallbackCompiler.tasks); | 280 ..addAll(fallbackCompiler.tasks); |
280 } | 281 } |
281 | 282 |
282 js.Node attachPosition(js.Node node, AstElement element) { | 283 js.Node attachPosition(js.Node node, AstElement element) { |
283 return node.withSourceInformation( | 284 return node.withSourceInformation( |
284 sourceInformationFactory.createBuilderForContext(element) | 285 sourceInformationFactory.createBuilderForContext(element) |
285 .buildDeclaration(element)); | 286 .buildDeclaration(element)); |
286 } | 287 } |
287 } | 288 } |
OLD | NEW |