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 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
170 assert(checkCpsIntegrity(cpsNode)); | 170 assert(checkCpsIntegrity(cpsNode)); |
171 } | 171 } |
172 | 172 |
173 applyCpsPass(new RedundantJoinEliminator()); | 173 applyCpsPass(new RedundantJoinEliminator()); |
174 applyCpsPass(new RedundantPhiEliminator()); | 174 applyCpsPass(new RedundantPhiEliminator()); |
175 applyCpsPass(new InsertRefinements(compiler.typesTask, compiler.world)); | 175 applyCpsPass(new InsertRefinements(compiler.typesTask, compiler.world)); |
176 TypePropagator typePropagator = new TypePropagator(compiler, this); | 176 TypePropagator typePropagator = new TypePropagator(compiler, this); |
177 applyCpsPass(typePropagator); | 177 applyCpsPass(typePropagator); |
178 dumpTypedIR(cpsNode, typePropagator); | 178 dumpTypedIR(cpsNode, typePropagator); |
179 applyCpsPass(new RemoveRefinements()); | 179 applyCpsPass(new RemoveRefinements()); |
180 applyCpsPass(new LoopInvariantCodeMotion()); | 180 applyCpsPass(new ShrinkingReducer()); |
181 applyCpsPass(new ShareInterceptors()); | |
182 applyCpsPass(new ScalarReplacer(compiler)); | 181 applyCpsPass(new ScalarReplacer(compiler)); |
183 applyCpsPass(new ShrinkingReducer()); | |
184 applyCpsPass(new MutableVariableEliminator()); | 182 applyCpsPass(new MutableVariableEliminator()); |
185 applyCpsPass(new RedundantJoinEliminator()); | 183 applyCpsPass(new RedundantJoinEliminator()); |
186 applyCpsPass(new RedundantPhiEliminator()); | 184 applyCpsPass(new RedundantPhiEliminator()); |
187 applyCpsPass(new ShrinkingReducer()); | 185 applyCpsPass(new ShrinkingReducer()); |
188 applyCpsPass(new LetSinker()); | 186 applyCpsPass(new LoopInvariantCodeMotion()); |
| 187 applyCpsPass(new ShareInterceptors()); |
| 188 applyCpsPass(new ShrinkingReducer()); |
189 | 189 |
190 return cpsNode; | 190 return cpsNode; |
191 } | 191 } |
192 | 192 |
193 tree_ir.FunctionDefinition compileToTreeIR(cps.FunctionDefinition cpsNode) { | 193 tree_ir.FunctionDefinition compileToTreeIR(cps.FunctionDefinition cpsNode) { |
194 tree_builder.Builder builder = new tree_builder.Builder( | 194 tree_builder.Builder builder = new tree_builder.Builder( |
195 compiler.internalError); | 195 compiler.internalError); |
196 tree_ir.FunctionDefinition treeNode = builder.buildFunction(cpsNode); | 196 tree_ir.FunctionDefinition treeNode = builder.buildFunction(cpsNode); |
197 assert(treeNode != null); | 197 assert(treeNode != null); |
198 traceGraph('Tree builder', treeNode); | 198 traceGraph('Tree builder', treeNode); |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
237 // TODO(sigurdm): Make a better list of tasks. | 237 // TODO(sigurdm): Make a better list of tasks. |
238 return <CompilerTask>[irBuilderTask]..addAll(fallbackCompiler.tasks); | 238 return <CompilerTask>[irBuilderTask]..addAll(fallbackCompiler.tasks); |
239 } | 239 } |
240 | 240 |
241 js.Node attachPosition(js.Node node, AstElement element) { | 241 js.Node attachPosition(js.Node node, AstElement element) { |
242 return node.withSourceInformation( | 242 return node.withSourceInformation( |
243 sourceInformationFactory.createBuilderForContext(element) | 243 sourceInformationFactory.createBuilderForContext(element) |
244 .buildDeclaration(element)); | 244 .buildDeclaration(element)); |
245 } | 245 } |
246 } | 246 } |
OLD | NEW |