OLD | NEW |
1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, 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.native_data_test; | 5 library dart2js.serialization.native_data_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:compiler/src/common/names.dart'; | 9 import 'package:compiler/src/common/names.dart'; |
10 import 'package:compiler/src/commandline_options.dart'; | 10 import 'package:compiler/src/commandline_options.dart'; |
(...skipping 18 matching lines...) Expand all Loading... |
29 }); | 29 }); |
30 } | 30 } |
31 | 31 |
32 Future checkNativeData(Uri uri, {bool verbose: false}) async { | 32 Future checkNativeData(Uri uri, {bool verbose: false}) async { |
33 print('------------------------------------------------------------------'); | 33 print('------------------------------------------------------------------'); |
34 print('analyze normal: $uri'); | 34 print('analyze normal: $uri'); |
35 print('------------------------------------------------------------------'); | 35 print('------------------------------------------------------------------'); |
36 SerializationResult result = await serialize(uri); | 36 SerializationResult result = await serialize(uri); |
37 Compiler compiler1 = result.compiler; | 37 Compiler compiler1 = result.compiler; |
38 SerializedData serializedData = result.serializedData; | 38 SerializedData serializedData = result.serializedData; |
39 ClosedWorld closedWorld1 = compiler1.closeResolution().closedWorld; | 39 var elementEnvironment1 = compiler1.frontendStrategy.elementEnvironment; |
| 40 ClosedWorld closedWorld1 = |
| 41 compiler1.closeResolution(elementEnvironment1.mainFunction).closedWorld; |
40 | 42 |
41 print('------------------------------------------------------------------'); | 43 print('------------------------------------------------------------------'); |
42 print('analyze deserialized: $uri'); | 44 print('analyze deserialized: $uri'); |
43 print('------------------------------------------------------------------'); | 45 print('------------------------------------------------------------------'); |
44 Compiler compiler2 = compilerFor( | 46 Compiler compiler2 = compilerFor( |
45 memorySourceFiles: serializedData.toMemorySourceFiles(), | 47 memorySourceFiles: serializedData.toMemorySourceFiles(), |
46 resolutionInputs: serializedData.toUris(), | 48 resolutionInputs: serializedData.toUris(), |
47 options: [Flags.analyzeAll]); | 49 options: [Flags.analyzeAll]); |
48 await compiler2.run(uri); | 50 await compiler2.run(uri); |
49 ClosedWorld closedWorld2 = compiler2.closeResolution().closedWorld; | 51 var elementEnvironment2 = compiler2.frontendStrategy.elementEnvironment; |
| 52 ClosedWorld closedWorld2 = |
| 53 compiler2.closeResolution(elementEnvironment2.mainFunction).closedWorld; |
50 | 54 |
51 JavaScriptBackend backend1 = compiler1.backend; | 55 JavaScriptBackend backend1 = compiler1.backend; |
52 JavaScriptBackend backend2 = compiler2.backend; | 56 JavaScriptBackend backend2 = compiler2.backend; |
53 NativeBasicDataImpl nativeBasicData1 = backend1.nativeBasicData; | 57 NativeBasicDataImpl nativeBasicData1 = backend1.nativeBasicData; |
54 NativeBasicDataImpl nativeBasicData2 = backend2.nativeBasicData; | 58 NativeBasicDataImpl nativeBasicData2 = backend2.nativeBasicData; |
55 NativeDataImpl nativeData1 = closedWorld1.nativeData; | 59 NativeDataImpl nativeData1 = closedWorld1.nativeData; |
56 NativeDataImpl nativeData2 = closedWorld2.nativeData; | 60 NativeDataImpl nativeData2 = closedWorld2.nativeData; |
57 | 61 |
58 checkMaps( | 62 checkMaps( |
59 nativeData1.jsInteropLibraryNames, | 63 nativeData1.jsInteropLibraryNames, |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
100 verbose: verbose); | 104 verbose: verbose); |
101 | 105 |
102 checkMaps( | 106 checkMaps( |
103 nativeData1.nativeFieldStoreBehavior, | 107 nativeData1.nativeFieldStoreBehavior, |
104 nativeData2.nativeFieldStoreBehavior, | 108 nativeData2.nativeFieldStoreBehavior, |
105 "NativeData.nativeFieldStoreBehavior", | 109 "NativeData.nativeFieldStoreBehavior", |
106 areElementsEquivalent, | 110 areElementsEquivalent, |
107 testNativeBehavior, | 111 testNativeBehavior, |
108 verbose: verbose); | 112 verbose: verbose); |
109 } | 113 } |
OLD | NEW |