| OLD | NEW |
| 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 Loading... |
| 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) { | 75 bool needsRti(ClassElement cls) => classesNeedingRti.contains(cls); |
| 76 return classesNeedingRti.contains(cls) || compiler.enabledRuntimeType; | |
| 77 } | |
| 78 | 76 |
| 79 void registerRtiDependency(Element element, Element dependency) { | 77 void registerRtiDependency(Element element, Element dependency) { |
| 80 // We're not dealing with typedef for now. | 78 // We're not dealing with typedef for now. |
| 81 if (!element.isClass() || !dependency.isClass()) return; | 79 if (!element.isClass() || !dependency.isClass()) return; |
| 82 Set<ClassElement> classes = | 80 Set<ClassElement> classes = |
| 83 rtiDependencies.putIfAbsent(element, () => new Set<ClassElement>()); | 81 rtiDependencies.putIfAbsent(element, () => new Set<ClassElement>()); |
| 84 classes.add(dependency); | 82 classes.add(dependency); |
| 85 } | 83 } |
| 86 | 84 |
| 87 void recordUserDefinedGetter(Element element) { | 85 void recordUserDefinedGetter(Element element) { |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 169 final SourceString name; | 167 final SourceString name; |
| 170 | 168 |
| 171 MemberSet(SourceString this.name) : elements = new Set<Element>(); | 169 MemberSet(SourceString this.name) : elements = new Set<Element>(); |
| 172 | 170 |
| 173 void add(Element element) { | 171 void add(Element element) { |
| 174 elements.add(element); | 172 elements.add(element); |
| 175 } | 173 } |
| 176 | 174 |
| 177 bool isEmpty() => elements.isEmpty(); | 175 bool isEmpty() => elements.isEmpty(); |
| 178 } | 176 } |
| OLD | NEW |