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

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

Issue 2668623003: Check equivalence on impact computed with KernelWorldBuilder. (Closed)
Patch Set: Created 3 years, 11 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/kernel/world_builder.dart ('k') | tests/compiler/dart2js/kernel/impact_test.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 b599cb6e2a46f5f011e6a816b9068901f916f4f1..592f82639b71fb59c04708501279394e94457cdc 100644
--- a/pkg/compiler/lib/src/serialization/equivalence.dart
+++ b/pkg/compiler/lib/src/serialization/equivalence.dart
@@ -173,25 +173,30 @@ bool areDynamicUsesEquivalent(DynamicUse a, DynamicUse b) {
}
/// Returns `true` if the static uses [a] and [b] are equivalent.
-bool areStaticUsesEquivalent(StaticUse a, StaticUse b) {
- return a.kind == b.kind && areElementsEquivalent(a.element, b.element);
+bool areStaticUsesEquivalent(StaticUse a, StaticUse b,
+ {TestStrategy strategy: const TestStrategy()}) {
+ return a.kind == b.kind &&
+ strategy.testElements(a, b, 'element', a.element, b.element);
}
/// Returns `true` if the type uses [a] and [b] are equivalent.
-bool areTypeUsesEquivalent(TypeUse a, TypeUse b) {
- return a.kind == b.kind && areTypesEquivalent(a.type, b.type);
+bool areTypeUsesEquivalent(TypeUse a, TypeUse b,
+ {TestStrategy strategy: const TestStrategy()}) {
+ return a.kind == b.kind && strategy.testTypes(a, b, 'type', a.type, b.type);
}
/// Returns `true` if the list literal uses [a] and [b] are equivalent.
-bool areListLiteralUsesEquivalent(ListLiteralUse a, ListLiteralUse b) {
- return areTypesEquivalent(a.type, b.type) &&
+bool areListLiteralUsesEquivalent(ListLiteralUse a, ListLiteralUse b,
+ {TestStrategy strategy: const TestStrategy()}) {
+ return strategy.testTypes(a, b, 'type', a.type, b.type) &&
a.isConstant == b.isConstant &&
a.isEmpty == b.isEmpty;
}
/// Returns `true` if the map literal uses [a] and [b] are equivalent.
-bool areMapLiteralUsesEquivalent(MapLiteralUse a, MapLiteralUse b) {
- return areTypesEquivalent(a.type, b.type) &&
+bool areMapLiteralUsesEquivalent(MapLiteralUse a, MapLiteralUse b,
+ {TestStrategy strategy: const TestStrategy()}) {
+ return strategy.testTypes(a, b, 'type', a.type, b.type) &&
a.isConstant == b.isConstant &&
a.isEmpty == b.isEmpty;
}
@@ -1011,7 +1016,7 @@ class ConstantValueEquivalence
/// Tests the equivalence of [impact1] and [impact2] using [strategy].
bool testResolutionImpactEquivalence(
ResolutionImpact impact1, ResolutionImpact impact2,
- [TestStrategy strategy = const TestStrategy()]) {
+ {TestStrategy strategy = const TestStrategy()}) {
return strategy.testSets(impact1, impact2, 'constSymbolNames',
impact1.constSymbolNames, impact2.constSymbolNames) &&
strategy.testSets(
@@ -1025,14 +1030,37 @@ bool testResolutionImpactEquivalence(
impact2.dynamicUses, areDynamicUsesEquivalent) &&
strategy.testSets(
impact1, impact2, 'features', impact1.features, impact2.features) &&
- strategy.testSets(impact1, impact2, 'listLiterals', impact1.listLiterals,
- impact2.listLiterals, areListLiteralUsesEquivalent) &&
- strategy.testSets(impact1, impact2, 'mapLiterals', impact1.mapLiterals,
- impact2.mapLiterals, areMapLiteralUsesEquivalent) &&
- strategy.testSets(impact1, impact2, 'staticUses', impact1.staticUses,
- impact2.staticUses, areStaticUsesEquivalent) &&
- strategy.testSets(impact1, impact2, 'typeUses', impact1.typeUses,
- impact2.typeUses, areTypeUsesEquivalent) &&
+ strategy.testSets(
+ impact1,
+ impact2,
+ 'listLiterals',
+ impact1.listLiterals,
+ impact2.listLiterals,
+ (a, b) => areListLiteralUsesEquivalent(a, b,
+ strategy: strategy.testOnly)) &&
+ strategy.testSets(
+ impact1,
+ impact2,
+ 'mapLiterals',
+ impact1.mapLiterals,
+ impact2.mapLiterals,
+ (a, b) =>
+ areMapLiteralUsesEquivalent(a, b, strategy: strategy.testOnly)) &&
+ strategy.testSets(
+ impact1,
+ impact2,
+ 'staticUses',
+ impact1.staticUses,
+ impact2.staticUses,
+ (a, b) =>
+ areStaticUsesEquivalent(a, b, strategy: strategy.testOnly)) &&
+ strategy.testSets(
+ impact1,
+ impact2,
+ 'typeUses',
+ impact1.typeUses,
+ impact2.typeUses,
+ (a, b) => areTypeUsesEquivalent(a, b, strategy: strategy.testOnly)) &&
strategy.testSets(impact1, impact2, 'nativeData', impact1.nativeData,
impact2.nativeData, testNativeBehavior);
}
« no previous file with comments | « pkg/compiler/lib/src/kernel/world_builder.dart ('k') | tests/compiler/dart2js/kernel/impact_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698