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

Side by Side Diff: dart/sdk/lib/_internal/compiler/implementation/compiler.dart

Issue 12033003: Deferred (aka lazy) loading of static functions. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: Rebased Created 7 years, 10 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 part of dart2js; 5 part of dart2js;
6 6
7 /** 7 /**
8 * If true, print a warning for each method that was resolved, but not 8 * If true, print a warning for each method that was resolved, but not
9 * compiled. 9 * compiled.
10 */ 10 */
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after
227 ClassElement boolClass; 227 ClassElement boolClass;
228 ClassElement numClass; 228 ClassElement numClass;
229 ClassElement intClass; 229 ClassElement intClass;
230 ClassElement doubleClass; 230 ClassElement doubleClass;
231 ClassElement stringClass; 231 ClassElement stringClass;
232 ClassElement functionClass; 232 ClassElement functionClass;
233 ClassElement nullClass; 233 ClassElement nullClass;
234 ClassElement listClass; 234 ClassElement listClass;
235 ClassElement typeClass; 235 ClassElement typeClass;
236 ClassElement mapClass; 236 ClassElement mapClass;
237 ClassElement deferLoadClass;
238 ClassElement onLibraryLoadedClass;
239
237 ClassElement jsInvocationMirrorClass; 240 ClassElement jsInvocationMirrorClass;
238 /// Document class from dart:mirrors. 241 /// Document class from dart:mirrors.
239 ClassElement documentClass; 242 ClassElement documentClass;
240 Element assertMethod; 243 Element assertMethod;
241 Element identicalFunction; 244 Element identicalFunction;
242 Element functionApplyMethod; 245 Element functionApplyMethod;
243 Element invokeOnMethod; 246 Element invokeOnMethod;
244 Element createInvocationMirrorElement; 247 Element createInvocationMirrorElement;
245 248
246 Element get currentElement => _currentElement; 249 Element get currentElement => _currentElement;
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
284 TreeValidatorTask validator; 287 TreeValidatorTask validator;
285 ResolverTask resolver; 288 ResolverTask resolver;
286 closureMapping.ClosureTask closureToClassMapper; 289 closureMapping.ClosureTask closureToClassMapper;
287 TypeCheckerTask checker; 290 TypeCheckerTask checker;
288 ti.TypesTask typesTask; 291 ti.TypesTask typesTask;
289 Backend backend; 292 Backend backend;
290 ConstantHandler constantHandler; 293 ConstantHandler constantHandler;
291 ConstantHandler metadataHandler; 294 ConstantHandler metadataHandler;
292 EnqueueTask enqueuer; 295 EnqueueTask enqueuer;
293 CompilerTask fileReadingTask; 296 CompilerTask fileReadingTask;
297 DeferredLoadTask deferredLoadTask;
294 298
295 static const SourceString MAIN = const SourceString('main'); 299 static const SourceString MAIN = const SourceString('main');
296 static const SourceString CALL_OPERATOR_NAME = const SourceString('call'); 300 static const SourceString CALL_OPERATOR_NAME = const SourceString('call');
297 static const SourceString NO_SUCH_METHOD = const SourceString('noSuchMethod'); 301 static const SourceString NO_SUCH_METHOD = const SourceString('noSuchMethod');
298 static const int NO_SUCH_METHOD_ARG_COUNT = 1; 302 static const int NO_SUCH_METHOD_ARG_COUNT = 1;
299 static const SourceString CREATE_INVOCATION_MIRROR = 303 static const SourceString CREATE_INVOCATION_MIRROR =
300 const SourceString('createInvocationMirror'); 304 const SourceString('createInvocationMirror');
301 static const SourceString INVOKE_ON = const SourceString('invokeOn'); 305 static const SourceString INVOKE_ON = const SourceString('invokeOn');
302 static const SourceString RUNTIME_TYPE = const SourceString('runtimeType'); 306 static const SourceString RUNTIME_TYPE = const SourceString('runtimeType');
303 static const SourceString START_ROOT_ISOLATE = 307 static const SourceString START_ROOT_ISOLATE =
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
362 libraryLoader = new LibraryLoaderTask(this), 366 libraryLoader = new LibraryLoaderTask(this),
363 scanner = new ScannerTask(this), 367 scanner = new ScannerTask(this),
364 dietParser = new DietParserTask(this), 368 dietParser = new DietParserTask(this),
365 parser = new ParserTask(this), 369 parser = new ParserTask(this),
366 patchParser = new PatchParserTask(this), 370 patchParser = new PatchParserTask(this),
367 resolver = new ResolverTask(this), 371 resolver = new ResolverTask(this),
368 closureToClassMapper = new closureMapping.ClosureTask(this, closureNamer), 372 closureToClassMapper = new closureMapping.ClosureTask(this, closureNamer),
369 checker = new TypeCheckerTask(this), 373 checker = new TypeCheckerTask(this),
370 typesTask = new ti.TypesTask(this), 374 typesTask = new ti.TypesTask(this),
371 constantHandler = new ConstantHandler(this, backend.constantSystem), 375 constantHandler = new ConstantHandler(this, backend.constantSystem),
376 deferredLoadTask = new DeferredLoadTask(this),
372 enqueuer = new EnqueueTask(this)]; 377 enqueuer = new EnqueueTask(this)];
373 378
374 tasks.addAll(backend.tasks); 379 tasks.addAll(backend.tasks);
375 metadataHandler = new ConstantHandler( 380 metadataHandler = new ConstantHandler(
376 this, backend.constantSystem, isMetadata: true); 381 this, backend.constantSystem, isMetadata: true);
377 } 382 }
378 383
379 ResolutionUniverse get resolverWorld => enqueuer.resolution.universe; 384 ResolutionUniverse get resolverWorld => enqueuer.resolution.universe;
380 CodegenUniverse get codegenWorld => enqueuer.codegen.universe; 385 CodegenUniverse get codegenWorld => enqueuer.codegen.universe;
381 386
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
514 objectClass = lookupCoreClass('Object'); 519 objectClass = lookupCoreClass('Object');
515 boolClass = lookupCoreClass('bool'); 520 boolClass = lookupCoreClass('bool');
516 numClass = lookupCoreClass('num'); 521 numClass = lookupCoreClass('num');
517 intClass = lookupCoreClass('int'); 522 intClass = lookupCoreClass('int');
518 doubleClass = lookupCoreClass('double'); 523 doubleClass = lookupCoreClass('double');
519 stringClass = lookupCoreClass('String'); 524 stringClass = lookupCoreClass('String');
520 functionClass = lookupCoreClass('Function'); 525 functionClass = lookupCoreClass('Function');
521 listClass = lookupCoreClass('List'); 526 listClass = lookupCoreClass('List');
522 typeClass = lookupCoreClass('Type'); 527 typeClass = lookupCoreClass('Type');
523 mapClass = lookupCoreClass('Map'); 528 mapClass = lookupCoreClass('Map');
529 deferLoadClass = lookupCoreClass('DeferLoad');
530 onLibraryLoadedClass = lookupCoreClass('OnLibraryLoaded');
524 if (!missingCoreClasses.isEmpty) { 531 if (!missingCoreClasses.isEmpty) {
525 internalErrorOnElement(coreLibrary, 532 internalErrorOnElement(coreLibrary,
526 'dart:core library does not contain required classes: ' 533 'dart:core library does not contain required classes: '
527 '$missingCoreClasses'); 534 '$missingCoreClasses');
528 } 535 }
529 536
530 final List missingHelperClasses = []; 537 final List missingHelperClasses = [];
531 ClassElement lookupHelperClass(String name) { 538 ClassElement lookupHelperClass(String name) {
532 ClassElement result = jsHelperLibrary.find(new SourceString(name)); 539 ClassElement result = jsHelperLibrary.find(new SourceString(name));
533 if (result == null) { 540 if (result == null) {
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
628 reportFatalError('main is not a function', main); 635 reportFatalError('main is not a function', main);
629 } 636 }
630 FunctionElement mainMethod = main; 637 FunctionElement mainMethod = main;
631 FunctionSignature parameters = mainMethod.computeSignature(this); 638 FunctionSignature parameters = mainMethod.computeSignature(this);
632 parameters.forEachParameter((Element parameter) { 639 parameters.forEachParameter((Element parameter) {
633 reportFatalError('main cannot have parameters', parameter); 640 reportFatalError('main cannot have parameters', parameter);
634 }); 641 });
635 } 642 }
636 } 643 }
637 644
645 deferredLoadTask.registerMainApp(mainApp);
646
638 log('Resolving...'); 647 log('Resolving...');
639 phase = PHASE_RESOLVING; 648 phase = PHASE_RESOLVING;
640 if (analyzeAll) { 649 if (analyzeAll) {
641 libraries.forEach((_, lib) => fullyEnqueueLibrary(lib)); 650 libraries.forEach((_, lib) => fullyEnqueueLibrary(lib));
642 } 651 }
643 backend.enqueueHelpers(enqueuer.resolution); 652 backend.enqueueHelpers(enqueuer.resolution);
644 processQueue(enqueuer.resolution, main); 653 processQueue(enqueuer.resolution, main);
645 enqueuer.resolution.logSummary(log); 654 enqueuer.resolution.logSummary(log);
646 655
647 if (compilationFailed) return; 656 if (compilationFailed) return;
(...skipping 470 matching lines...) Expand 10 before | Expand all | Expand 10 after
1118 1127
1119 void close() {} 1128 void close() {}
1120 1129
1121 toString() => name; 1130 toString() => name;
1122 1131
1123 /// Convenience method for getting an [api.CompilerOutputProvider]. 1132 /// Convenience method for getting an [api.CompilerOutputProvider].
1124 static NullSink outputProvider(String name, String extension) { 1133 static NullSink outputProvider(String name, String extension) {
1125 return new NullSink('$name.$extension'); 1134 return new NullSink('$name.$extension');
1126 } 1135 }
1127 } 1136 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698