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

Side by Side Diff: tests/compiler/dart2js/serialization/model_test.dart

Issue 2065413002: Serialize and process patch metadata (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: 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 unified diff | Download patch
« no previous file with comments | « tests/compiler/dart2js/serialization/equivalence_test.dart ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2015, 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 library dart2js.serialization_model_test; 5 library dart2js.serialization_model_test;
6
6 import 'dart:async'; 7 import 'dart:async';
7 import 'dart:io'; 8 import 'dart:io';
8 import 'package:async_helper/async_helper.dart'; 9 import 'package:async_helper/async_helper.dart';
9 import 'package:expect/expect.dart'; 10 import 'package:expect/expect.dart';
10 import 'package:compiler/src/closure.dart'; 11 import 'package:compiler/src/closure.dart';
11 import 'package:compiler/src/commandline_options.dart'; 12 import 'package:compiler/src/commandline_options.dart';
12 import 'package:compiler/src/compiler.dart'; 13 import 'package:compiler/src/compiler.dart';
13 import 'package:compiler/src/elements/elements.dart'; 14 import 'package:compiler/src/elements/elements.dart';
14 import 'package:compiler/src/filenames.dart'; 15 import 'package:compiler/src/filenames.dart';
16 import 'package:compiler/src/js_backend/js_backend.dart';
15 import 'package:compiler/src/serialization/equivalence.dart'; 17 import 'package:compiler/src/serialization/equivalence.dart';
16 import 'package:compiler/src/tree/nodes.dart'; 18 import 'package:compiler/src/tree/nodes.dart';
17 import 'package:compiler/src/universe/class_set.dart'; 19 import 'package:compiler/src/universe/class_set.dart';
18 import '../memory_compiler.dart'; 20 import '../memory_compiler.dart';
19 import 'helper.dart'; 21 import 'helper.dart';
20 import 'test_data.dart'; 22 import 'test_data.dart';
21 import 'test_helper.dart'; 23 import 'test_helper.dart';
22 24
23 main(List<String> args) { 25 main(List<String> args) {
24 asyncTest(() async { 26 asyncTest(() async {
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
108 verbose: verbose); 110 verbose: verbose);
109 111
110 checkClassHierarchyNodes( 112 checkClassHierarchyNodes(
111 compilerNormal, 113 compilerNormal,
112 compilerDeserialized, 114 compilerDeserialized,
113 compilerNormal.world.getClassHierarchyNode( 115 compilerNormal.world.getClassHierarchyNode(
114 compilerNormal.coreClasses.objectClass), 116 compilerNormal.coreClasses.objectClass),
115 compilerDeserialized.world.getClassHierarchyNode( 117 compilerDeserialized.world.getClassHierarchyNode(
116 compilerDeserialized.coreClasses.objectClass), 118 compilerDeserialized.coreClasses.objectClass),
117 verbose: verbose); 119 verbose: verbose);
120
121 Expect.equals(compilerNormal.enabledInvokeOn,
122 compilerDeserialized.enabledInvokeOn,
123 "Compiler.enabledInvokeOn mismatch");
124 Expect.equals(compilerNormal.enabledFunctionApply,
125 compilerDeserialized.enabledFunctionApply,
126 "Compiler.enabledFunctionApply mismatch");
127 Expect.equals(compilerNormal.enabledRuntimeType,
128 compilerDeserialized.enabledRuntimeType,
129 "Compiler.enabledRuntimeType mismatch");
130 Expect.equals(compilerNormal.hasIsolateSupport,
131 compilerDeserialized.hasIsolateSupport,
132 "Compiler.hasIsolateSupport mismatch");
118 } 133 }
119 134
120 void checkElements( 135 void checkElements(
121 Compiler compiler1, Compiler compiler2, 136 Compiler compiler1, Compiler compiler2,
122 Element element1, Element element2, 137 Element element1, Element element2,
123 {bool verbose: false}) { 138 {bool verbose: false}) {
124 if (element1.isFunction || 139 if (element1.isFunction ||
125 element1.isConstructor || 140 element1.isConstructor ||
126 (element1.isField && element1.isInstanceMember)) { 141 (element1.isField && element1.isInstanceMember)) {
127 AstElement astElement1 = element1; 142 AstElement astElement1 = element1;
128 AstElement astElement2 = element2; 143 AstElement astElement2 = element2;
129 ClosureClassMap closureData1 = 144 ClosureClassMap closureData1 =
130 compiler1.closureToClassMapper.computeClosureToClassMapping( 145 compiler1.closureToClassMapper.computeClosureToClassMapping(
131 astElement1.resolvedAst); 146 astElement1.resolvedAst);
132 ClosureClassMap closureData2 = 147 ClosureClassMap closureData2 =
133 compiler2.closureToClassMapper.computeClosureToClassMapping( 148 compiler2.closureToClassMapper.computeClosureToClassMapping(
134 astElement2.resolvedAst); 149 astElement2.resolvedAst);
135 150
136 checkElementIdentities(closureData1, closureData2, 151 checkElementIdentities(closureData1, closureData2,
137 '$element1.closureElement', 152 '$element1.closureElement',
138 closureData1.closureElement, closureData2.closureElement); 153 closureData1.closureElement, closureData2.closureElement);
139 checkElementIdentities(closureData1, closureData2, 154 checkElementIdentities(closureData1, closureData2,
140 '$element1.closureClassElement', 155 '$element1.closureClassElement',
141 closureData1.closureClassElement, closureData2.closureClassElement); 156 closureData1.closureClassElement, closureData2.closureClassElement);
142 checkElementIdentities(closureData1, closureData2, 157 checkElementIdentities(closureData1, closureData2,
143 '$element1.callElement', 158 '$element1.callElement',
144 closureData1.callElement, closureData2.callElement); 159 closureData1.callElement, closureData2.callElement);
(...skipping 16 matching lines...) Expand all
161 areClosureScopesEquivalent, 176 areClosureScopesEquivalent,
162 verbose: verbose, 177 verbose: verbose,
163 keyToString: nodeToString); 178 keyToString: nodeToString);
164 checkSets( 179 checkSets(
165 closureData1.variablesUsedInTryOrGenerator, 180 closureData1.variablesUsedInTryOrGenerator,
166 closureData2.variablesUsedInTryOrGenerator, 181 closureData2.variablesUsedInTryOrGenerator,
167 "$element1.variablesUsedInTryOrGenerator", 182 "$element1.variablesUsedInTryOrGenerator",
168 areLocalsEquivalent, 183 areLocalsEquivalent,
169 verbose: verbose); 184 verbose: verbose);
170 } 185 }
186 JavaScriptBackend backend1 = compiler1.backend;
187 JavaScriptBackend backend2 = compiler2.backend;
188 Expect.equals(
189 backend1.inlineCache.getCurrentCacheDecisionForTesting(element1),
190 backend2.inlineCache.getCurrentCacheDecisionForTesting(element2),
191 "Inline cache decision mismatch for $element1 vs $element2");
171 } 192 }
172 193
173 void checkMixinUses( 194 void checkMixinUses(
174 Compiler compiler1, Compiler compiler2, 195 Compiler compiler1, Compiler compiler2,
175 ClassElement class1, ClassElement class2, 196 ClassElement class1, ClassElement class2,
176 {bool verbose: false}) { 197 {bool verbose: false}) {
177 198
178 checkSets( 199 checkSets(
179 compiler1.world.mixinUsesOf(class1), 200 compiler1.world.mixinUsesOf(class1),
180 compiler2.world.mixinUsesOf(class2), 201 compiler2.world.mixinUsesOf(class2),
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
275 return true; 296 return true;
276 } 297 }
277 298
278 String nodeToString(Node node) { 299 String nodeToString(Node node) {
279 String text = '$node'; 300 String text = '$node';
280 if (text.length > 40) { 301 if (text.length > 40) {
281 return '(${node.runtimeType}) ${text.substring(0, 37)}...'; 302 return '(${node.runtimeType}) ${text.substring(0, 37)}...';
282 } 303 }
283 return '(${node.runtimeType}) $text'; 304 return '(${node.runtimeType}) $text';
284 } 305 }
OLDNEW
« no previous file with comments | « tests/compiler/dart2js/serialization/equivalence_test.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698