OLD | NEW |
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 library dart2js.compiler_base; | 5 library dart2js.compiler_base; |
6 | 6 |
7 import 'dart:async' show | 7 import 'dart:async' show |
8 EventSink, | 8 EventSink, |
9 Future; | 9 Future; |
10 | 10 |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
77 import 'js_backend/backend_helpers.dart' as js_backend show | 77 import 'js_backend/backend_helpers.dart' as js_backend show |
78 BackendHelpers; | 78 BackendHelpers; |
79 import 'js_backend/js_backend.dart' as js_backend show | 79 import 'js_backend/js_backend.dart' as js_backend show |
80 JavaScriptBackend; | 80 JavaScriptBackend; |
81 import 'library_loader.dart' show | 81 import 'library_loader.dart' show |
82 LibraryLoader, | 82 LibraryLoader, |
83 LibraryLoaderTask, | 83 LibraryLoaderTask, |
84 LoadedLibraries; | 84 LoadedLibraries; |
85 import 'mirrors_used.dart' show | 85 import 'mirrors_used.dart' show |
86 MirrorUsageAnalyzerTask; | 86 MirrorUsageAnalyzerTask; |
| 87 import 'common/names.dart' show |
| 88 Selectors; |
87 import 'null_compiler_output.dart' show | 89 import 'null_compiler_output.dart' show |
88 NullCompilerOutput, | 90 NullCompilerOutput, |
89 NullSink; | 91 NullSink; |
90 import 'parser/diet_parser_task.dart' show | 92 import 'parser/diet_parser_task.dart' show |
91 DietParserTask; | 93 DietParserTask; |
92 import 'parser/element_listener.dart' show | 94 import 'parser/element_listener.dart' show |
93 ScannerOptions; | 95 ScannerOptions; |
94 import 'parser/parser_task.dart' show | 96 import 'parser/parser_task.dart' show |
95 ParserTask; | 97 ParserTask; |
96 import 'patch_parser.dart' show | 98 import 'patch_parser.dart' show |
(...skipping 738 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
835 Uri resolvePatchUri(String dartLibraryPath); | 837 Uri resolvePatchUri(String dartLibraryPath); |
836 | 838 |
837 Future runInternal(Uri uri) { | 839 Future runInternal(Uri uri) { |
838 // TODO(ahe): This prevents memory leaks when invoking the compiler | 840 // TODO(ahe): This prevents memory leaks when invoking the compiler |
839 // multiple times. Implement a better mechanism where we can store | 841 // multiple times. Implement a better mechanism where we can store |
840 // such caches in the compiler and get access to them through a | 842 // such caches in the compiler and get access to them through a |
841 // suitably maintained static reference to the current compiler. | 843 // suitably maintained static reference to the current compiler. |
842 StringToken.canonicalizedSubstrings.clear(); | 844 StringToken.canonicalizedSubstrings.clear(); |
843 Selector.canonicalizedValues.clear(); | 845 Selector.canonicalizedValues.clear(); |
844 | 846 |
| 847 // The selector objects held in static fields must remain canonical. |
| 848 for (Selector selector in Selectors.ALL) { |
| 849 Selector.canonicalizedValues |
| 850 .putIfAbsent(selector.hashCode, () => <Selector>[]) |
| 851 .add(selector); |
| 852 } |
| 853 |
845 assert(uri != null || analyzeOnly || hasIncrementalSupport); | 854 assert(uri != null || analyzeOnly || hasIncrementalSupport); |
846 return new Future.sync(() { | 855 return new Future.sync(() { |
847 if (librariesToAnalyzeWhenRun != null) { | 856 if (librariesToAnalyzeWhenRun != null) { |
848 return Future.forEach(librariesToAnalyzeWhenRun, (libraryUri) { | 857 return Future.forEach(librariesToAnalyzeWhenRun, (libraryUri) { |
849 reporter.log('Analyzing $libraryUri ($buildId)'); | 858 reporter.log('Analyzing $libraryUri ($buildId)'); |
850 return libraryLoader.loadLibrary(libraryUri); | 859 return libraryLoader.loadLibrary(libraryUri); |
851 }); | 860 }); |
852 } | 861 } |
853 }).then((_) { | 862 }).then((_) { |
854 if (uri != null) { | 863 if (uri != null) { |
(...skipping 1203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2058 if (element == null) return; | 2067 if (element == null) return; |
2059 if (_otherDependencies == null) { | 2068 if (_otherDependencies == null) { |
2060 _otherDependencies = new Setlet<Element>(); | 2069 _otherDependencies = new Setlet<Element>(); |
2061 } | 2070 } |
2062 _otherDependencies.add(element.implementation); | 2071 _otherDependencies.add(element.implementation); |
2063 } | 2072 } |
2064 | 2073 |
2065 Iterable<Element> get otherDependencies { | 2074 Iterable<Element> get otherDependencies { |
2066 return _otherDependencies != null ? _otherDependencies : const <Element>[]; | 2075 return _otherDependencies != null ? _otherDependencies : const <Element>[]; |
2067 } | 2076 } |
2068 } | 2077 } |
OLD | NEW |