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

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

Issue 10911006: Collect the types used in is-checks in the resolver phase. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 3 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 5
6 /** 6 /**
7 * If true, print a warning for each method that was resolved, but not 7 * If true, print a warning for each method that was resolved, but not
8 * compiled. 8 * compiled.
9 */ 9 */
10 const bool REPORT_EXCESS_RESOLUTION = false; 10 const bool REPORT_EXCESS_RESOLUTION = false;
(...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after
336 closureClass = lookupSpecialClass(const SourceString('Closure')); 336 closureClass = lookupSpecialClass(const SourceString('Closure'));
337 dynamicClass = lookupSpecialClass(const SourceString('Dynamic')); 337 dynamicClass = lookupSpecialClass(const SourceString('Dynamic'));
338 nullClass = lookupSpecialClass(const SourceString('Null')); 338 nullClass = lookupSpecialClass(const SourceString('Null'));
339 types = new Types(this, dynamicClass); 339 types = new Types(this, dynamicClass);
340 if (!coreLibValid) { 340 if (!coreLibValid) {
341 cancel('core library does not contain required classes'); 341 cancel('core library does not contain required classes');
342 } 342 }
343 343
344 jsIndexingBehaviorInterface = 344 jsIndexingBehaviorInterface =
345 findHelper(const SourceString('JavaScriptIndexingBehavior')); 345 findHelper(const SourceString('JavaScriptIndexingBehavior'));
346
347 // Register is-checks for all special classes.
ngeoffray 2012/08/30 11:03:33 Why? Is checks are for emitting the is$ClassName m
karlklose 2012/08/30 13:04:31 Done. I added internalErrors when elements were n
348 for (ClassElement cls in [objectClass, boolClass, numClass, intClass,
349 doubleClass, stringClass, functionClass,
350 listClass, closureClass, dynamicClass,
351 jsIndexingBehaviorInterface]) {
352 registerIsCheck(cls.computeType(this));
353 }
346 } 354 }
347 355
348 void scanBuiltinLibraries() { 356 void scanBuiltinLibraries() {
349 coreImplLibrary = scanBuiltinLibrary('coreimpl'); 357 coreImplLibrary = scanBuiltinLibrary('coreimpl');
350 jsHelperLibrary = scanBuiltinLibrary('_js_helper'); 358 jsHelperLibrary = scanBuiltinLibrary('_js_helper');
351 interceptorsLibrary = scanBuiltinLibrary('_interceptors'); 359 interceptorsLibrary = scanBuiltinLibrary('_interceptors');
352 360
353 addForeignFunctions(jsHelperLibrary); 361 addForeignFunctions(jsHelperLibrary);
354 addForeignFunctions(interceptorsLibrary); 362 addForeignFunctions(interceptorsLibrary);
355 363
356 libraries['dart:core'] = coreLibrary; 364 libraries['dart:core'] = coreLibrary;
357 libraries['dart:coreimpl'] = coreImplLibrary; 365 libraries['dart:coreimpl'] = coreImplLibrary;
358 366
359 assertMethod = coreLibrary.find(const SourceString('assert')); 367 assertMethod = coreLibrary.find(const SourceString('assert'));
360 368
361 initializeSpecialClasses(); 369 initializeSpecialClasses();
362
363 //patchDartLibrary(coreLibrary, 'core');
364 //patchDartLibrary(coreImplLibrary, 'coreimpl');
365 } 370 }
366 371
367 void importCoreLibrary(LibraryElement library) { 372 void importCoreLibrary(LibraryElement library) {
368 Uri coreUri = new Uri.fromComponents(scheme: 'dart', path: 'core'); 373 Uri coreUri = new Uri.fromComponents(scheme: 'dart', path: 'core');
369 if (coreLibrary === null) { 374 if (coreLibrary === null) {
370 coreLibrary = scanner.loadLibrary(coreUri, null, coreUri); 375 coreLibrary = scanner.loadLibrary(coreUri, null, coreUri);
371 } 376 }
372 scanner.importLibrary(library, 377 scanner.importLibrary(library,
373 coreLibrary, 378 coreLibrary,
374 null, 379 null,
(...skipping 451 matching lines...) Expand 10 before | Expand all | Expand 10 after
826 String get legDirectory { 831 String get legDirectory {
827 unimplemented('Compiler.legDirectory'); 832 unimplemented('Compiler.legDirectory');
828 } 833 }
829 834
830 Element findHelper(SourceString name) 835 Element findHelper(SourceString name)
831 => jsHelperLibrary.findLocal(name); 836 => jsHelperLibrary.findLocal(name);
832 Element findInterceptor(SourceString name) 837 Element findInterceptor(SourceString name)
833 => interceptorsLibrary.findLocal(name); 838 => interceptorsLibrary.findLocal(name);
834 839
835 bool get isMockCompilation => false; 840 bool get isMockCompilation => false;
841
842 registerIsCheck(Type type) {
ngeoffray 2012/08/30 11:03:33 Please remove this helper method, it is too confus
karlklose 2012/08/30 13:04:31 Done.
843 enqueuer.codegen.registerIsCheck(type);
844 enqueuer.resolution.registerIsCheck(type);
845 }
836 } 846 }
837 847
838 class CompilerTask { 848 class CompilerTask {
839 final Compiler compiler; 849 final Compiler compiler;
840 final Stopwatch watch; 850 final Stopwatch watch;
841 851
842 CompilerTask(this.compiler) : watch = new Stopwatch(); 852 CompilerTask(this.compiler) : watch = new Stopwatch();
843 853
844 String get name => 'Unknown task'; 854 String get name => 'Unknown task';
845 int get timing => watch.elapsedInMs(); 855 int get timing => watch.elapsedInMs();
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
896 final endOffset = end.charOffset + end.slowCharCount; 906 final endOffset = end.charOffset + end.slowCharCount;
897 907
898 // [begin] and [end] might be the same for the same empty token. This 908 // [begin] and [end] might be the same for the same empty token. This
899 // happens for instance when scanning '$$'. 909 // happens for instance when scanning '$$'.
900 assert(endOffset >= beginOffset); 910 assert(endOffset >= beginOffset);
901 return f(beginOffset, endOffset); 911 return f(beginOffset, endOffset);
902 } 912 }
903 913
904 String toString() => 'SourceSpan($uri, $begin, $end)'; 914 String toString() => 'SourceSpan($uri, $begin, $end)';
905 } 915 }
OLDNEW
« no previous file with comments | « no previous file | lib/compiler/implementation/enqueue.dart » ('j') | lib/compiler/implementation/resolver.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698