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

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

Issue 792643003: Add DartTypes to abstract Types. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Rebased 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 import 'unsugar.dart'; 10 import 'unsugar.dart';
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
127 } else if (type is ForwardingTypeMask) { 127 } else if (type is ForwardingTypeMask) {
128 return formatTypeMask(type.forwardTo); 128 return formatTypeMask(type.forwardTo);
129 } 129 }
130 throw 'unsupported: $type'; 130 throw 'unsupported: $type';
131 } 131 }
132 132
133 cps.FunctionDefinition optimizeCpsIR(cps.FunctionDefinition cpsNode) { 133 cps.FunctionDefinition optimizeCpsIR(cps.FunctionDefinition cpsNode) {
134 // Transformations on the CPS IR. 134 // Transformations on the CPS IR.
135 traceGraph("IR Builder", cpsNode); 135 traceGraph("IR Builder", cpsNode);
136 136
137 TypePropagator typePropagator = new TypePropagator<TypeMask>(compiler, 137 TypePropagator typePropagator = new TypePropagator<TypeMask>(
138 constantSystem, new TypeMaskSystem(compiler), compiler.internalError); 138 compiler.types,
139 constantSystem,
140 new TypeMaskSystem(compiler),
141 compiler.internalError);
139 typePropagator.rewrite(cpsNode); 142 typePropagator.rewrite(cpsNode);
140 traceGraph("Sparse constant propagation", cpsNode); 143 traceGraph("Sparse constant propagation", cpsNode);
141 144
142 if (PRINT_TYPED_IR_FILTER != null && 145 if (PRINT_TYPED_IR_FILTER != null &&
143 PRINT_TYPED_IR_FILTER.matchAsPrefix(cpsNode.element.name) != null) { 146 PRINT_TYPED_IR_FILTER.matchAsPrefix(cpsNode.element.name) != null) {
144 String printType(cps.Node node, String s) { 147 String printType(cps.Node node, String s) {
145 var type = typePropagator.getType(node); 148 var type = typePropagator.getType(node);
146 return type == null ? s : "$s:${formatTypeMask(type.type)}"; 149 return type == null ? s : "$s:${formatTypeMask(type.type)}";
147 } 150 }
148 DEBUG_MODE = true; 151 DEBUG_MODE = true;
149 print(new SExpressionStringifier(printType).visit(cpsNode)); 152 print(new SExpressionStringifier(printType).visit(cpsNode));
150 } 153 }
151 154
152 new RedundantPhiEliminator().rewrite(cpsNode); 155 new RedundantPhiEliminator().rewrite(cpsNode);
153 traceGraph("Redundant phi elimination", cpsNode); 156 traceGraph("Redundant phi elimination", cpsNode);
154 new ShrinkingReducer().rewrite(cpsNode); 157 new ShrinkingReducer().rewrite(cpsNode);
155 traceGraph("Shrinking reductions", cpsNode); 158 traceGraph("Shrinking reductions", cpsNode);
156 159
157 // Do not rewrite the IR after variable allocation. Allocation 160 // Do not rewrite the IR after variable allocation. Allocation
158 // makes decisions based on an approximation of IR variable live 161 // makes decisions based on an approximation of IR variable live
159 // ranges that can be invalidated by transforming the IR. 162 // ranges that can be invalidated by transforming the IR.
160 new cps.RegisterAllocator().visit(cpsNode); 163 new cps.RegisterAllocator().visit(cpsNode);
161 return cpsNode; 164 return cpsNode;
162 } 165 }
163 166
164 tree_ir.FunctionDefinition compileToTreeIR(cps.FunctionDefinition cpsNode) { 167 tree_ir.FunctionDefinition compileToTreeIR(cps.FunctionDefinition cpsNode) {
165 tree_builder.Builder builder = new tree_builder.Builder(glue, compiler); 168 tree_builder.Builder builder = new tree_builder.Builder(
169 glue, compiler.internalError, compiler.identicalFunction);
166 tree_ir.FunctionDefinition treeNode = builder.buildFunction(cpsNode); 170 tree_ir.FunctionDefinition treeNode = builder.buildFunction(cpsNode);
167 assert(treeNode != null); 171 assert(treeNode != null);
168 traceGraph('Tree builder', treeNode); 172 traceGraph('Tree builder', treeNode);
169 return treeNode; 173 return treeNode;
170 } 174 }
171 175
172 tree_ir.FunctionDefinition optimizeTreeIR( 176 tree_ir.FunctionDefinition optimizeTreeIR(
173 tree_ir.FunctionDefinition treeNode) { 177 tree_ir.FunctionDefinition treeNode) {
174 // Transformations on the Tree IR. 178 // Transformations on the Tree IR.
175 new StatementRewriter().rewrite(treeNode); 179 new StatementRewriter().rewrite(treeNode);
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
225 new TokenSourceFileLocation(sourceFile, endToken, name); 229 new TokenSourceFileLocation(sourceFile, endToken, name);
226 } 230 }
227 return node.withPosition(sourcePosition, endSourcePosition); 231 return node.withPosition(sourcePosition, endSourcePosition);
228 } 232 }
229 233
230 SourceFile sourceFileOfElement(Element element) { 234 SourceFile sourceFileOfElement(Element element) {
231 return element.implementation.compilationUnit.script.file; 235 return element.implementation.compilationUnit.script.file;
232 } 236 }
233 237
234 } 238 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/dart_types.dart ('k') | pkg/compiler/lib/src/js_backend/constant_system_javascript.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698