| OLD | NEW |
| 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'; |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 130 compiler.backend.kernelTask.program); | 130 compiler.backend.kernelTask.program); |
| 131 await compiler2.run(entryPoint); | 131 await compiler2.run(entryPoint); |
| 132 return new Pair<Compiler, Compiler>(compiler, compiler2); | 132 return new Pair<Compiler, Compiler>(compiler, compiler2); |
| 133 } | 133 } |
| 134 | 134 |
| 135 class MemoryKernelLibraryLoaderTask extends KernelLibraryLoaderTask { | 135 class MemoryKernelLibraryLoaderTask extends KernelLibraryLoaderTask { |
| 136 final ir.Program program; | 136 final ir.Program program; |
| 137 | 137 |
| 138 MemoryKernelLibraryLoaderTask(KernelToElementMapForImpact elementMap, | 138 MemoryKernelLibraryLoaderTask(KernelToElementMapForImpact elementMap, |
| 139 DiagnosticReporter reporter, Measurer measurer, this.program) | 139 DiagnosticReporter reporter, Measurer measurer, this.program) |
| 140 : super(null, elementMap, null, reporter, measurer); | 140 : super(null, null, elementMap, null, reporter, measurer); |
| 141 | 141 |
| 142 Future<LoadedLibraries> loadLibrary(Uri resolvedUri, | 142 Future<LoadedLibraries> loadLibrary(Uri resolvedUri, |
| 143 {bool skipFileWithPartOfTag: false}) async { | 143 {bool skipFileWithPartOfTag: false}) async { |
| 144 return createLoadedLibraries(program); | 144 return createLoadedLibraries(program); |
| 145 } | 145 } |
| 146 } | 146 } |
| 147 | 147 |
| 148 Future createTemp(Uri entryPoint, Map<String, String> memorySourceFiles, | 148 Future createTemp(Uri entryPoint, Map<String, String> memorySourceFiles, |
| 149 {bool printSteps: false}) async { | 149 {bool printSteps: false}) async { |
| 150 if (memorySourceFiles.isNotEmpty) { | 150 if (memorySourceFiles.isNotEmpty) { |
| (...skipping 30 matching lines...) Expand all Loading... |
| 181 } | 181 } |
| 182 | 182 |
| 183 Future<Compiler> compileWithDill( | 183 Future<Compiler> compileWithDill( |
| 184 {Uri entryPoint, | 184 {Uri entryPoint, |
| 185 Map<String, String> memorySourceFiles: const <String, String>{}, | 185 Map<String, String> memorySourceFiles: const <String, String>{}, |
| 186 List<String> options: const <String>[], | 186 List<String> options: const <String>[], |
| 187 CompilerDiagnostics diagnosticHandler, | 187 CompilerDiagnostics diagnosticHandler, |
| 188 bool printSteps: false, | 188 bool printSteps: false, |
| 189 CompilerOutput compilerOutput, | 189 CompilerOutput compilerOutput, |
| 190 void beforeRun(Compiler compiler)}) async { | 190 void beforeRun(Compiler compiler)}) async { |
| 191 Uri dillFile = | |
| 192 await generateDill(entryPoint, memorySourceFiles, printSteps: printSteps); | |
| 193 | |
| 194 if (printSteps) { | 191 if (printSteps) { |
| 195 print('---- compile from dill $dillFile ---------------------------------'); | 192 print('---- compile from dill -------------------------------------------'); |
| 196 } | 193 } |
| 197 Compiler compiler = compilerFor( | 194 Compiler compiler = compilerFor( |
| 198 entryPoint: dillFile, | 195 entryPoint: entryPoint, |
| 196 memorySourceFiles: memorySourceFiles, |
| 199 options: [Flags.useKernel]..addAll(options), | 197 options: [Flags.useKernel]..addAll(options), |
| 200 diagnosticHandler: diagnosticHandler, | 198 diagnosticHandler: diagnosticHandler, |
| 201 outputProvider: compilerOutput); | 199 outputProvider: compilerOutput); |
| 202 ElementResolutionWorldBuilder.useInstantiationMap = true; | 200 ElementResolutionWorldBuilder.useInstantiationMap = true; |
| 203 compiler.resolution.retainCachesForTesting = true; | 201 compiler.resolution.retainCachesForTesting = true; |
| 204 if (beforeRun != null) { | 202 if (beforeRun != null) { |
| 205 beforeRun(compiler); | 203 beforeRun(compiler); |
| 206 } | 204 } |
| 207 await compiler.run(dillFile); | 205 await compiler.run(entryPoint); |
| 208 return compiler; | 206 return compiler; |
| 209 } | 207 } |
| OLD | NEW |