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

Side by Side Diff: dart/frog/leg/compiler.dart

Issue 9866006: Add library mapping. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 8 years, 9 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 Map<int, BailoutInfo> bailouts = null; 9 Map<int, BailoutInfo> bailouts = null;
10 bool allowSpeculativeOptimization = true; 10 bool allowSpeculativeOptimization = true;
(...skipping 24 matching lines...) Expand all
35 return compiler.codegen(this); 35 return compiler.codegen(this);
36 } 36 }
37 } 37 }
38 38
39 class Compiler implements DiagnosticListener { 39 class Compiler implements DiagnosticListener {
40 Queue<WorkItem> worklist; 40 Queue<WorkItem> worklist;
41 Universe universe; 41 Universe universe;
42 String assembledCode; 42 String assembledCode;
43 Namer namer; 43 Namer namer;
44 Types types; 44 Types types;
45 final String currentDirectory;
46 45
47 final Tracer tracer; 46 final Tracer tracer;
48 47
49 CompilerTask measuredTask; 48 CompilerTask measuredTask;
50 Element _currentElement; 49 Element _currentElement;
51 LibraryElement coreLibrary; 50 LibraryElement coreLibrary;
52 LibraryElement coreImplLibrary; 51 LibraryElement coreImplLibrary;
53 LibraryElement isolateLibrary; 52 LibraryElement isolateLibrary;
54 LibraryElement jsHelperLibrary; 53 LibraryElement jsHelperLibrary;
55 LibraryElement mainApp; 54 LibraryElement mainApp;
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 static final SourceString NO_SUCH_METHOD_EXCEPTION = 94 static final SourceString NO_SUCH_METHOD_EXCEPTION =
96 const SourceString('NoSuchMethodException'); 95 const SourceString('NoSuchMethodException');
97 static final SourceString START_ROOT_ISOLATE = 96 static final SourceString START_ROOT_ISOLATE =
98 const SourceString('startRootIsolate'); 97 const SourceString('startRootIsolate');
99 bool enabledNoSuchMethod = false; 98 bool enabledNoSuchMethod = false;
100 99
101 bool workListIsClosed = false; 100 bool workListIsClosed = false;
102 101
103 Stopwatch codegenProgress; 102 Stopwatch codegenProgress;
104 103
105 Compiler.withCurrentDirectory(String this.currentDirectory, 104 Compiler([this.tracer = const Tracer()])
106 [this.tracer = const Tracer()])
107 : types = new Types(), 105 : types = new Types(),
108 universe = new Universe(), 106 universe = new Universe(),
109 worklist = new Queue<WorkItem>(), 107 worklist = new Queue<WorkItem>(),
110 codegenProgress = new Stopwatch.start() { 108 codegenProgress = new Stopwatch.start() {
111 namer = new Namer(this); 109 namer = new Namer(this);
112 constantHandler = new ConstantHandler(this); 110 constantHandler = new ConstantHandler(this);
113 scanner = new ScannerTask(this); 111 scanner = new ScannerTask(this);
114 dietParser = new DietParserTask(this); 112 dietParser = new DietParserTask(this);
115 parser = new ParserTask(this); 113 parser = new ParserTask(this);
116 validator = new TreeValidatorTask(this); 114 validator = new TreeValidatorTask(this);
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
228 doubleClass = coreLibrary.find(const SourceString('double')); 226 doubleClass = coreLibrary.find(const SourceString('double'));
229 stringClass = coreLibrary.find(const SourceString('String')); 227 stringClass = coreLibrary.find(const SourceString('String'));
230 functionClass = coreLibrary.find(const SourceString('Function')); 228 functionClass = coreLibrary.find(const SourceString('Function'));
231 listClass = coreLibrary.find(const SourceString('List')); 229 listClass = coreLibrary.find(const SourceString('List'));
232 closureClass = jsHelperLibrary.find(const SourceString('Closure')); 230 closureClass = jsHelperLibrary.find(const SourceString('Closure'));
233 dynamicClass = jsHelperLibrary.find(const SourceString('Dynamic')); 231 dynamicClass = jsHelperLibrary.find(const SourceString('Dynamic'));
234 nullClass = jsHelperLibrary.find(const SourceString('Null')); 232 nullClass = jsHelperLibrary.find(const SourceString('Null'));
235 } 233 }
236 234
237 void scanBuiltinLibraries() { 235 void scanBuiltinLibraries() {
238 coreImplLibrary = scanBuiltinLibrary('coreimpl.dart'); 236 coreImplLibrary = scanBuiltinLibrary('coreimpl');
239 jsHelperLibrary = scanBuiltinLibrary('js_helper.dart'); 237 jsHelperLibrary = scanBuiltinLibrary('_js_helper');
240 coreLibrary = scanBuiltinLibrary('core.dart'); 238 coreLibrary = scanBuiltinLibrary('core');
241 239
242 // Since coreLibrary import the libraries "coreimpl", and 240 // Since coreLibrary import the libraries "coreimpl", and
243 // "js_helper", coreLibrary is null when they are being built. So 241 // "js_helper", coreLibrary is null when they are being built. So
244 // we add the implicit import of coreLibrary now. This can be 242 // we add the implicit import of coreLibrary now. This can be
245 // cleaned up when we have proper support for "dart:core" and 243 // cleaned up when we have proper support for "dart:core" and
246 // don't need to access it through the field "coreLibrary". 244 // don't need to access it through the field "coreLibrary".
247 // TODO(ahe): Clean this up as described above. 245 // TODO(ahe): Clean this up as described above.
248 scanner.importLibrary(coreImplLibrary, coreLibrary, null); 246 scanner.importLibrary(coreImplLibrary, coreLibrary, null);
249 scanner.importLibrary(jsHelperLibrary, coreLibrary, null); 247 scanner.importLibrary(jsHelperLibrary, coreLibrary, null);
250 addForeignFunctions(jsHelperLibrary); 248 addForeignFunctions(jsHelperLibrary);
(...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after
538 } 536 }
539 } 537 }
540 538
541 class SourceSpan { 539 class SourceSpan {
542 final Uri uri; 540 final Uri uri;
543 final int begin; 541 final int begin;
544 final int end; 542 final int end;
545 543
546 const SourceSpan(this.uri, this.begin, this.end); 544 const SourceSpan(this.uri, this.begin, this.end);
547 } 545 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698