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

Side by Side Diff: sdk/lib/_internal/compiler/implementation/dependency_info.dart

Issue 430913002: Better dependency tracking (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: fix self critiques Created 6 years, 4 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 | Annotate | Revision Log
OLDNEW
(Empty)
1 library dart2js.dependency_information;
2
3 import 'dart2jslib.dart';
4 import 'elements/elements.dart';
5 import 'tree/tree.dart';
6
7
8 abstract class DependencyInformation {
9 factory DependencyInformation(Enqueuer enqueuer, bool dumpInfoEnabled) {
10 if (dumpInfoEnabled) {
11 return new _DependencyInformation(enqueuer);
12 } else {
13 return new _EmptyDependencyInformation();
14 }
15 }
16
17 void elementUsesSelector(Element element, Selector selector) {}
sra1 2014/07/30 21:43:48 abstract methods are declared without a body: voi
Ty Overby (Google) 2014/08/01 16:39:37 This class is gone. Done.
18 Iterable<Element> getRetaining(Element element, Compiler compiler) {}
19 }
20
21 class _EmptyDependencyInformation implements DependencyInformation {
22 _EmptyDependencyInformation();
23
24 void elementUsesSelector(Element element, Selector selector) {}
25 Iterable<Element> getRetaining(Element element, Compiler compiler) {
26 return const <Element>[];
27 }
28 }
29
30
31 class _DependencyInformation implements DependencyInformation {
32 _DependencyInformation(Enqueuer enqueuer);
33
34 /// An [Element] uses [Selector]s
35 final Map<Element, Set<Selector>> selectorsFromElement = {};
36
37 /// Returns a group of [Element]s that [element] is retaining.
38 Iterable<Element> getRetaining(Element element, Compiler compiler) {
39 if (!selectorsFromElement.containsKey(element)) {
40 return [];
41 } else {
42 return selectorsFromElement[element].expand(
43 (s) => compiler.world.allFunctions.filter(s));
44 }
45 }
46
47 // The Element may or may not actually be emitted.
48 void elementUsesSelector(Element element, Selector selector) {
49 selectorsFromElement
50 .putIfAbsent(element, () => new Set<Selector>())
51 .add(selector);
52 }
53 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698