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

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

Issue 2875313002: Access BackendUsage through ClosedWorld (Closed)
Patch Set: Created 3 years, 7 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.closed_world2_test; 7 library dart2js.kernel.closed_world2_test;
8 8
9 import 'dart:async'; 9 import 'dart:async';
10 10
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
135 if (collector.errors.isNotEmpty && skipErrors) { 135 if (collector.errors.isNotEmpty && skipErrors) {
136 print('Skipping due to errors.'); 136 print('Skipping due to errors.');
137 return ResultKind.errors; 137 return ResultKind.errors;
138 } 138 }
139 if (collector.warnings.isNotEmpty && skipWarnings) { 139 if (collector.warnings.isNotEmpty && skipWarnings) {
140 print('Skipping due to warnings.'); 140 print('Skipping due to warnings.');
141 return ResultKind.warnings; 141 return ResultKind.warnings;
142 } 142 }
143 Expect.isFalse(compiler1.compilationFailed); 143 Expect.isFalse(compiler1.compilationFailed);
144 ResolutionEnqueuer enqueuer1 = compiler1.enqueuer.resolution; 144 ResolutionEnqueuer enqueuer1 = compiler1.enqueuer.resolution;
145 BackendUsage backendUsage1 = compiler1.backend.backendUsage;
146 ClosedWorld closedWorld1 = compiler1.resolutionWorldBuilder.closeWorld(); 145 ClosedWorld closedWorld1 = compiler1.resolutionWorldBuilder.closeWorld();
146 BackendUsage backendUsage1 = closedWorld1.backendUsage;
147 147
148 Pair<Compiler, Compiler> compilers = 148 Pair<Compiler, Compiler> compilers =
149 await analyzeOnly(entryPoint, memorySourceFiles, printSteps: true); 149 await analyzeOnly(entryPoint, memorySourceFiles, printSteps: true);
150 Compiler compiler = compilers.a; 150 Compiler compiler = compilers.a;
151 compiler.resolutionWorldBuilder.closeWorld(); 151 compiler.resolutionWorldBuilder.closeWorld();
152 ElementEnvironment environment1 = compiler.elementEnvironment; 152 ElementEnvironment environment1 = compiler.elementEnvironment;
153 153
154 Compiler compiler2 = compilers.b; 154 Compiler compiler2 = compilers.b;
155 KernelFrontEndStrategy frontEndStrategy = compiler2.frontEndStrategy; 155 KernelFrontEndStrategy frontEndStrategy = compiler2.frontEndStrategy;
156 KernelToElementMapImpl elementMap = frontEndStrategy.elementMap; 156 KernelToElementMapImpl elementMap = frontEndStrategy.elementMap;
157 Expect.isFalse(compiler2.compilationFailed); 157 Expect.isFalse(compiler2.compilationFailed);
158 158
159 KernelEquivalence equivalence = new KernelEquivalence(elementMap); 159 KernelEquivalence equivalence = new KernelEquivalence(elementMap);
160 160
161 ElementEnvironment environment2 = compiler2.elementEnvironment; 161 ElementEnvironment environment2 = compiler2.elementEnvironment;
162 checkElementEnvironment(environment1, environment2, equivalence); 162 checkElementEnvironment(environment1, environment2, equivalence);
163 163
164 ResolutionEnqueuer enqueuer2 = compiler2.enqueuer.resolution; 164 ResolutionEnqueuer enqueuer2 = compiler2.enqueuer.resolution;
165 BackendUsage backendUsage2 = compiler2.backend.backendUsage;
166 ClosedWorld closedWorld2 = compiler2.resolutionWorldBuilder.closeWorld(); 165 ClosedWorld closedWorld2 = compiler2.resolutionWorldBuilder.closeWorld();
166 BackendUsage backendUsage2 = closedWorld2.backendUsage;
167 167
168 checkNativeClasses(compiler1, compiler2, equivalence); 168 checkNativeClasses(compiler1, compiler2, equivalence);
169 169
170 checkBackendUsage(backendUsage1, backendUsage2, equivalence); 170 checkBackendUsage(backendUsage1, backendUsage2, equivalence);
171 171
172 checkResolutionEnqueuers(backendUsage1, backendUsage2, enqueuer1, enqueuer2, 172 checkResolutionEnqueuers(backendUsage1, backendUsage2, enqueuer1, enqueuer2,
173 elementEquivalence: equivalence.entityEquivalence, 173 elementEquivalence: equivalence.entityEquivalence,
174 typeEquivalence: (ResolutionDartType a, DartType b) { 174 typeEquivalence: (ResolutionDartType a, DartType b) {
175 return equivalence.typeEquivalence(unalias(a), b); 175 return equivalence.typeEquivalence(unalias(a), b);
176 }, elementFilter: elementFilter, verbose: arguments.verbose); 176 }, elementFilter: elementFilter, verbose: arguments.verbose);
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after
362 }, equivalence.entityEquivalence); 362 }, equivalence.entityEquivalence);
363 363
364 classes2.add(cls2); 364 classes2.add(cls2);
365 }); 365 });
366 env2.forEachClass(lib2, (ClassEntity cls2) { 366 env2.forEachClass(lib2, (ClassEntity cls2) {
367 Expect.isTrue(classes2.contains(cls2), "Extra class $cls2 in $lib2"); 367 Expect.isTrue(classes2.contains(cls2), "Extra class $cls2 in $lib2");
368 }); 368 });
369 }); 369 });
370 // TODO(johnniwinther): Test the remaining properties of [ElementEnvironment]. 370 // TODO(johnniwinther): Test the remaining properties of [ElementEnvironment].
371 } 371 }
OLDNEW
« no previous file with comments | « tests/compiler/dart2js/deferred_mirrors_test.dart ('k') | tests/compiler/dart2js/kernel/closed_world_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698