| 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 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 103 verbose: verbose); | 103 verbose: verbose); |
| 104 checkBackendInfo(compilerNormal, compilerDeserialized, verbose: verbose); | 104 checkBackendInfo(compilerNormal, compilerDeserialized, verbose: verbose); |
| 105 }); | 105 }); |
| 106 } | 106 } |
| 107 | 107 |
| 108 void checkResolutionEnqueuers( | 108 void checkResolutionEnqueuers( |
| 109 ResolutionEnqueuer enqueuer1, ResolutionEnqueuer enqueuer2, | 109 ResolutionEnqueuer enqueuer1, ResolutionEnqueuer enqueuer2, |
| 110 {bool typeEquivalence(DartType a, DartType b): areTypesEquivalent, | 110 {bool typeEquivalence(DartType a, DartType b): areTypesEquivalent, |
| 111 bool elementFilter(Element element), | 111 bool elementFilter(Element element), |
| 112 bool verbose: false}) { | 112 bool verbose: false}) { |
| 113 checkSets(enqueuer1.processedElements, enqueuer2.processedElements, | 113 checkSets(enqueuer1.processedEntities, enqueuer2.processedEntities, |
| 114 "Processed element mismatch", areElementsEquivalent, | 114 "Processed element mismatch", areElementsEquivalent, |
| 115 elementFilter: elementFilter, verbose: verbose); | 115 elementFilter: elementFilter, verbose: verbose); |
| 116 | 116 |
| 117 ResolutionWorldBuilderImpl worldBuilder1 = enqueuer1.universe; | 117 ResolutionWorldBuilderImpl worldBuilder1 = enqueuer1.universe; |
| 118 ResolutionWorldBuilderImpl worldBuilder2 = enqueuer2.universe; | 118 ResolutionWorldBuilderImpl worldBuilder2 = enqueuer2.universe; |
| 119 | 119 |
| 120 checkMaps( | 120 checkMaps( |
| 121 worldBuilder1.getInstantiationMap(), | 121 worldBuilder1.getInstantiationMap(), |
| 122 worldBuilder2.getInstantiationMap(), | 122 worldBuilder2.getInstantiationMap(), |
| 123 "Instantiated classes mismatch", | 123 "Instantiated classes mismatch", |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 167 closedWorld1, | 167 closedWorld1, |
| 168 closedWorld2, | 168 closedWorld2, |
| 169 closedWorld1.getClassHierarchyNode(closedWorld1.coreClasses.objectClass), | 169 closedWorld1.getClassHierarchyNode(closedWorld1.coreClasses.objectClass), |
| 170 closedWorld2.getClassHierarchyNode(closedWorld2.coreClasses.objectClass), | 170 closedWorld2.getClassHierarchyNode(closedWorld2.coreClasses.objectClass), |
| 171 verbose: verbose); | 171 verbose: verbose); |
| 172 } | 172 } |
| 173 | 173 |
| 174 void checkBackendInfo(Compiler compilerNormal, Compiler compilerDeserialized, | 174 void checkBackendInfo(Compiler compilerNormal, Compiler compilerDeserialized, |
| 175 {bool verbose: false}) { | 175 {bool verbose: false}) { |
| 176 checkSets( | 176 checkSets( |
| 177 compilerNormal.enqueuer.resolution.processedElements, | 177 compilerNormal.enqueuer.resolution.processedEntities, |
| 178 compilerDeserialized.enqueuer.resolution.processedElements, | 178 compilerDeserialized.enqueuer.resolution.processedEntities, |
| 179 "Processed element mismatch", | 179 "Processed element mismatch", |
| 180 areElementsEquivalent, onSameElement: (a, b) { | 180 areElementsEquivalent, onSameElement: (a, b) { |
| 181 checkElements(compilerNormal, compilerDeserialized, a, b, verbose: verbose); | 181 checkElements(compilerNormal, compilerDeserialized, a, b, verbose: verbose); |
| 182 }, verbose: verbose); | 182 }, verbose: verbose); |
| 183 Expect.equals( | 183 Expect.equals( |
| 184 compilerNormal.deferredLoadTask.isProgramSplit, | 184 compilerNormal.deferredLoadTask.isProgramSplit, |
| 185 compilerDeserialized.deferredLoadTask.isProgramSplit, | 185 compilerDeserialized.deferredLoadTask.isProgramSplit, |
| 186 "isProgramSplit mismatch"); | 186 "isProgramSplit mismatch"); |
| 187 | 187 |
| 188 Map<ConstantValue, OutputUnit> constants1 = | 188 Map<ConstantValue, OutputUnit> constants1 = |
| (...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 438 a, b, (a, b) => areInstancesEquivalent(a, b, typeEquivalence))); | 438 a, b, (a, b) => areInstancesEquivalent(a, b, typeEquivalence))); |
| 439 return true; | 439 return true; |
| 440 } | 440 } |
| 441 | 441 |
| 442 bool areInstancesEquivalent(Instance instance1, Instance instance2, | 442 bool areInstancesEquivalent(Instance instance1, Instance instance2, |
| 443 bool typeEquivalence(DartType a, DartType b)) { | 443 bool typeEquivalence(DartType a, DartType b)) { |
| 444 return typeEquivalence(instance1.type, instance2.type) && | 444 return typeEquivalence(instance1.type, instance2.type) && |
| 445 instance1.kind == instance2.kind && | 445 instance1.kind == instance2.kind && |
| 446 instance1.isRedirection == instance2.isRedirection; | 446 instance1.isRedirection == instance2.isRedirection; |
| 447 } | 447 } |
| OLD | NEW |