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

Side by Side Diff: tests/compiler/dart2js/kernel/compiler_helper.dart

Issue 2912083002: Add compile_from_dill test (Closed)
Patch Set: Updated cf. comments Created 3 years, 6 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) 2017, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2017, 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 // Partial test that the closed world computed from [WorldImpact]s derived from 5 // Partial test that the closed world computed from [WorldImpact]s derived from
6 // kernel is equivalent to the original computed from resolution. 6 // kernel is equivalent to the original computed from resolution.
7 library dart2js.kernel.compiler_helper; 7 library dart2js.kernel.compiler_helper;
8 8
9 import 'dart:async'; 9 import 'dart:async';
10 import 'dart:io'; 10 import 'dart:io';
11 11
12 import 'package:compiler/compiler_new.dart';
12 import 'package:compiler/src/commandline_options.dart'; 13 import 'package:compiler/src/commandline_options.dart';
13 import 'package:compiler/src/common.dart'; 14 import 'package:compiler/src/common.dart';
14 import 'package:compiler/src/common/names.dart'; 15 import 'package:compiler/src/common/names.dart';
15 import 'package:compiler/src/common/tasks.dart'; 16 import 'package:compiler/src/common/tasks.dart';
16 import 'package:compiler/src/compiler.dart'; 17 import 'package:compiler/src/compiler.dart';
17 import 'package:compiler/src/elements/elements.dart'; 18 import 'package:compiler/src/elements/elements.dart';
18 import 'package:compiler/src/kernel/element_map_impl.dart'; 19 import 'package:compiler/src/kernel/element_map_impl.dart';
19 import 'package:compiler/src/kernel/kernel_strategy.dart'; 20 import 'package:compiler/src/kernel/kernel_strategy.dart';
20 import 'package:compiler/src/library_loader.dart'; 21 import 'package:compiler/src/library_loader.dart';
21 import 'package:compiler/src/universe/world_builder.dart'; 22 import 'package:compiler/src/universe/world_builder.dart';
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
132 DiagnosticReporter reporter, Measurer measurer, this.program) 133 DiagnosticReporter reporter, Measurer measurer, this.program)
133 : super(elementMap, null, null, reporter, measurer); 134 : super(elementMap, null, null, reporter, measurer);
134 135
135 Future<LoadedLibraries> loadLibrary(Uri resolvedUri, 136 Future<LoadedLibraries> loadLibrary(Uri resolvedUri,
136 {bool skipFileWithPartOfTag: false}) async { 137 {bool skipFileWithPartOfTag: false}) async {
137 return createLoadedLibraries(program); 138 return createLoadedLibraries(program);
138 } 139 }
139 } 140 }
140 141
141 Future<Compiler> compileWithDill( 142 Future<Compiler> compileWithDill(
142 Uri entryPoint, Map<String, String> memorySourceFiles, 143 Uri entryPoint, Map<String, String> memorySourceFiles, List<String> options,
143 {bool printSteps: false}) async { 144 {bool printSteps: false, CompilerOutput compilerOutput}) async {
144 if (memorySourceFiles.isNotEmpty) { 145 if (memorySourceFiles.isNotEmpty) {
145 Directory dir = await Directory.systemTemp.createTemp('dart2js-with-dill'); 146 Directory dir = await Directory.systemTemp.createTemp('dart2js-with-dill');
146 if (printSteps) { 147 if (printSteps) {
147 print('--- create temp directory $dir -------------------------------'); 148 print('--- create temp directory $dir -------------------------------');
148 } 149 }
149 memorySourceFiles.forEach((String name, String source) { 150 memorySourceFiles.forEach((String name, String source) {
150 new File.fromUri(dir.uri.resolve(name)).writeAsStringSync(source); 151 new File.fromUri(dir.uri.resolve(name)).writeAsStringSync(source);
151 }); 152 });
152 entryPoint = dir.uri.resolve(entryPoint.path); 153 entryPoint = dir.uri.resolve(entryPoint.path);
153 } 154 }
154 if (printSteps) { 155 if (printSteps) {
155 print('---- generate dill -----------------------------------------------'); 156 print('---- generate dill -----------------------------------------------');
156 } 157 }
157 158
158 Uri dillFile = Uri.parse('$entryPoint.dill'); 159 Uri dillFile = Uri.parse('$entryPoint.dill');
159 await generate.main([ 160 await generate.main([
160 '--platform=out/ReleaseX64/patched_dart2js_sdk/platform.dill', 161 '--platform=out/ReleaseX64/patched_dart2js_sdk/platform.dill',
161 '$entryPoint' 162 '$entryPoint'
162 ]); 163 ]);
163 164
164 if (printSteps) { 165 if (printSteps) {
165 print('---- closed world from dill $dillFile ----------------------------'); 166 print('---- closed world from dill $dillFile ----------------------------');
166 } 167 }
167 Compiler compiler = compilerFor(entryPoint: dillFile, options: [ 168 Compiler compiler = compilerFor(
168 Flags.analyzeOnly, 169 entryPoint: dillFile,
169 Flags.enableAssertMessage, 170 options: [Flags.loadFromDill]..addAll(options),
170 Flags.loadFromDill 171 outputProvider: compilerOutput);
171 ]);
172 ElementResolutionWorldBuilder.useInstantiationMap = true; 172 ElementResolutionWorldBuilder.useInstantiationMap = true;
173 compiler.resolution.retainCachesForTesting = true; 173 compiler.resolution.retainCachesForTesting = true;
174 await compiler.run(dillFile); 174 await compiler.run(dillFile);
175 return compiler; 175 return compiler;
176 } 176 }
OLDNEW
« no previous file with comments | « tests/compiler/dart2js/kernel/compile_from_dill_test.dart ('k') | tests/compiler/dart2js/output_collector.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698