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'; |
11 import 'package:compiler/src/closure.dart'; | 11 import 'package:compiler/src/closure.dart'; |
12 import 'package:compiler/src/commandline_options.dart'; | 12 import 'package:compiler/src/commandline_options.dart'; |
13 import 'package:compiler/src/common/backend_api.dart'; | |
14 import 'package:compiler/src/common/names.dart'; | |
15 import 'package:compiler/src/common/resolution.dart'; | |
16 import 'package:compiler/src/compiler.dart'; | 13 import 'package:compiler/src/compiler.dart'; |
17 import 'package:compiler/src/dart_types.dart'; | |
18 import 'package:compiler/src/elements/elements.dart'; | 14 import 'package:compiler/src/elements/elements.dart'; |
19 import 'package:compiler/src/filenames.dart'; | 15 import 'package:compiler/src/filenames.dart'; |
20 import 'package:compiler/src/serialization/element_serialization.dart'; | |
21 import 'package:compiler/src/serialization/impact_serialization.dart'; | |
22 import 'package:compiler/src/serialization/json_serializer.dart'; | |
23 import 'package:compiler/src/serialization/serialization.dart'; | |
24 import 'package:compiler/src/serialization/equivalence.dart'; | 16 import 'package:compiler/src/serialization/equivalence.dart'; |
25 import 'package:compiler/src/serialization/task.dart'; | |
26 import 'package:compiler/src/tree/nodes.dart'; | 17 import 'package:compiler/src/tree/nodes.dart'; |
27 import 'package:compiler/src/universe/world_impact.dart'; | |
28 import 'package:compiler/src/universe/class_set.dart'; | 18 import 'package:compiler/src/universe/class_set.dart'; |
29 import 'package:compiler/src/universe/use.dart'; | |
30 import '../memory_compiler.dart'; | 19 import '../memory_compiler.dart'; |
31 import 'helper.dart'; | 20 import 'helper.dart'; |
32 import 'test_data.dart'; | 21 import 'test_data.dart'; |
33 import 'test_helper.dart'; | 22 import 'test_helper.dart'; |
34 | 23 |
35 main(List<String> args) { | 24 main(List<String> args) { |
36 asyncTest(() async { | 25 asyncTest(() async { |
37 Arguments arguments = new Arguments.from(args); | 26 Arguments arguments = new Arguments.from(args); |
38 String serializedData = await serializeDartCore(arguments: arguments); | 27 String serializedData = await serializeDartCore(arguments: arguments); |
39 if (arguments.filename != null) { | 28 if (arguments.filename != null) { |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
72 compilerNormal.world.populate(); | 61 compilerNormal.world.populate(); |
73 compilerNormal.backend.onResolutionComplete(); | 62 compilerNormal.backend.onResolutionComplete(); |
74 | 63 |
75 print('------------------------------------------------------------------'); | 64 print('------------------------------------------------------------------'); |
76 print('compile deserialized'); | 65 print('compile deserialized'); |
77 print('------------------------------------------------------------------'); | 66 print('------------------------------------------------------------------'); |
78 Compiler compilerDeserialized = compilerFor( | 67 Compiler compilerDeserialized = compilerFor( |
79 memorySourceFiles: sourceFiles, | 68 memorySourceFiles: sourceFiles, |
80 options: [Flags.analyzeOnly]); | 69 options: [Flags.analyzeOnly]); |
81 compilerDeserialized.resolution.retainCachesForTesting = true; | 70 compilerDeserialized.resolution.retainCachesForTesting = true; |
82 deserialize(compilerDeserialized, serializedData); | 71 compilerDeserialized.serialization.deserializeFromText(serializedData); |
83 await compilerDeserialized.run(entryPoint); | 72 await compilerDeserialized.run(entryPoint); |
84 compilerDeserialized.phase = Compiler.PHASE_DONE_RESOLVING; | 73 compilerDeserialized.phase = Compiler.PHASE_DONE_RESOLVING; |
85 compilerDeserialized.world.populate(); | 74 compilerDeserialized.world.populate(); |
86 compilerDeserialized.backend.onResolutionComplete(); | 75 compilerDeserialized.backend.onResolutionComplete(); |
87 | 76 |
88 checkAllImpacts( | 77 checkAllImpacts( |
89 compilerNormal, compilerDeserialized, | 78 compilerNormal, compilerDeserialized, |
90 verbose: verbose); | 79 verbose: verbose); |
91 | 80 |
92 checkSets( | 81 checkSets( |
(...skipping 309 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
402 return true; | 391 return true; |
403 } | 392 } |
404 | 393 |
405 String nodeToString(Node node) { | 394 String nodeToString(Node node) { |
406 String text = '$node'; | 395 String text = '$node'; |
407 if (text.length > 40) { | 396 if (text.length > 40) { |
408 return '(${node.runtimeType}) ${text.substring(0, 37)}...'; | 397 return '(${node.runtimeType}) ${text.substring(0, 37)}...'; |
409 } | 398 } |
410 return '(${node.runtimeType}) $text'; | 399 return '(${node.runtimeType}) $text'; |
411 } | 400 } |
OLD | NEW |