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 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
163 } | 163 } |
164 | 164 |
165 cps.FunctionDefinition optimizeCpsIR(cps.FunctionDefinition cpsNode) { | 165 cps.FunctionDefinition optimizeCpsIR(cps.FunctionDefinition cpsNode) { |
166 // Transformations on the CPS IR. | 166 // Transformations on the CPS IR. |
167 void applyCpsPass(cps_opt.Pass pass) { | 167 void applyCpsPass(cps_opt.Pass pass) { |
168 pass.rewrite(cpsNode); | 168 pass.rewrite(cpsNode); |
169 traceGraph(pass.passName, cpsNode); | 169 traceGraph(pass.passName, cpsNode); |
170 assert(checkCpsIntegrity(cpsNode)); | 170 assert(checkCpsIntegrity(cpsNode)); |
171 } | 171 } |
172 | 172 |
| 173 applyCpsPass(new InsertRefinements(compiler.typesTask, compiler.world)); |
173 TypePropagator typePropagator = new TypePropagator(compiler, this); | 174 TypePropagator typePropagator = new TypePropagator(compiler, this); |
174 applyCpsPass(typePropagator); | 175 applyCpsPass(typePropagator); |
175 dumpTypedIR(cpsNode, typePropagator); | 176 dumpTypedIR(cpsNode, typePropagator); |
| 177 applyCpsPass(new RemoveRefinements()); |
176 applyCpsPass(new LoopInvariantCodeMotion()); | 178 applyCpsPass(new LoopInvariantCodeMotion()); |
177 applyCpsPass(new ShareInterceptors()); | 179 applyCpsPass(new ShareInterceptors()); |
178 applyCpsPass(new ScalarReplacer(compiler)); | 180 applyCpsPass(new ScalarReplacer(compiler)); |
179 applyCpsPass(new ShrinkingReducer()); | 181 applyCpsPass(new ShrinkingReducer()); |
180 applyCpsPass(new MutableVariableEliminator()); | 182 applyCpsPass(new MutableVariableEliminator()); |
181 applyCpsPass(new RedundantJoinEliminator()); | 183 applyCpsPass(new RedundantJoinEliminator()); |
182 applyCpsPass(new RedundantPhiEliminator()); | 184 applyCpsPass(new RedundantPhiEliminator()); |
183 applyCpsPass(new ShrinkingReducer()); | 185 applyCpsPass(new ShrinkingReducer()); |
184 applyCpsPass(new LetSinker()); | 186 applyCpsPass(new LetSinker()); |
185 | 187 |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
233 // TODO(sigurdm): Make a better list of tasks. | 235 // TODO(sigurdm): Make a better list of tasks. |
234 return <CompilerTask>[irBuilderTask]..addAll(fallbackCompiler.tasks); | 236 return <CompilerTask>[irBuilderTask]..addAll(fallbackCompiler.tasks); |
235 } | 237 } |
236 | 238 |
237 js.Node attachPosition(js.Node node, AstElement element) { | 239 js.Node attachPosition(js.Node node, AstElement element) { |
238 return node.withSourceInformation( | 240 return node.withSourceInformation( |
239 sourceInformationFactory.createBuilderForContext(element) | 241 sourceInformationFactory.createBuilderForContext(element) |
240 .buildDeclaration(element)); | 242 .buildDeclaration(element)); |
241 } | 243 } |
242 } | 244 } |
OLD | NEW |