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

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

Issue 2935063002: Add ClosedWorld.elementEnvironment and remove Compiler.elementEnvironment (Closed)
Patch Set: 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.closed_world2_test; 7 library dart2js.kernel.closed_world2_test;
8 8
9 import 'dart:async'; 9 import 'dart:async';
10 10
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 } 117 }
118 Expect.isFalse(compiler1.compilationFailed); 118 Expect.isFalse(compiler1.compilationFailed);
119 ResolutionEnqueuer enqueuer1 = compiler1.enqueuer.resolution; 119 ResolutionEnqueuer enqueuer1 = compiler1.enqueuer.resolution;
120 ClosedWorld closedWorld1 = compiler1.resolutionWorldBuilder.closeWorld(); 120 ClosedWorld closedWorld1 = compiler1.resolutionWorldBuilder.closeWorld();
121 BackendUsage backendUsage1 = closedWorld1.backendUsage; 121 BackendUsage backendUsage1 = closedWorld1.backendUsage;
122 122
123 Pair<Compiler, Compiler> compilers = 123 Pair<Compiler, Compiler> compilers =
124 await analyzeOnly(entryPoint, memorySourceFiles, printSteps: true); 124 await analyzeOnly(entryPoint, memorySourceFiles, printSteps: true);
125 Compiler compiler = compilers.a; 125 Compiler compiler = compilers.a;
126 compiler.resolutionWorldBuilder.closeWorld(); 126 compiler.resolutionWorldBuilder.closeWorld();
127 ElementEnvironment environment1 = compiler.elementEnvironment; 127 ElementEnvironment environment1 =
128 compiler.frontendStrategy.elementEnvironment;
128 129
129 Compiler compiler2 = compilers.b; 130 Compiler compiler2 = compilers.b;
130 KernelFrontEndStrategy frontendStrategy = compiler2.frontendStrategy; 131 KernelFrontEndStrategy frontendStrategy = compiler2.frontendStrategy;
131 KernelToElementMapImpl elementMap = frontendStrategy.elementMap; 132 KernelToElementMapImpl elementMap = frontendStrategy.elementMap;
132 Expect.isFalse(compiler2.compilationFailed); 133 Expect.isFalse(compiler2.compilationFailed);
133 134
134 KernelEquivalence equivalence = new KernelEquivalence(elementMap); 135 KernelEquivalence equivalence = new KernelEquivalence(elementMap);
135 TestStrategy strategy = equivalence.defaultStrategy; 136 TestStrategy strategy = equivalence.defaultStrategy;
136 137
137 ElementEnvironment environment2 = compiler2.elementEnvironment; 138 ElementEnvironment environment2 =
139 compiler2.frontendStrategy.elementEnvironment;
138 checkElementEnvironment(environment1, environment2, strategy); 140 checkElementEnvironment(environment1, environment2, strategy);
139 141
140 ResolutionEnqueuer enqueuer2 = compiler2.enqueuer.resolution; 142 ResolutionEnqueuer enqueuer2 = compiler2.enqueuer.resolution;
141 ClosedWorld closedWorld2 = compiler2.resolutionWorldBuilder.closeWorld(); 143 ClosedWorld closedWorld2 = compiler2.resolutionWorldBuilder.closeWorld();
142 BackendUsage backendUsage2 = closedWorld2.backendUsage; 144 BackendUsage backendUsage2 = closedWorld2.backendUsage;
143 145
144 checkNativeClasses(compiler1, compiler2, strategy); 146 checkNativeClasses(compiler1, compiler2, strategy);
145 147
146 checkBackendUsage(backendUsage1, backendUsage2, strategy); 148 checkBackendUsage(backendUsage1, backendUsage2, strategy);
147 149
148 checkResolutionEnqueuers(backendUsage1, backendUsage2, enqueuer1, enqueuer2, 150 checkResolutionEnqueuers(backendUsage1, backendUsage2, enqueuer1, enqueuer2,
149 elementEquivalence: equivalence.entityEquivalence, 151 elementEquivalence: equivalence.entityEquivalence,
150 typeEquivalence: (ResolutionDartType a, DartType b) { 152 typeEquivalence: (ResolutionDartType a, DartType b) {
151 return equivalence.typeEquivalence(unalias(a), b); 153 return equivalence.typeEquivalence(unalias(a), b);
152 }, elementFilter: elementFilter, verbose: arguments.verbose); 154 }, elementFilter: elementFilter, verbose: arguments.verbose);
153 155
154 checkClosedWorlds(closedWorld1, closedWorld2, 156 checkClosedWorlds(closedWorld1, closedWorld2,
155 strategy: equivalence.defaultStrategy, verbose: arguments.verbose); 157 strategy: equivalence.defaultStrategy, verbose: arguments.verbose);
156 158
157 return ResultKind.success; 159 return ResultKind.success;
158 } 160 }
OLDNEW
« no previous file with comments | « tests/compiler/dart2js/inference/inference_test_helper.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