Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(560)

Unified Diff: pkg/compiler/lib/src/serialization/equivalence.dart

Issue 2057993003: Serialize NativeBehavior for elements (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Cleanup. Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « pkg/compiler/lib/src/js_backend/native_data.dart ('k') | pkg/compiler/lib/src/typechecker.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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;
}
« no previous file with comments | « pkg/compiler/lib/src/js_backend/native_data.dart ('k') | pkg/compiler/lib/src/typechecker.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698