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

Unified Diff: lib/compiler/implementation/compiler.dart

Issue 10383065: Start creating a MemberSet abstraction, and use it to fold getters/setters into field accesses. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | lib/compiler/implementation/leg.dart » ('j') | lib/compiler/implementation/ssa/optimize.dart » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/compiler/implementation/compiler.dart
===================================================================
--- lib/compiler/implementation/compiler.dart (revision 7442)
+++ lib/compiler/implementation/compiler.dart (working copy)
@@ -33,6 +33,7 @@
class Compiler implements DiagnosticListener {
Queue<WorkItem> worklist;
Universe universe;
+ World world;
String assembledCode;
Namer namer;
Types types;
@@ -100,6 +101,7 @@
Compiler([this.tracer = const Tracer()])
: universe = new Universe(),
+ world = new World(),
worklist = new Queue<WorkItem>(),
codegenProgress = new Stopwatch.start() {
namer = new Namer(this);
@@ -300,6 +302,7 @@
});
}
native.processNativeClasses(this, universe.libraries.getValues());
+ computeSubclasses();
kasperl 2012/05/09 11:13:03 Could we move this code to world? That would seem
ngeoffray 2012/05/09 11:34:22 Done.
enqueue(new WorkItem.toCompile(main));
codegenProgress.reset();
while (!worklist.isEmpty()) {
@@ -316,6 +319,29 @@
}
}
+ void addSubtypes(ClassElement cls) {
+ for (Type type in cls.allSupertypes) {
+ List<Element> subtypes = world.subtypes.putIfAbsent(
+ type.element,
+ () => <ClassElement>[]);
+ subtypes.add(cls);
+ }
+ }
+
+ void computeSubclasses() {
+ universe.libraries.getValues().forEach((LibraryElement library) {
+ for (Link<Element> link = library.topLevelElements;
+ !link.isEmpty();
+ link = link.tail) {
+ Element element = link.head;
+ if (!element.isClass()) continue;
+ ClassElement cls = element;
+ resolveClass(cls);
+ addSubtypes(cls);
+ }
+ });
+ }
+
TreeElements analyzeElement(Element element) {
assert(parser !== null);
Node tree = parser.parse(element);
« no previous file with comments | « no previous file | lib/compiler/implementation/leg.dart » ('j') | lib/compiler/implementation/ssa/optimize.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698