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

Side by Side 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 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 WorkItem { 5 class WorkItem {
6 final Element element; 6 final Element element;
7 TreeElements resolutionTree; 7 TreeElements resolutionTree;
8 Function run; 8 Function run;
9 bool allowSpeculativeOptimization = true; 9 bool allowSpeculativeOptimization = true;
10 List<HTypeGuard> guards = const <HTypeGuard>[]; 10 List<HTypeGuard> guards = const <HTypeGuard>[];
(...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after
293 cancel('main is not a function', element: main); 293 cancel('main is not a function', element: main);
294 } 294 }
295 FunctionElement mainMethod = main; 295 FunctionElement mainMethod = main;
296 FunctionSignature parameters = mainMethod.computeSignature(this); 296 FunctionSignature parameters = mainMethod.computeSignature(this);
297 if (parameters.parameterCount > 0) { 297 if (parameters.parameterCount > 0) {
298 cancel('main cannot have parameters', element: mainMethod); 298 cancel('main cannot have parameters', element: mainMethod);
299 } 299 }
300 }); 300 });
301 } 301 }
302 native.processNativeClasses(this, universe.libraries.getValues()); 302 native.processNativeClasses(this, universe.libraries.getValues());
303 computeSubclasses();
303 enqueue(new WorkItem.toCompile(main)); 304 enqueue(new WorkItem.toCompile(main));
304 codegenProgress.reset(); 305 codegenProgress.reset();
305 while (!worklist.isEmpty()) { 306 while (!worklist.isEmpty()) {
306 WorkItem work = worklist.removeLast(); 307 WorkItem work = worklist.removeLast();
307 withCurrentElement(work.element, () => (work.run)(this)); 308 withCurrentElement(work.element, () => (work.run)(this));
308 } 309 }
309 workListIsClosed = true; 310 workListIsClosed = true;
310 assert(enqueuer.checkNoEnqueuedInvokedInstanceMethods()); 311 assert(enqueuer.checkNoEnqueuedInvokedInstanceMethods());
311 enqueuer.registerFieldClosureInvocations(); 312 enqueuer.registerFieldClosureInvocations();
312 emitter.assembleProgram(); 313 emitter.assembleProgram();
313 if (!worklist.isEmpty()) { 314 if (!worklist.isEmpty()) {
314 internalErrorOnElement(worklist.first().element, 315 internalErrorOnElement(worklist.first().element,
315 "work list is not empty"); 316 "work list is not empty");
316 } 317 }
317 } 318 }
318 319
320 void addSubtypes(ClassElement cls) {
321 for (Type type in cls.allSupertypes) {
322 List<Element> subtypes = universe.subtypes.putIfAbsent(
323 type.element,
324 () => <ClassElement>[]);
325 subtypes.add(cls);
326 }
327 }
328
329 void computeSubclasses() {
330 universe.libraries.getValues().forEach((LibraryElement library) {
331 for (Link<Element> link = library.topLevelElements;
332 !link.isEmpty();
333 link = link.tail) {
334 Element element = link.head;
335 if (!element.isClass()) continue;
336 ClassElement cls = element;
337 resolveClass(cls);
338 addSubtypes(cls);
339 }
340 });
341 }
342
319 TreeElements analyzeElement(Element element) { 343 TreeElements analyzeElement(Element element) {
320 assert(parser !== null); 344 assert(parser !== null);
321 Node tree = parser.parse(element); 345 Node tree = parser.parse(element);
322 validator.validate(tree); 346 validator.validate(tree);
323 TreeElements elements = resolver.resolve(element); 347 TreeElements elements = resolver.resolve(element);
324 checker.check(tree, elements); 348 checker.check(tree, elements);
325 return elements; 349 return elements;
326 } 350 }
327 351
328 TreeElements analyze(WorkItem work) { 352 TreeElements analyze(WorkItem work) {
(...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after
568 } 592 }
569 } 593 }
570 594
571 class SourceSpan { 595 class SourceSpan {
572 final Uri uri; 596 final Uri uri;
573 final int begin; 597 final int begin;
574 final int end; 598 final int end;
575 599
576 const SourceSpan(this.uri, this.begin, this.end); 600 const SourceSpan(this.uri, this.begin, this.end);
577 } 601 }
OLDNEW
« no previous file with comments | « no previous file | lib/compiler/implementation/ssa/builder.dart » ('j') | lib/compiler/implementation/ssa/nodes.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698