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

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

Issue 2668723002: Handle JS-calls in impact_test. (Closed)
Patch Set: 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 1051 matching lines...) Expand 10 before | Expand all | Expand 10 after
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(impact1, impact2, 'nativeData', impact1.nativeData,
1072 impact2.nativeData, testNativeBehavior); 1072 impact2.nativeData, (a, b) => testNativeBehavior(a, b, strategy: strat egy));
Siggi Cherem (dart-lang) 2017/01/31 21:51:47 nit dartfmt
Johnni Winther 2017/02/01 09:17:39 Done.
1073 } 1073 }
1074 1074
1075 /// Tests the equivalence of [resolvedAst1] and [resolvedAst2] using [strategy]. 1075 /// Tests the equivalence of [resolvedAst1] and [resolvedAst2] using [strategy].
1076 bool testResolvedAstEquivalence( 1076 bool testResolvedAstEquivalence(
1077 ResolvedAst resolvedAst1, ResolvedAst resolvedAst2, 1077 ResolvedAst resolvedAst1, ResolvedAst resolvedAst2,
1078 [TestStrategy strategy = const TestStrategy()]) { 1078 [TestStrategy strategy = const TestStrategy()]) {
1079 if (!strategy.test(resolvedAst1, resolvedAst1, 'kind', resolvedAst1.kind, 1079 if (!strategy.test(resolvedAst1, resolvedAst1, 'kind', resolvedAst1.kind,
1080 resolvedAst2.kind)) { 1080 resolvedAst2.kind)) {
1081 return false; 1081 return false;
1082 } 1082 }
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
1130 indices1, indices2, elements1, elements2, strategy); 1130 indices1, indices2, elements1, elements2, strategy);
1131 resolvedAst1.node.accept(visitor); 1131 resolvedAst1.node.accept(visitor);
1132 if (visitor.success) { 1132 if (visitor.success) {
1133 return strategy.test(elements1, elements2, 'containsTryStatement', 1133 return strategy.test(elements1, elements2, 'containsTryStatement',
1134 elements1.containsTryStatement, elements2.containsTryStatement); 1134 elements1.containsTryStatement, elements2.containsTryStatement);
1135 } 1135 }
1136 return false; 1136 return false;
1137 } 1137 }
1138 1138
1139 bool testNativeBehavior(NativeBehavior a, NativeBehavior b, 1139 bool testNativeBehavior(NativeBehavior a, NativeBehavior b,
1140 [TestStrategy strategy = const TestStrategy()]) { 1140 {TestStrategy strategy = const TestStrategy()}) {
1141 if (identical(a, b)) return true; 1141 if (identical(a, b)) return true;
1142 if (a == null || b == null) return false; 1142 if (a == null || b == null) return false;
1143 return strategy.test( 1143 return strategy.test(
1144 a, b, 'codeTemplateText', a.codeTemplateText, b.codeTemplateText) && 1144 a, b, 'codeTemplateText', a.codeTemplateText, b.codeTemplateText) &&
1145 strategy.test(a, b, 'isAllocation', a.isAllocation, b.isAllocation) && 1145 strategy.test(a, b, 'isAllocation', a.isAllocation, b.isAllocation) &&
1146 strategy.test(a, b, 'sideEffects', a.sideEffects, b.sideEffects) && 1146 strategy.test(a, b, 'sideEffects', a.sideEffects, b.sideEffects) &&
1147 strategy.test(a, b, 'throwBehavior', a.throwBehavior, b.throwBehavior) && 1147 strategy.test(a, b, 'throwBehavior', a.throwBehavior, b.throwBehavior) &&
1148 strategy.testTypeLists( 1148 strategy.testTypeLists(
1149 a, 1149 a,
1150 b, 1150 b,
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
1217 strategy.test( 1217 strategy.test(
1218 a, b, 'isBreakTarget', a.isBreakTarget, b.isBreakTarget) && 1218 a, b, 'isBreakTarget', a.isBreakTarget, b.isBreakTarget) &&
1219 strategy.test( 1219 strategy.test(
1220 a, b, 'isContinueTarget', a.isContinueTarget, b.isContinueTarget); 1220 a, b, 'isContinueTarget', a.isContinueTarget, b.isContinueTarget);
1221 } 1221 }
1222 1222
1223 bool testNativeData(Node node1, Node node2, String property, a, b) { 1223 bool testNativeData(Node node1, Node node2, String property, a, b) {
1224 if (identical(a, b)) return true; 1224 if (identical(a, b)) return true;
1225 if (a == null || b == null) return false; 1225 if (a == null || b == null) return false;
1226 if (a is NativeBehavior && b is NativeBehavior) { 1226 if (a is NativeBehavior && b is NativeBehavior) {
1227 return testNativeBehavior(a, b, strategy); 1227 return testNativeBehavior(a, b, strategy: strategy);
1228 } 1228 }
1229 return true; 1229 return true;
1230 } 1230 }
1231 1231
1232 visitNode(Node node1) { 1232 visitNode(Node node1) {
1233 if (!success) return; 1233 if (!success) return;
1234 int index = indices1.nodeIndices[node1]; 1234 int index = indices1.nodeIndices[node1];
1235 Node node2 = indices2.nodeList[index]; 1235 Node node2 = indices2.nodeList[index];
1236 success = strategy.testElements( 1236 success = strategy.testElements(
1237 node1, node2, '[$index]', elements1[node1], elements2[node2]) && 1237 node1, node2, '[$index]', elements1[node1], elements2[node2]) &&
(...skipping 872 matching lines...) Expand 10 before | Expand all | Expand 10 after
2110 } 2110 }
2111 2111
2112 bool areMetadataAnnotationsEquivalent( 2112 bool areMetadataAnnotationsEquivalent(
2113 MetadataAnnotation metadata1, MetadataAnnotation metadata2) { 2113 MetadataAnnotation metadata1, MetadataAnnotation metadata2) {
2114 if (metadata1 == metadata2) return true; 2114 if (metadata1 == metadata2) return true;
2115 if (metadata1 == null || metadata2 == null) return false; 2115 if (metadata1 == null || metadata2 == null) return false;
2116 return areElementsEquivalent( 2116 return areElementsEquivalent(
2117 metadata1.annotatedElement, metadata2.annotatedElement) && 2117 metadata1.annotatedElement, metadata2.annotatedElement) &&
2118 areConstantsEquivalent(metadata1.constant, metadata2.constant); 2118 areConstantsEquivalent(metadata1.constant, metadata2.constant);
2119 } 2119 }
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