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

Side by Side Diff: frog/gen.dart

Issue 9113061: Reapply r3590 with frog fixes (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: merged Created 8 years, 11 months 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
« no previous file with comments | « client/dom/templates/dom/frog/immutable_list_mixin.darttemplate ('k') | frog/minfrog » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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 /** 5 /**
6 * Top level generator object for writing code and keeping track of 6 * Top level generator object for writing code and keeping track of
7 * dependencies. 7 * dependencies.
8 * 8 *
9 * Should have two compilation models, but only one implemented so far. 9 * Should have two compilation models, but only one implemented so far.
10 * 10 *
(...skipping 19 matching lines...) Expand all
30 /** Global const and static field initializations. */ 30 /** Global const and static field initializations. */
31 Map<String, GlobalValue> globals; 31 Map<String, GlobalValue> globals;
32 CoreJs corejs; 32 CoreJs corejs;
33 33
34 /** */ 34 /** */
35 Set<Type> typesWithDynamicDispatch; 35 Set<Type> typesWithDynamicDispatch;
36 36
37 WorldGenerator(this.main, this.writer) 37 WorldGenerator(this.main, this.writer)
38 : globals = {}, corejs = new CoreJs(); 38 : globals = {}, corejs = new CoreJs();
39 39
40
41
42
40 analyze() { 43 analyze() {
41 // Walk all code and find all NewExpressions - to determine possible types 44 // Walk all code and find all NewExpressions - to determine possible types
42 int nlibs=0, ntypes=0, nmems=0, nnews=0; 45 int nlibs=0, ntypes=0, nmems=0, nnews=0;
43 //Set<Type> newedTypes = new Set<Type>();
44 for (var lib in world.libraries.getValues()) { 46 for (var lib in world.libraries.getValues()) {
45 nlibs += 1; 47 nlibs += 1;
46 for (var type in lib.types.getValues()) { 48 for (var type in lib.types.getValues()) {
49 // TODO(jmesserly): we can't accurately track if DOM types are
50 // created or not, so we need to prepare to handle them.
51 // This should be fixed by tightening up the return types in DOM.
52 // Until then, this 'analysis' just marks all the DOM types as used.
53 // TODO(jimhug): Do we still need this? Or do/can we handle this by
54 // using return values?
55 if (type.library.isDom || type.isHiddenNativeType) {
56 if (type.isClass) type.markUsed();
57 }
58
47 ntypes += 1; 59 ntypes += 1;
48 var allMembers = []; 60 var allMembers = [];
49 allMembers.addAll(type.constructors.getValues()); 61 allMembers.addAll(type.constructors.getValues());
50 allMembers.addAll(type.members.getValues()); 62 allMembers.addAll(type.members.getValues());
51 type.factories.forEach((f) => allMembers.add(f)); 63 type.factories.forEach((f) => allMembers.add(f));
52 for (var m in allMembers) { 64 for (var m in allMembers) {
53 if (m.isAbstract || !m.isMethod) continue; 65 if (m.isAbstract || !m.isMethod) continue;
54 66
55 m.methodData.analyze(); 67 m.methodData.analyze();
56 } 68 }
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after
218 } 230 }
219 for (var file in lib.natives) { 231 for (var file in lib.natives) {
220 var filename = basename(file.filename); 232 var filename = basename(file.filename);
221 writer.comment('// ********** Natives $filename **************'); 233 writer.comment('// ********** Natives $filename **************');
222 writer.writeln(file.text); 234 writer.writeln(file.text);
223 } 235 }
224 lib.topType.markUsed(); // TODO(jimhug): EGREGIOUS HACK 236 lib.topType.markUsed(); // TODO(jimhug): EGREGIOUS HACK
225 237
226 var orderedTypes = _orderValues(lib.types); 238 var orderedTypes = _orderValues(lib.types);
227 239
228 // TODO(jmesserly): we can't accurately track if DOM types are
229 // created or not, so we need to prepare to handle them.
230 // This should be fixed by tightening up the return types in DOM.
231 // Until then, this 'analysis' just marks all the DOM types as used.
232 for (var type in orderedTypes) {
233 if ((type.library.isDom || type.isHiddenNativeType) &&
234 type.isClass) {
235 type.markUsed();
236 }
237 }
238
239 for (var type in orderedTypes) { 240 for (var type in orderedTypes) {
240 if (type.isUsed && type.isClass) { 241 if (type.isUsed && type.isClass) {
241 writeType(type); 242 writeType(type);
242 // TODO(jimhug): Performance is terrible if we use current 243 // TODO(jimhug): Performance is terrible if we use current
243 // reified generics approach for reified generic Arrays. 244 // reified generics approach for reified generic Arrays.
244 if (type.isGeneric && type !== world.listFactoryType) { 245 if (type.isGeneric && type !== world.listFactoryType) {
245 for (var ct in _orderValues(type._concreteTypes)) { 246 for (var ct in _orderValues(type._concreteTypes)) {
246 if (ct.isUsed) writeType(ct); 247 if (ct.isUsed) writeType(ct);
247 } 248 }
248 } 249 }
(...skipping 2189 matching lines...) Expand 10 before | Expand all | Expand 10 after
2438 return true; 2439 return true;
2439 } 2440 }
2440 2441
2441 } 2442 }
2442 2443
2443 class ReturnKind { 2444 class ReturnKind {
2444 static final int IGNORE = 1; 2445 static final int IGNORE = 1;
2445 static final int POST = 2; 2446 static final int POST = 2;
2446 static final int PRE = 3; 2447 static final int PRE = 3;
2447 } 2448 }
OLDNEW
« no previous file with comments | « client/dom/templates/dom/frog/immutable_list_mixin.darttemplate ('k') | frog/minfrog » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698