| OLD | NEW |
| (Empty) |
| 1 library dart2js.compilation_info; | |
| 2 | |
| 3 import 'dart2jslib.dart'; | |
| 4 import 'elements/elements.dart'; | |
| 5 import 'tree/tree.dart'; | |
| 6 | |
| 7 | |
| 8 abstract class CompilationInformation { | |
| 9 factory CompilationInformation(Enqueuer enqueuer, bool dumpInfoEnabled) { | |
| 10 if (dumpInfoEnabled) { | |
| 11 return new _CompilationInformation(enqueuer); | |
| 12 } else { | |
| 13 return new _EmptyCompilationInformation(); | |
| 14 } | |
| 15 } | |
| 16 | |
| 17 Map<Element, Set<Element>> get enqueuesMap; | |
| 18 Map<Element, Set<Element>> get addsToWorkListMap; | |
| 19 | |
| 20 void enqueues(Element function, Element source) {} | |
| 21 void addsToWorkList(Element context, Element element) {} | |
| 22 void registerCallSite(TreeElements context, Send node) {} | |
| 23 } | |
| 24 | |
| 25 class _EmptyCompilationInformation implements CompilationInformation { | |
| 26 _EmptyCompilationInformation(); | |
| 27 Map<Element, Set<Element>> get enqueuesMap => <Element, Set<Element>>{}; | |
| 28 Map<Element, Set<Element>> get addsToWorkListMap => <Element, Set<Element>>{}; | |
| 29 | |
| 30 void enqueues(Element function, Element source) {} | |
| 31 void addsToWorkList(Element context, Element element) {} | |
| 32 void registerCallSite(TreeElements context, Send node) {} | |
| 33 } | |
| 34 | |
| 35 | |
| 36 class _CompilationInformation implements CompilationInformation { | |
| 37 final String prefix; | |
| 38 | |
| 39 final Map<Element, Set<Element>> enqueuesMap = {}; | |
| 40 final Map<Element, Set<Element>> addsToWorkListMap = {}; | |
| 41 | |
| 42 _CompilationInformation(Enqueuer enqueuer) | |
| 43 : prefix = enqueuer.isResolutionQueue ? 'resolution' : 'codegen'; | |
| 44 | |
| 45 Set<CallSite> callSites = new Set<CallSite>(); | |
| 46 | |
| 47 enqueues(Element function, Element source) { | |
| 48 enqueuesMap.putIfAbsent(function, () => new Set()) | |
| 49 .add(source); | |
| 50 } | |
| 51 | |
| 52 addsToWorkList(Element context, Element element) { | |
| 53 addsToWorkListMap.putIfAbsent(context, () => new Set()) | |
| 54 .add(element); | |
| 55 } | |
| 56 | |
| 57 registerCallSite(TreeElements context, Send node) { | |
| 58 callSites.add(new CallSite(context, node)); | |
| 59 } | |
| 60 } | |
| 61 | |
| 62 class CallSite { | |
| 63 final TreeElements context; | |
| 64 final Send node; | |
| 65 CallSite(this.context, this.node); | |
| 66 } | |
| OLD | NEW |