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

Side by Side Diff: pkg/compiler/lib/src/serialization/equivalence.dart

Issue 2668723002: Handle JS-calls in impact_test. (Closed)
Patch Set: dartfmt Created 3 years, 10 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 unified diff | Download patch
OLDNEW
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 /// Functions for asserting equivalence across serialization. 5 /// Functions for asserting equivalence across serialization.
6 6
7 library dart2js.serialization.equivalence; 7 library dart2js.serialization.equivalence;
8 8
9 import '../closure.dart'; 9 import '../closure.dart';
10 import '../common/resolution.dart'; 10 import '../common/resolution.dart';
(...skipping 1050 matching lines...) Expand 10 before | Expand all | Expand 10 after
1061 impact2.staticUses, 1061 impact2.staticUses,
1062 (a, b) => 1062 (a, b) =>
1063 areStaticUsesEquivalent(a, b, strategy: strategy.testOnly)) && 1063 areStaticUsesEquivalent(a, b, strategy: strategy.testOnly)) &&
1064 strategy.testSets( 1064 strategy.testSets(
1065 impact1, 1065 impact1,
1066 impact2, 1066 impact2,
1067 'typeUses', 1067 'typeUses',
1068 impact1.typeUses, 1068 impact1.typeUses,
1069 impact2.typeUses, 1069 impact2.typeUses,
1070 (a, b) => areTypeUsesEquivalent(a, b, strategy: strategy.testOnly)) && 1070 (a, b) => areTypeUsesEquivalent(a, b, strategy: strategy.testOnly)) &&
1071 strategy.testSets(impact1, impact2, 'nativeData', impact1.nativeData, 1071 strategy.testSets(
1072 impact2.nativeData, testNativeBehavior); 1072 impact1,
1073 impact2,
1074 'nativeData',
1075 impact1.nativeData,
1076 impact2.nativeData,
1077 (a, b) => testNativeBehavior(a, b, strategy: strategy));
1073 } 1078 }
1074 1079
1075 /// Tests the equivalence of [resolvedAst1] and [resolvedAst2] using [strategy]. 1080 /// Tests the equivalence of [resolvedAst1] and [resolvedAst2] using [strategy].
1076 bool testResolvedAstEquivalence( 1081 bool testResolvedAstEquivalence(
1077 ResolvedAst resolvedAst1, ResolvedAst resolvedAst2, 1082 ResolvedAst resolvedAst1, ResolvedAst resolvedAst2,
1078 [TestStrategy strategy = const TestStrategy()]) { 1083 [TestStrategy strategy = const TestStrategy()]) {
1079 if (!strategy.test(resolvedAst1, resolvedAst1, 'kind', resolvedAst1.kind, 1084 if (!strategy.test(resolvedAst1, resolvedAst1, 'kind', resolvedAst1.kind,
1080 resolvedAst2.kind)) { 1085 resolvedAst2.kind)) {
1081 return false; 1086 return false;
1082 } 1087 }
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
1130 indices1, indices2, elements1, elements2, strategy); 1135 indices1, indices2, elements1, elements2, strategy);
1131 resolvedAst1.node.accept(visitor); 1136 resolvedAst1.node.accept(visitor);
1132 if (visitor.success) { 1137 if (visitor.success) {
1133 return strategy.test(elements1, elements2, 'containsTryStatement', 1138 return strategy.test(elements1, elements2, 'containsTryStatement',
1134 elements1.containsTryStatement, elements2.containsTryStatement); 1139 elements1.containsTryStatement, elements2.containsTryStatement);
1135 } 1140 }
1136 return false; 1141 return false;
1137 } 1142 }
1138 1143
1139 bool testNativeBehavior(NativeBehavior a, NativeBehavior b, 1144 bool testNativeBehavior(NativeBehavior a, NativeBehavior b,
1140 [TestStrategy strategy = const TestStrategy()]) { 1145 {TestStrategy strategy = const TestStrategy()}) {
1141 if (identical(a, b)) return true; 1146 if (identical(a, b)) return true;
1142 if (a == null || b == null) return false; 1147 if (a == null || b == null) return false;
1143 return strategy.test( 1148 return strategy.test(
1144 a, b, 'codeTemplateText', a.codeTemplateText, b.codeTemplateText) && 1149 a, b, 'codeTemplateText', a.codeTemplateText, b.codeTemplateText) &&
1145 strategy.test(a, b, 'isAllocation', a.isAllocation, b.isAllocation) && 1150 strategy.test(a, b, 'isAllocation', a.isAllocation, b.isAllocation) &&
1146 strategy.test(a, b, 'sideEffects', a.sideEffects, b.sideEffects) && 1151 strategy.test(a, b, 'sideEffects', a.sideEffects, b.sideEffects) &&
1147 strategy.test(a, b, 'throwBehavior', a.throwBehavior, b.throwBehavior) && 1152 strategy.test(a, b, 'throwBehavior', a.throwBehavior, b.throwBehavior) &&
1148 strategy.testTypeLists( 1153 strategy.testTypeLists(
1149 a, 1154 a,
1150 b, 1155 b,
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
1217 strategy.test( 1222 strategy.test(
1218 a, b, 'isBreakTarget', a.isBreakTarget, b.isBreakTarget) && 1223 a, b, 'isBreakTarget', a.isBreakTarget, b.isBreakTarget) &&
1219 strategy.test( 1224 strategy.test(
1220 a, b, 'isContinueTarget', a.isContinueTarget, b.isContinueTarget); 1225 a, b, 'isContinueTarget', a.isContinueTarget, b.isContinueTarget);
1221 } 1226 }
1222 1227
1223 bool testNativeData(Node node1, Node node2, String property, a, b) { 1228 bool testNativeData(Node node1, Node node2, String property, a, b) {
1224 if (identical(a, b)) return true; 1229 if (identical(a, b)) return true;
1225 if (a == null || b == null) return false; 1230 if (a == null || b == null) return false;
1226 if (a is NativeBehavior && b is NativeBehavior) { 1231 if (a is NativeBehavior && b is NativeBehavior) {
1227 return testNativeBehavior(a, b, strategy); 1232 return testNativeBehavior(a, b, strategy: strategy);
1228 } 1233 }
1229 return true; 1234 return true;
1230 } 1235 }
1231 1236
1232 visitNode(Node node1) { 1237 visitNode(Node node1) {
1233 if (!success) return; 1238 if (!success) return;
1234 int index = indices1.nodeIndices[node1]; 1239 int index = indices1.nodeIndices[node1];
1235 Node node2 = indices2.nodeList[index]; 1240 Node node2 = indices2.nodeList[index];
1236 success = strategy.testElements( 1241 success = strategy.testElements(
1237 node1, node2, '[$index]', elements1[node1], elements2[node2]) && 1242 node1, node2, '[$index]', elements1[node1], elements2[node2]) &&
(...skipping 872 matching lines...) Expand 10 before | Expand all | Expand 10 after
2110 } 2115 }
2111 2116
2112 bool areMetadataAnnotationsEquivalent( 2117 bool areMetadataAnnotationsEquivalent(
2113 MetadataAnnotation metadata1, MetadataAnnotation metadata2) { 2118 MetadataAnnotation metadata1, MetadataAnnotation metadata2) {
2114 if (metadata1 == metadata2) return true; 2119 if (metadata1 == metadata2) return true;
2115 if (metadata1 == null || metadata2 == null) return false; 2120 if (metadata1 == null || metadata2 == null) return false;
2116 return areElementsEquivalent( 2121 return areElementsEquivalent(
2117 metadata1.annotatedElement, metadata2.annotatedElement) && 2122 metadata1.annotatedElement, metadata2.annotatedElement) &&
2118 areConstantsEquivalent(metadata1.constant, metadata2.constant); 2123 areConstantsEquivalent(metadata1.constant, metadata2.constant);
2119 } 2124 }
OLDNEW
« 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