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

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

Issue 10941031: Reapply 'Add runtimeType() to Object which returns canonicalized instances of Type'. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 3 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 class World { 5 class World {
6 final Compiler compiler; 6 final Compiler compiler;
7 final Map<ClassElement, Set<ClassElement>> subtypes; 7 final Map<ClassElement, Set<ClassElement>> subtypes;
8 final Set<ClassElement> classesNeedingRti; 8 final Set<ClassElement> classesNeedingRti;
9 final Map<ClassElement, Set<ClassElement>> rtiDependencies; 9 final Map<ClassElement, Set<ClassElement>> rtiDependencies;
10 final FunctionSet userDefinedGetters; 10 final FunctionSet userDefinedGetters;
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 while (!worklist.isEmpty()) { 65 while (!worklist.isEmpty()) {
66 Element e = worklist.removeLast(); 66 Element e = worklist.removeLast();
67 Set<Element> dependencies = rtiDependencies[e]; 67 Set<Element> dependencies = rtiDependencies[e];
68 if (dependencies == null) continue; 68 if (dependencies == null) continue;
69 dependencies.forEach((Element other) { 69 dependencies.forEach((Element other) {
70 potentiallyAddForRti(other, () => worklist.add(other)); 70 potentiallyAddForRti(other, () => worklist.add(other));
71 }); 71 });
72 } 72 }
73 } 73 }
74 74
75 bool needsRti(ClassElement cls) => classesNeedingRti.contains(cls); 75 bool needsRti(ClassElement cls) {
76 return classesNeedingRti.contains(cls) || compiler.enabledRuntimeType;
77 }
76 78
77 void registerRtiDependency(Element element, Element dependency) { 79 void registerRtiDependency(Element element, Element dependency) {
78 // We're not dealing with typedef for now. 80 // We're not dealing with typedef for now.
79 if (!element.isClass() || !dependency.isClass()) return; 81 if (!element.isClass() || !dependency.isClass()) return;
80 Set<ClassElement> classes = 82 Set<ClassElement> classes =
81 rtiDependencies.putIfAbsent(element, () => new Set<ClassElement>()); 83 rtiDependencies.putIfAbsent(element, () => new Set<ClassElement>());
82 classes.add(dependency); 84 classes.add(dependency);
83 } 85 }
84 86
85 void recordUserDefinedGetter(Element element) { 87 void recordUserDefinedGetter(Element element) {
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
167 final SourceString name; 169 final SourceString name;
168 170
169 MemberSet(SourceString this.name) : elements = new Set<Element>(); 171 MemberSet(SourceString this.name) : elements = new Set<Element>();
170 172
171 void add(Element element) { 173 void add(Element element) {
172 elements.add(element); 174 elements.add(element);
173 } 175 }
174 176
175 bool isEmpty() => elements.isEmpty(); 177 bool isEmpty() => elements.isEmpty();
176 } 178 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698