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

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
« no previous file with comments | « no previous file | lib/compiler/implementation/leg.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 15 matching lines...) Expand all
26 } 26 }
27 27
28 String codegen(Compiler compiler) { 28 String codegen(Compiler compiler) {
29 return compiler.codegen(this); 29 return compiler.codegen(this);
30 } 30 }
31 } 31 }
32 32
33 class Compiler implements DiagnosticListener { 33 class Compiler implements DiagnosticListener {
34 Queue<WorkItem> worklist; 34 Queue<WorkItem> worklist;
35 Universe universe; 35 Universe universe;
36 World world;
36 String assembledCode; 37 String assembledCode;
37 Namer namer; 38 Namer namer;
38 Types types; 39 Types types;
39 bool enableTypeAssertions = false; 40 bool enableTypeAssertions = false;
40 41
41 final Tracer tracer; 42 final Tracer tracer;
42 43
43 CompilerTask measuredTask; 44 CompilerTask measuredTask;
44 Element _currentElement; 45 Element _currentElement;
45 LibraryElement coreLibrary; 46 LibraryElement coreLibrary;
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
93 static final SourceString START_ROOT_ISOLATE = 94 static final SourceString START_ROOT_ISOLATE =
94 const SourceString('startRootIsolate'); 95 const SourceString('startRootIsolate');
95 bool enabledNoSuchMethod = false; 96 bool enabledNoSuchMethod = false;
96 97
97 bool workListIsClosed = false; 98 bool workListIsClosed = false;
98 99
99 Stopwatch codegenProgress; 100 Stopwatch codegenProgress;
100 101
101 Compiler([this.tracer = const Tracer()]) 102 Compiler([this.tracer = const Tracer()])
102 : universe = new Universe(), 103 : universe = new Universe(),
104 world = new World(),
103 worklist = new Queue<WorkItem>(), 105 worklist = new Queue<WorkItem>(),
104 codegenProgress = new Stopwatch.start() { 106 codegenProgress = new Stopwatch.start() {
105 namer = new Namer(this); 107 namer = new Namer(this);
106 constantHandler = new ConstantHandler(this); 108 constantHandler = new ConstantHandler(this);
107 scanner = new ScannerTask(this); 109 scanner = new ScannerTask(this);
108 dietParser = new DietParserTask(this); 110 dietParser = new DietParserTask(this);
109 parser = new ParserTask(this); 111 parser = new ParserTask(this);
110 validator = new TreeValidatorTask(this); 112 validator = new TreeValidatorTask(this);
111 resolver = new ResolverTask(this); 113 resolver = new ResolverTask(this);
112 checker = new TypeCheckerTask(this); 114 checker = new TypeCheckerTask(this);
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after
292 if (!main.isFunction()) { 294 if (!main.isFunction()) {
293 cancel('main is not a function', element: main); 295 cancel('main is not a function', element: main);
294 } 296 }
295 FunctionElement mainMethod = main; 297 FunctionElement mainMethod = main;
296 FunctionSignature parameters = mainMethod.computeSignature(this); 298 FunctionSignature parameters = mainMethod.computeSignature(this);
297 if (parameters.parameterCount > 0) { 299 if (parameters.parameterCount > 0) {
298 cancel('main cannot have parameters', element: mainMethod); 300 cancel('main cannot have parameters', element: mainMethod);
299 } 301 }
300 }); 302 });
301 } 303 }
302 native.processNativeClasses(this, universe.libraries.getValues()); 304 Collection<LibraryElement> libraries = universe.libraries.getValues();
305 native.processNativeClasses(this, libraries);
306 world.populate(this, libraries);
303 enqueue(new WorkItem.toCompile(main)); 307 enqueue(new WorkItem.toCompile(main));
304 codegenProgress.reset(); 308 codegenProgress.reset();
305 while (!worklist.isEmpty()) { 309 while (!worklist.isEmpty()) {
306 WorkItem work = worklist.removeLast(); 310 WorkItem work = worklist.removeLast();
307 withCurrentElement(work.element, () => (work.run)(this)); 311 withCurrentElement(work.element, () => (work.run)(this));
308 } 312 }
309 workListIsClosed = true; 313 workListIsClosed = true;
310 assert(enqueuer.checkNoEnqueuedInvokedInstanceMethods()); 314 assert(enqueuer.checkNoEnqueuedInvokedInstanceMethods());
311 enqueuer.registerFieldClosureInvocations(); 315 enqueuer.registerFieldClosureInvocations();
312 emitter.assembleProgram(); 316 emitter.assembleProgram();
(...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after
568 } 572 }
569 } 573 }
570 574
571 class SourceSpan { 575 class SourceSpan {
572 final Uri uri; 576 final Uri uri;
573 final int begin; 577 final int begin;
574 final int end; 578 final int end;
575 579
576 const SourceSpan(this.uri, this.begin, this.end); 580 const SourceSpan(this.uri, this.begin, this.end);
577 } 581 }
OLDNEW
« no previous file with comments | « no previous file | lib/compiler/implementation/leg.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698