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

Side by Side Diff: tests/compiler/dart2js/memory_compiler.dart

Issue 2265473004: Introduce "CommonElements" (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: cl Created 4 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
OLDNEW
1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2016, 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.test.memory_compiler; 5 library dart2js.test.memory_compiler;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 8
9 import 'package:compiler/compiler.dart' show 9 import 'package:compiler/compiler.dart' show
10 DiagnosticHandler; 10 DiagnosticHandler;
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
152 entryPoint: entryPoint, 152 entryPoint: entryPoint,
153 resolutionInputs: resolutionInputs, 153 resolutionInputs: resolutionInputs,
154 libraryRoot: libraryRoot, 154 libraryRoot: libraryRoot,
155 packageRoot: packageRoot, 155 packageRoot: packageRoot,
156 options: options, 156 options: options,
157 environment: {}, 157 environment: {},
158 packageConfig: packageConfig, 158 packageConfig: packageConfig,
159 packagesDiscoveryProvider: packagesDiscoveryProvider)); 159 packagesDiscoveryProvider: packagesDiscoveryProvider));
160 160
161 if (cachedCompiler != null) { 161 if (cachedCompiler != null) {
162 compiler.coreLibrary =
163 cachedCompiler.libraryLoader.lookupLibrary(Uri.parse('dart:core'));
164 compiler.types = cachedCompiler.types.copy(compiler.resolution); 162 compiler.types = cachedCompiler.types.copy(compiler.resolution);
165 Map copiedLibraries = {}; 163 Map copiedLibraries = {};
166 cachedCompiler.libraryLoader.libraries.forEach((library) { 164 cachedCompiler.libraryLoader.libraries.forEach((library) {
167 if (library.isPlatformLibrary) { 165 if (library.isPlatformLibrary) {
168 var libraryLoader = compiler.libraryLoader; 166 var libraryLoader = compiler.libraryLoader;
169 libraryLoader.mapLibrary(library); 167 libraryLoader.mapLibrary(library);
170 compiler.onLibraryCreated(library); 168 compiler.onLibraryCreated(library);
171 compiler.onLibraryScanned(library, null); 169 compiler.onLibraryScanned(library, null);
172 if (library.isPatched) { 170 if (library.isPatched) {
173 var patchLibrary = library.patch; 171 var patchLibrary = library.patch;
174 compiler.onLibraryCreated(patchLibrary); 172 compiler.onLibraryCreated(patchLibrary);
175 compiler.onLibraryScanned(patchLibrary, null); 173 compiler.onLibraryScanned(patchLibrary, null);
176 } 174 }
177 copiedLibraries[library.canonicalUri] = library; 175 copiedLibraries[library.canonicalUri] = library;
178 } 176 }
179 }); 177 });
180 // TODO(johnniwinther): Assert that no libraries are loaded lazily from 178 // TODO(johnniwinther): Assert that no libraries are loaded lazily from
181 // this call. 179 // this call.
182 compiler.onLibrariesLoaded(new MemoryLoadedLibraries(copiedLibraries)); 180 compiler.onLibrariesLoaded(new MemoryLoadedLibraries(copiedLibraries));
183 181
184 compiler.backend.constantCompilerTask.copyConstantValues( 182 compiler.backend.constantCompilerTask.copyConstantValues(
185 cachedCompiler.backend.constantCompilerTask); 183 cachedCompiler.backend.constantCompilerTask);
186 compiler.mirrorSystemClass = cachedCompiler.mirrorSystemClass;
187 compiler.mirrorsUsedClass = cachedCompiler.mirrorsUsedClass;
188 compiler.mirrorSystemGetNameFunction =
189 cachedCompiler.mirrorSystemGetNameFunction;
190 compiler.mirrorsUsedConstructor = cachedCompiler.mirrorsUsedConstructor;
191 compiler.deferredLibraryClass = cachedCompiler.deferredLibraryClass;
192 184
193 Iterable cachedTreeElements = 185 Iterable cachedTreeElements =
194 cachedCompiler.enqueuer.resolution.processedElements; 186 cachedCompiler.enqueuer.resolution.processedElements;
195 cachedTreeElements.forEach((element) { 187 cachedTreeElements.forEach((element) {
196 if (element.library.isPlatformLibrary) { 188 if (element.library.isPlatformLibrary) {
197 compiler.enqueuer.resolution.registerProcessedElement(element); 189 compiler.enqueuer.resolution.registerProcessedElement(element);
198 } 190 }
199 }); 191 });
200 192
201 // One potential problem that can occur when reusing elements is that there 193 // One potential problem that can occur when reusing elements is that there
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
254 handler = (Uri uri, int begin, int end, String message, Diagnostic kind) { 246 handler = (Uri uri, int begin, int end, String message, Diagnostic kind) {
255 diagnosticHandler(uri, begin, end, message, kind); 247 diagnosticHandler(uri, begin, end, message, kind);
256 formattingHandler(uri, begin, end, message, kind); 248 formattingHandler(uri, begin, end, message, kind);
257 }; 249 };
258 } 250 }
259 } else if (diagnosticHandler == null) { 251 } else if (diagnosticHandler == null) {
260 handler = (Uri uri, int begin, int end, String message, Diagnostic kind) {}; 252 handler = (Uri uri, int begin, int end, String message, Diagnostic kind) {};
261 } 253 }
262 return handler; 254 return handler;
263 } 255 }
OLDNEW
« no previous file with comments | « tests/compiler/dart2js/compiler_helper.dart ('k') | tests/compiler/dart2js/minimal_resolution_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698