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

Side by Side Diff: tests/compiler/dart2js/deferred_load_graph_segmentation_test.dart

Issue 2494093002: Refactor enqueuers (Closed)
Patch Set: Updated cf. comments. Created 4 years, 1 month 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) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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 // Test of the graph segmentation algorithm used by deferred loading 5 // Test of the graph segmentation algorithm used by deferred loading
6 // to determine which elements can be deferred and which libraries 6 // to determine which elements can be deferred and which libraries
7 // much be included in the initial download (loaded eagerly). 7 // much be included in the initial download (loaded eagerly).
8 8
9 import 'package:async_helper/async_helper.dart'; 9 import 'package:async_helper/async_helper.dart';
10 import 'package:compiler/src/compiler.dart'; 10 import 'package:compiler/src/compiler.dart';
11 import 'package:compiler/src/deferred_load.dart'; 11 import 'package:compiler/src/deferred_load.dart';
12 import 'package:expect/expect.dart'; 12 import 'package:expect/expect.dart';
13 import 'memory_compiler.dart'; 13 import 'memory_compiler.dart';
14 14
15 void main() { 15 void main() {
16 asyncTest(() async { 16 asyncTest(() async {
17 CompilationResult result = 17 CompilationResult result =
18 await runCompiler(memorySourceFiles: MEMORY_SOURCE_FILES); 18 await runCompiler(memorySourceFiles: MEMORY_SOURCE_FILES);
19 Compiler compiler = result.compiler; 19 Compiler compiler = result.compiler;
20 20
21 lookupLibrary(name) { 21 lookupLibrary(name) {
22 return compiler.libraryLoader.lookupLibrary(Uri.parse(name)); 22 return compiler.libraryLoader.lookupLibrary(Uri.parse(name));
23 } 23 }
24 24
25 var main = compiler.mainFunction; 25 var main = compiler.mainFunction;
26 Expect.isNotNull(main, "Could not find 'main'"); 26 Expect.isNotNull(main, "Could not find 'main'");
27 compiler.deferredLoadTask.onResolutionComplete(main);
28 27
29 var outputUnitForElement = compiler.deferredLoadTask.outputUnitForElement; 28 var outputUnitForElement = compiler.deferredLoadTask.outputUnitForElement;
30 29
31 var mainOutputUnit = compiler.deferredLoadTask.mainOutputUnit; 30 var mainOutputUnit = compiler.deferredLoadTask.mainOutputUnit;
32 var backend = compiler.backend; 31 var backend = compiler.backend;
33 var classes = backend.emitter.neededClasses; 32 var classes = backend.emitter.neededClasses;
34 var inputElement = classes.where((e) => e.name == 'InputElement').single; 33 var inputElement = classes.where((e) => e.name == 'InputElement').single;
35 var lib1 = lookupLibrary("memory:lib1.dart"); 34 var lib1 = lookupLibrary("memory:lib1.dart");
36 var foo1 = lib1.find("foo1"); 35 var foo1 = lib1.find("foo1");
37 var lib2 = lookupLibrary("memory:lib2.dart"); 36 var lib2 = lookupLibrary("memory:lib2.dart");
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
142 141
143 bar1() { 142 bar1() {
144 return "hello"; 143 return "hello";
145 } 144 }
146 145
147 bar2() { 146 bar2() {
148 return 2; 147 return 2;
149 } 148 }
150 """, 149 """,
151 }; 150 };
OLDNEW
« no previous file with comments | « tests/compiler/dart2js/compiler_helper.dart ('k') | tests/compiler/dart2js/mirror_tree_shaking_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698