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

Side by Side Diff: tests/compiler/dart2js/serialization/model_test_helper.dart

Issue 2387353002: Eagerly compute closure classes (Closed)
Patch Set: Add comments. Created 4 years, 2 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
« no previous file with comments | « pkg/compiler/lib/src/ssa/locals_handler.dart ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2015, 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.serialization_model_test; 5 library dart2js.serialization_model_test;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 import 'dart:io'; 8 import 'dart:io';
9 import 'package:async_helper/async_helper.dart'; 9 import 'package:async_helper/async_helper.dart';
10 import 'package:expect/expect.dart'; 10 import 'package:expect/expect.dart';
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 Test test, 65 Test test,
66 bool verbose: false}) async { 66 bool verbose: false}) async {
67 String testDescription = test != null ? test.name : '${entryPoint}'; 67 String testDescription = test != null ? test.name : '${entryPoint}';
68 String id = index != null ? '$index: ' : ''; 68 String id = index != null ? '$index: ' : '';
69 String title = '${id}${testDescription}'; 69 String title = '${id}${testDescription}';
70 Compiler compilerNormal = await measure(title, 'compile normal', () async { 70 Compiler compilerNormal = await measure(title, 'compile normal', () async {
71 Compiler compilerNormal = compilerFor( 71 Compiler compilerNormal = compilerFor(
72 memorySourceFiles: sourceFiles, options: [Flags.analyzeOnly]); 72 memorySourceFiles: sourceFiles, options: [Flags.analyzeOnly]);
73 compilerNormal.resolution.retainCachesForTesting = true; 73 compilerNormal.resolution.retainCachesForTesting = true;
74 await compilerNormal.run(entryPoint); 74 await compilerNormal.run(entryPoint);
75 compilerNormal.phase = Compiler.PHASE_DONE_RESOLVING; 75 compilerNormal.closeResolution();
76 compilerNormal.openWorld.closeWorld();
77 compilerNormal.backend.onResolutionComplete();
78 compilerNormal.deferredLoadTask
79 .onResolutionComplete(compilerNormal.mainFunction);
80 return compilerNormal; 76 return compilerNormal;
81 }); 77 });
82 78
83 Compiler compilerDeserialized = 79 Compiler compilerDeserialized =
84 await measure(title, 'compile deserialized', () async { 80 await measure(title, 'compile deserialized', () async {
85 Compiler compilerDeserialized = compilerFor( 81 Compiler compilerDeserialized = compilerFor(
86 memorySourceFiles: sourceFiles, 82 memorySourceFiles: sourceFiles,
87 resolutionInputs: resolutionInputs, 83 resolutionInputs: resolutionInputs,
88 options: [Flags.analyzeOnly]); 84 options: [Flags.analyzeOnly]);
89 compilerDeserialized.resolution.retainCachesForTesting = true; 85 compilerDeserialized.resolution.retainCachesForTesting = true;
90 await compilerDeserialized.run(entryPoint); 86 await compilerDeserialized.run(entryPoint);
91 compilerDeserialized.phase = Compiler.PHASE_DONE_RESOLVING; 87 compilerDeserialized.closeResolution();
92 compilerDeserialized.openWorld.closeWorld();
93 compilerDeserialized.backend.onResolutionComplete();
94 compilerDeserialized.deferredLoadTask
95 .onResolutionComplete(compilerDeserialized.mainFunction);
96 return compilerDeserialized; 88 return compilerDeserialized;
97 }); 89 });
98 90
99 return measure(title, 'check models', () async { 91 return measure(title, 'check models', () async {
100 checkAllImpacts(compilerNormal, compilerDeserialized, verbose: verbose); 92 checkAllImpacts(compilerNormal, compilerDeserialized, verbose: verbose);
101 93
102 checkSets( 94 checkSets(
103 compilerNormal.resolverWorld.directlyInstantiatedClasses, 95 compilerNormal.resolverWorld.directlyInstantiatedClasses,
104 compilerDeserialized.resolverWorld.directlyInstantiatedClasses, 96 compilerDeserialized.resolverWorld.directlyInstantiatedClasses,
105 "Directly instantiated classes mismatch", 97 "Directly instantiated classes mismatch",
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
188 "Extra deferred constant: ${value2.toStructuredText()}"); 180 "Extra deferred constant: ${value2.toStructuredText()}");
189 }, elementToString: (a) { 181 }, elementToString: (a) {
190 return '${a.toStructuredText()} -> ${constants1[a]}/${constants2[a]}'; 182 return '${a.toStructuredText()} -> ${constants1[a]}/${constants2[a]}';
191 }); 183 });
192 }); 184 });
193 } 185 }
194 186
195 void checkElements( 187 void checkElements(
196 Compiler compiler1, Compiler compiler2, Element element1, Element element2, 188 Compiler compiler1, Compiler compiler2, Element element1, Element element2,
197 {bool verbose: false}) { 189 {bool verbose: false}) {
190 if (element1.isAbstract) return;
198 if (element1.isFunction || 191 if (element1.isFunction ||
199 element1.isConstructor || 192 element1.isConstructor ||
200 (element1.isField && element1.isInstanceMember)) { 193 (element1.isField && element1.isInstanceMember)) {
201 AstElement astElement1 = element1; 194 AstElement astElement1 = element1;
202 AstElement astElement2 = element2; 195 AstElement astElement2 = element2;
203 ClosureClassMap closureData1 = compiler1.closureToClassMapper 196 ClosureClassMap closureData1 = compiler1.closureToClassMapper
204 .computeClosureToClassMapping(astElement1.resolvedAst); 197 .getClosureToClassMapping(astElement1.resolvedAst);
205 ClosureClassMap closureData2 = compiler2.closureToClassMapper 198 ClosureClassMap closureData2 = compiler2.closureToClassMapper
206 .computeClosureToClassMapping(astElement2.resolvedAst); 199 .getClosureToClassMapping(astElement2.resolvedAst);
207 200
208 checkElementIdentities( 201 checkElementIdentities(
209 closureData1, 202 closureData1,
210 closureData2, 203 closureData2,
211 '$element1.closureElement', 204 '$element1.closureElement',
212 closureData1.closureElement, 205 closureData1.closureElement,
213 closureData2.closureElement); 206 closureData2.closureElement);
214 checkElementIdentities( 207 checkElementIdentities(
215 closureData1, 208 closureData1,
216 closureData2, 209 closureData2,
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after
391 check(outputUnit1, outputUnit2, 'OutputUnit.isMainOutput $message', 384 check(outputUnit1, outputUnit2, 'OutputUnit.isMainOutput $message',
392 outputUnit1.isMainOutput, outputUnit2.isMainOutput); 385 outputUnit1.isMainOutput, outputUnit2.isMainOutput);
393 checkSetEquivalence( 386 checkSetEquivalence(
394 outputUnit1, 387 outputUnit1,
395 outputUnit2, 388 outputUnit2,
396 'OutputUnit.imports $message', 389 'OutputUnit.imports $message',
397 outputUnit1.imports, 390 outputUnit1.imports,
398 outputUnit2.imports, 391 outputUnit2.imports,
399 (a, b) => areElementsEquivalent(a.declaration, b.declaration)); 392 (a, b) => areElementsEquivalent(a.declaration, b.declaration));
400 } 393 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/ssa/locals_handler.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698