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

Side by Side Diff: sdk/lib/_internal/compiler/implementation/world.dart

Issue 12389046: Re-apply: Inside a generative constructor, "this" is created at the very end. So we have to use the… (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 9 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
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 part of dart2js; 5 part of dart2js;
6 6
7 class World { 7 class World {
8 final Compiler compiler; 8 final Compiler compiler;
9 final Map<ClassElement, Set<ClassElement>> subtypes; 9 final Map<ClassElement, Set<ClassElement>> subtypes;
10 final Map<ClassElement, Set<MixinApplicationElement>> mixinUses; 10 final Map<ClassElement, Set<MixinApplicationElement>> mixinUses;
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 typesImplementedBySubclasses.putIfAbsent( 44 typesImplementedBySubclasses.putIfAbsent(
45 type.element, () => new Set<ClassElement>()); 45 type.element, () => new Set<ClassElement>());
46 for (DartType current in cls.allSupertypes) { 46 for (DartType current in cls.allSupertypes) {
47 typesImplementedBySubclassesOfCls.add(current.element); 47 typesImplementedBySubclassesOfCls.add(current.element);
48 } 48 }
49 ClassElement classElement = type.element; 49 ClassElement classElement = type.element;
50 type = classElement.supertype; 50 type = classElement.supertype;
51 } 51 }
52 } 52 }
53 53
54 compiler.resolverWorld.instantiatedClasses.forEach(addSubtypes); 54 // Use the [:seenClasses:] set to include non-instantiated
55 // classes: if the superclass of these classes require RTI, then
56 // they also need RTI, so that a constructor passes the type
57 // variables to the super constructor.
58 compiler.enqueuer.resolution.seenClasses.forEach(addSubtypes);
55 59
56 // Find the classes that need runtime type information. Such 60 // Find the classes that need runtime type information. Such
57 // classes are: 61 // classes are:
58 // (1) used in a is check with type variables, 62 // (1) used in a is check with type variables,
59 // (2) dependencies of classes in (1), 63 // (2) dependencies of classes in (1),
60 // (3) subclasses of (2) and (3). 64 // (3) subclasses of (2) and (3).
61 65
62 void potentiallyAddForRti(ClassElement cls) { 66 void potentiallyAddForRti(ClassElement cls) {
63 if (cls.typeVariables.isEmpty) return; 67 if (cls.typeVariables.isEmpty) return;
64 if (classesNeedingRti.contains(cls)) return; 68 if (classesNeedingRti.contains(cls)) return;
65 classesNeedingRti.add(cls); 69 classesNeedingRti.add(cls);
66 70
71 // TODO(ngeoffray): This should use subclasses, not subtypes.
67 Set<ClassElement> classes = subtypes[cls]; 72 Set<ClassElement> classes = subtypes[cls];
68 if (classes != null) { 73 if (classes != null) {
69 classes.forEach((ClassElement sub) { 74 classes.forEach((ClassElement sub) {
70 potentiallyAddForRti(sub); 75 potentiallyAddForRti(sub);
71 }); 76 });
72 } 77 }
73 78
74 Set<ClassElement> dependencies = rtiDependencies[cls]; 79 Set<ClassElement> dependencies = rtiDependencies[cls];
75 if (dependencies != null) { 80 if (dependencies != null) {
76 dependencies.forEach((ClassElement other) { 81 dependencies.forEach((ClassElement other) {
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
190 if (mask != null) { 195 if (mask != null) {
191 noSuchMethodSelector = new TypedSelector(mask, noSuchMethodSelector); 196 noSuchMethodSelector = new TypedSelector(mask, noSuchMethodSelector);
192 } 197 }
193 ClassElement objectClass = compiler.objectClass; 198 ClassElement objectClass = compiler.objectClass;
194 return allFunctions 199 return allFunctions
195 .filter(noSuchMethodSelector) 200 .filter(noSuchMethodSelector)
196 .map((Element member) => member.getEnclosingClass()) 201 .map((Element member) => member.getEnclosingClass())
197 .where((ClassElement holder) => !identical(holder, objectClass)); 202 .where((ClassElement holder) => !identical(holder, objectClass));
198 } 203 }
199 } 204 }
OLDNEW
« no previous file with comments | « sdk/lib/_internal/compiler/implementation/ssa/builder.dart ('k') | tests/language/language_dart2js.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698