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 '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 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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.phase = Compiler.PHASE_DONE_RESOLVING; |
76 compilerNormal.openWorld.populate(); | 76 compilerNormal.openWorld.closeWorld(); |
77 compilerNormal.backend.onResolutionComplete(); | 77 compilerNormal.backend.onResolutionComplete(); |
78 compilerNormal.deferredLoadTask | 78 compilerNormal.deferredLoadTask |
79 .onResolutionComplete(compilerNormal.mainFunction); | 79 .onResolutionComplete(compilerNormal.mainFunction); |
80 return compilerNormal; | 80 return compilerNormal; |
81 }); | 81 }); |
82 | 82 |
83 Compiler compilerDeserialized = | 83 Compiler compilerDeserialized = |
84 await measure(title, 'compile deserialized', () async { | 84 await measure(title, 'compile deserialized', () async { |
85 Compiler compilerDeserialized = compilerFor( | 85 Compiler compilerDeserialized = compilerFor( |
86 memorySourceFiles: sourceFiles, | 86 memorySourceFiles: sourceFiles, |
87 resolutionInputs: resolutionInputs, | 87 resolutionInputs: resolutionInputs, |
88 options: [Flags.analyzeOnly]); | 88 options: [Flags.analyzeOnly]); |
89 compilerDeserialized.resolution.retainCachesForTesting = true; | 89 compilerDeserialized.resolution.retainCachesForTesting = true; |
90 await compilerDeserialized.run(entryPoint); | 90 await compilerDeserialized.run(entryPoint); |
91 compilerDeserialized.phase = Compiler.PHASE_DONE_RESOLVING; | 91 compilerDeserialized.phase = Compiler.PHASE_DONE_RESOLVING; |
92 compilerDeserialized.openWorld.populate(); | 92 compilerDeserialized.openWorld.closeWorld(); |
93 compilerDeserialized.backend.onResolutionComplete(); | 93 compilerDeserialized.backend.onResolutionComplete(); |
94 compilerDeserialized.deferredLoadTask | 94 compilerDeserialized.deferredLoadTask |
95 .onResolutionComplete(compilerDeserialized.mainFunction); | 95 .onResolutionComplete(compilerDeserialized.mainFunction); |
96 return compilerDeserialized; | 96 return compilerDeserialized; |
97 }); | 97 }); |
98 | 98 |
99 return measure(title, 'check models', () async { | 99 return measure(title, 'check models', () async { |
100 checkAllImpacts(compilerNormal, compilerDeserialized, verbose: verbose); | 100 checkAllImpacts(compilerNormal, compilerDeserialized, verbose: verbose); |
101 | 101 |
102 checkSets( | 102 checkSets( |
(...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
391 check(outputUnit1, outputUnit2, 'OutputUnit.isMainOutput $message', | 391 check(outputUnit1, outputUnit2, 'OutputUnit.isMainOutput $message', |
392 outputUnit1.isMainOutput, outputUnit2.isMainOutput); | 392 outputUnit1.isMainOutput, outputUnit2.isMainOutput); |
393 checkSetEquivalence( | 393 checkSetEquivalence( |
394 outputUnit1, | 394 outputUnit1, |
395 outputUnit2, | 395 outputUnit2, |
396 'OutputUnit.imports $message', | 396 'OutputUnit.imports $message', |
397 outputUnit1.imports, | 397 outputUnit1.imports, |
398 outputUnit2.imports, | 398 outputUnit2.imports, |
399 (a, b) => areElementsEquivalent(a.declaration, b.declaration)); | 399 (a, b) => areElementsEquivalent(a.declaration, b.declaration)); |
400 } | 400 } |
OLD | NEW |