Index: pkg/compiler/lib/src/serialization/equivalence.dart |
diff --git a/pkg/compiler/lib/src/serialization/equivalence.dart b/pkg/compiler/lib/src/serialization/equivalence.dart |
index 563783fde293038581528e9c2846012c5a94f056..a1f341c02416191407e997c846affb12e9431567 100644 |
--- a/pkg/compiler/lib/src/serialization/equivalence.dart |
+++ b/pkg/compiler/lib/src/serialization/equivalence.dart |
@@ -14,7 +14,7 @@ import '../dart_types.dart'; |
import '../elements/elements.dart'; |
import '../elements/visitor.dart'; |
import '../js_backend/backend_serialization.dart' |
- show JavaScriptBackendSerializer; |
+ show NativeBehaviorSerialization; |
import '../native/native.dart' show NativeBehavior; |
import '../resolution/access_semantics.dart'; |
import '../resolution/send_structure.dart'; |
@@ -860,6 +860,43 @@ bool testTreeElementsEquivalence( |
return false; |
} |
+bool testNativeBehavior(NativeBehavior a, NativeBehavior b, |
+ [TestStrategy strategy = const TestStrategy()]) { |
+ if (identical(a, b)) return true; |
+ if (a == null || b == null) return false; |
+ return strategy.test( |
+ a, b, 'codeTemplateText', a.codeTemplateText, b.codeTemplateText) && |
+ strategy.test(a, b, 'isAllocation', a.isAllocation, b.isAllocation) && |
+ strategy.test(a, b, 'sideEffects', a.sideEffects, b.sideEffects) && |
+ strategy.test(a, b, 'throwBehavior', a.throwBehavior, b.throwBehavior) && |
+ strategy.testTypeLists( |
+ a, |
+ b, |
+ 'dartTypesReturned', |
+ NativeBehaviorSerialization.filterDartTypes(a.typesReturned), |
+ NativeBehaviorSerialization.filterDartTypes(b.typesReturned)) && |
+ strategy.testLists( |
+ a, |
+ b, |
+ 'specialTypesReturned', |
+ NativeBehaviorSerialization.filterSpecialTypes(a.typesReturned), |
+ NativeBehaviorSerialization.filterSpecialTypes(b.typesReturned)) && |
+ strategy.testTypeLists( |
+ a, |
+ b, |
+ 'dartTypesInstantiated', |
+ NativeBehaviorSerialization.filterDartTypes(a.typesInstantiated), |
+ NativeBehaviorSerialization.filterDartTypes(b.typesInstantiated)) && |
+ strategy.testLists( |
+ a, |
+ b, |
+ 'specialTypesInstantiated', |
+ NativeBehaviorSerialization.filterSpecialTypes(a.typesInstantiated), |
+ NativeBehaviorSerialization |
+ .filterSpecialTypes(b.typesInstantiated)) && |
+ strategy.test(a, b, 'useGvn', a.useGvn, b.useGvn); |
+} |
+ |
/// Visitor that checks the equivalence of [TreeElements] data. |
class TreeElementsEquivalenceVisitor extends Visitor { |
final TestStrategy strategy; |
@@ -911,41 +948,7 @@ class TreeElementsEquivalenceVisitor extends Visitor { |
if (identical(a, b)) return true; |
if (a == null || b == null) return false; |
if (a is NativeBehavior && b is NativeBehavior) { |
- return strategy.test(a, b, 'codeTemplateText', a.codeTemplateText, |
- b.codeTemplateText) && |
- strategy.test(a, b, 'isAllocation', a.isAllocation, b.isAllocation) && |
- strategy.test(a, b, 'sideEffects', a.sideEffects, b.sideEffects) && |
- strategy.test( |
- a, b, 'throwBehavior', a.throwBehavior, b.throwBehavior) && |
- strategy.testTypeLists( |
- a, |
- b, |
- 'dartTypesReturned', |
- JavaScriptBackendSerializer.filterDartTypes(a.typesReturned), |
- JavaScriptBackendSerializer.filterDartTypes(b.typesReturned)) && |
- strategy.testLists( |
- a, |
- b, |
- 'specialTypesReturned', |
- JavaScriptBackendSerializer.filterSpecialTypes(a.typesReturned), |
- JavaScriptBackendSerializer |
- .filterSpecialTypes(b.typesReturned)) && |
- strategy.testTypeLists( |
- a, |
- b, |
- 'dartTypesInstantiated', |
- JavaScriptBackendSerializer.filterDartTypes(a.typesInstantiated), |
- JavaScriptBackendSerializer |
- .filterDartTypes(b.typesInstantiated)) && |
- strategy.testLists( |
- a, |
- b, |
- 'specialTypesInstantiated', |
- JavaScriptBackendSerializer |
- .filterSpecialTypes(a.typesInstantiated), |
- JavaScriptBackendSerializer |
- .filterSpecialTypes(b.typesInstantiated)) && |
- strategy.test(a, b, 'useGvn', a.useGvn, b.useGvn); |
+ return testNativeBehavior(a, b, strategy); |
} |
return true; |
} |