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

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

Issue 759193005: Add support for fields to the new dart backend. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Fix dart2js-cps 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 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
124 void traceGraph(String title, var irObject) { 124 void traceGraph(String title, var irObject) {
125 if (tracer != null) { 125 if (tracer != null) {
126 tracer.traceGraph(title, irObject); 126 tracer.traceGraph(title, irObject);
127 } 127 }
128 } 128 }
129 129
130 cps.FunctionDefinition compileToCpsIR(AstElement element) { 130 cps.FunctionDefinition compileToCpsIR(AstElement element) {
131 // TODO(sigurdm): Support these constructs. 131 // TODO(sigurdm): Support these constructs.
132 if (element.isGenerativeConstructorBody || 132 if (element.isGenerativeConstructorBody ||
133 element.enclosingClass is ClosureClassElement || 133 element.enclosingClass is ClosureClassElement ||
134 element.isNative) { 134 element.isNative ||
135 element.isField) {
135 giveUp('unsupported element kind: ${element.name}:${element.kind}'); 136 giveUp('unsupported element kind: ${element.name}:${element.kind}');
136 } 137 }
137 138
138 cps.FunctionDefinition cpsNode = irBuilderTask.buildNode(element); 139 cps.FunctionDefinition cpsNode = irBuilderTask.buildNode(element);
139 if (cpsNode == null) { 140 if (cpsNode == null) {
140 giveUp('unable to build cps definition of $element'); 141 giveUp('unable to build cps definition of $element');
141 } 142 }
142 return cpsNode; 143 return cpsNode;
143 } 144 }
144 145
(...skipping 10 matching lines...) Expand all
155 156
156 // Do not rewrite the IR after variable allocation. Allocation 157 // Do not rewrite the IR after variable allocation. Allocation
157 // makes decisions based on an approximation of IR variable live 158 // makes decisions based on an approximation of IR variable live
158 // ranges that can be invalidated by transforming the IR. 159 // ranges that can be invalidated by transforming the IR.
159 new cps.RegisterAllocator().visit(cpsNode); 160 new cps.RegisterAllocator().visit(cpsNode);
160 return cpsNode; 161 return cpsNode;
161 } 162 }
162 163
163 tree_ir.FunctionDefinition compileToTreeIR(cps.FunctionDefinition cpsNode) { 164 tree_ir.FunctionDefinition compileToTreeIR(cps.FunctionDefinition cpsNode) {
164 tree_builder.Builder builder = new JsBackendTreeBuilder(compiler, glue); 165 tree_builder.Builder builder = new JsBackendTreeBuilder(compiler, glue);
165 tree_ir.FunctionDefinition treeNode = builder.build(cpsNode); 166 tree_ir.FunctionDefinition treeNode = builder.buildFunction(cpsNode);
166 assert(treeNode != null); 167 assert(treeNode != null);
167 traceGraph('Tree builder', treeNode); 168 traceGraph('Tree builder', treeNode);
168 return treeNode; 169 return treeNode;
169 } 170 }
170 171
171 tree_ir.FunctionDefinition optimizeTreeIR( 172 tree_ir.FunctionDefinition optimizeTreeIR(
172 tree_ir.FunctionDefinition treeNode) { 173 tree_ir.FunctionDefinition treeNode) {
173 // Transformations on the Tree IR. 174 // Transformations on the Tree IR.
174 new StatementRewriter().rewrite(treeNode); 175 new StatementRewriter().rewrite(treeNode);
175 traceGraph('Statement rewriter', treeNode); 176 traceGraph('Statement rewriter', treeNode);
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
224 new TokenSourceFileLocation(sourceFile, endToken, name); 225 new TokenSourceFileLocation(sourceFile, endToken, name);
225 } 226 }
226 return node.withPosition(sourcePosition, endSourcePosition); 227 return node.withPosition(sourcePosition, endSourcePosition);
227 } 228 }
228 229
229 SourceFile sourceFileOfElement(Element element) { 230 SourceFile sourceFileOfElement(Element element) {
230 return element.implementation.compilationUnit.script.file; 231 return element.implementation.compilationUnit.script.file;
231 } 232 }
232 233
233 } 234 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698