OLD | NEW |
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 'package:async_helper/async_helper.dart'; | 8 import 'package:async_helper/async_helper.dart'; |
9 import 'package:expect/expect.dart'; | 9 import 'package:expect/expect.dart'; |
10 import 'package:compiler/src/closure.dart'; | 10 import 'package:compiler/src/closure.dart'; |
11 import 'package:compiler/src/commandline_options.dart'; | 11 import 'package:compiler/src/commandline_options.dart'; |
| 12 import 'package:compiler/src/common_elements.dart'; |
12 import 'package:compiler/src/constants/values.dart'; | 13 import 'package:compiler/src/constants/values.dart'; |
13 import 'package:compiler/src/compiler.dart'; | 14 import 'package:compiler/src/compiler.dart'; |
14 import 'package:compiler/src/deferred_load.dart'; | 15 import 'package:compiler/src/deferred_load.dart'; |
15 import 'package:compiler/src/elements/elements.dart'; | 16 import 'package:compiler/src/elements/elements.dart'; |
16 import 'package:compiler/src/elements/entities.dart'; | 17 import 'package:compiler/src/elements/entities.dart'; |
17 import 'package:compiler/src/js_backend/js_backend.dart'; | 18 import 'package:compiler/src/js_backend/js_backend.dart'; |
18 import 'package:compiler/src/serialization/equivalence.dart'; | 19 import 'package:compiler/src/serialization/equivalence.dart'; |
19 import 'package:compiler/src/tree/nodes.dart'; | 20 import 'package:compiler/src/tree/nodes.dart'; |
20 import 'package:compiler/src/world.dart'; | 21 import 'package:compiler/src/world.dart'; |
21 import '../memory_compiler.dart'; | 22 import '../memory_compiler.dart'; |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
64 Test test, | 65 Test test, |
65 bool verbose: false}) async { | 66 bool verbose: false}) async { |
66 String testDescription = test != null ? test.name : '${entryPoint}'; | 67 String testDescription = test != null ? test.name : '${entryPoint}'; |
67 String id = index != null ? '$index: ' : ''; | 68 String id = index != null ? '$index: ' : ''; |
68 String title = '${id}${testDescription}'; | 69 String title = '${id}${testDescription}'; |
69 Compiler compilerNormal = await measure(title, 'compile normal', () async { | 70 Compiler compilerNormal = await measure(title, 'compile normal', () async { |
70 Compiler compilerNormal = compilerFor( | 71 Compiler compilerNormal = compilerFor( |
71 memorySourceFiles: sourceFiles, options: [Flags.analyzeOnly]); | 72 memorySourceFiles: sourceFiles, options: [Flags.analyzeOnly]); |
72 compilerNormal.resolution.retainCachesForTesting = true; | 73 compilerNormal.resolution.retainCachesForTesting = true; |
73 await compilerNormal.run(entryPoint); | 74 await compilerNormal.run(entryPoint); |
74 compilerNormal.closeResolution(); | 75 ElementEnvironment elementEnvironment = |
| 76 compilerNormal.frontendStrategy.elementEnvironment; |
| 77 compilerNormal.closeResolution(elementEnvironment.mainFunction); |
75 return compilerNormal; | 78 return compilerNormal; |
76 }); | 79 }); |
77 | 80 |
78 Compiler compilerDeserialized = | 81 Compiler compilerDeserialized = |
79 await measure(title, 'compile deserialized', () async { | 82 await measure(title, 'compile deserialized', () async { |
80 Compiler compilerDeserialized = compilerFor( | 83 Compiler compilerDeserialized = compilerFor( |
81 memorySourceFiles: sourceFiles, | 84 memorySourceFiles: sourceFiles, |
82 resolutionInputs: resolutionInputs, | 85 resolutionInputs: resolutionInputs, |
83 options: [Flags.analyzeOnly]); | 86 options: [Flags.analyzeOnly]); |
84 compilerDeserialized.resolution.retainCachesForTesting = true; | 87 compilerDeserialized.resolution.retainCachesForTesting = true; |
85 await compilerDeserialized.run(entryPoint); | 88 await compilerDeserialized.run(entryPoint); |
86 compilerDeserialized.closeResolution(); | 89 ElementEnvironment elementEnvironment = |
| 90 compilerDeserialized.frontendStrategy.elementEnvironment; |
| 91 compilerDeserialized.closeResolution(elementEnvironment.mainFunction); |
87 return compilerDeserialized; | 92 return compilerDeserialized; |
88 }); | 93 }); |
89 | 94 |
90 return measure(title, 'check models', () async { | 95 return measure(title, 'check models', () async { |
91 checkAllImpacts(compilerNormal, compilerDeserialized, verbose: verbose); | 96 checkAllImpacts(compilerNormal, compilerDeserialized, verbose: verbose); |
92 ClosedWorld closedWorld1 = | 97 ClosedWorld closedWorld1 = |
93 compilerNormal.resolutionWorldBuilder.closedWorldForTesting; | 98 compilerNormal.resolutionWorldBuilder.closedWorldForTesting; |
94 ClosedWorld closedWorld2 = | 99 ClosedWorld closedWorld2 = |
95 compilerNormal.resolutionWorldBuilder.closedWorldForTesting; | 100 compilerNormal.resolutionWorldBuilder.closedWorldForTesting; |
96 checkResolutionEnqueuers( | 101 checkResolutionEnqueuers( |
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
286 check(outputUnit1, outputUnit2, 'OutputUnit.isMainOutput $message', | 291 check(outputUnit1, outputUnit2, 'OutputUnit.isMainOutput $message', |
287 outputUnit1.isMainOutput, outputUnit2.isMainOutput); | 292 outputUnit1.isMainOutput, outputUnit2.isMainOutput); |
288 checkSetEquivalence( | 293 checkSetEquivalence( |
289 outputUnit1, | 294 outputUnit1, |
290 outputUnit2, | 295 outputUnit2, |
291 'OutputUnit.imports $message', | 296 'OutputUnit.imports $message', |
292 outputUnit1.imports, | 297 outputUnit1.imports, |
293 outputUnit2.imports, | 298 outputUnit2.imports, |
294 (a, b) => areElementsEquivalent(a.declaration, b.declaration)); | 299 (a, b) => areElementsEquivalent(a.declaration, b.declaration)); |
295 } | 300 } |
OLD | NEW |