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

Side by Side Diff: pkg/compiler/lib/src/stats/analysis_result.dart

Issue 1220043005: dart2js send stats, includes: (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 5 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
(Empty)
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
3 // BSD-style license that can be found in the LICENSE file.
4
5 /// API to get results from a static analysis of the source program.
6 library compiler.src.stats.analysis_result;
7
8 import '../tree/tree.dart' show Node;
9 import '../universe/universe.dart' show Selector;
10
11 /// A three-value logic bool (yes, no, maybe). We say that `yes` and `maybe` are
12 /// "truthy", while `no` and `maybe` are "falsy".
13 // TODO(sigmund): is it worth using an enum? or switch to true/false/null?
14 enum boolish { yes, no, maybe }
Johnni Winther 2015/07/13 19:21:43 'boolish' -> 'Boolish'
Siggi Cherem (dart-lang) 2015/09/29 01:39:33 Done.
15
16 /// Specifies results of some kind of static analysis on a source program.
17 abstract class AnalysisResult {
18 /// Information computed about a specific [receiver].
19 ReceiverInfo infoForReceiver(Node receiver);
20
21 /// Information computed about a specific [selector] applied to a specific
22 /// [receiver].
23 SelectorInfo infoForSelector(Node receiver, Selector selector);
24 }
25
26 /// Analysis information about a receiver of a send.
27 abstract class ReceiverInfo {
28 /// Receiver node for which this information is computed.
29 Node get receiver;
30
31 /// Return whether [receiver] resolves to a value that implements no such
32 /// method. The answer is `yes` if all values that [receiver] could evaluate
33 /// to at runtime contain it, or `no` if none of them does. Maybe if it
34 /// depends on some context or we can't determine this information precisely.
35 boolish get hasNoSuchMethod;
36
37 /// When [hasNoSuchMethod] is yes, the precise number of possible noSuchMethod
38 /// handlers for this receiver.
39 final int possibleNsmTargets;
40
41 /// Return whether [receiver] may ever be null.
42 boolish get isNull;
43 }
44
45 /// Information about a specific selector applied to a specific receiver.
46 abstract class SelectorInfo {
47 /// Receiver node of the [selector].
48 Node get receiver;
49
50 /// Specific selector on [receiver] for which this information is computed.
51 Selector get selector;
52
53 /// Whether a member matching [selector] exists in [receiver].
54 boolish get exists;
55
56 /// Whether [receiver] needs an interceptor to implement [selector].
57 boolish get usesInterceptor;
58
59 /// Possible total number of methods that could be the target of the selector.
60 /// This needs to be combined with [isAccurate] to correctly understand the
61 /// value. Some invariants:
62 ///
63 /// * If [exists] is `no`, the value here should be 0, regardless of
64 /// accuracy.
65 /// * If [exists] is `yes`, the value is always considered 1 or more.
66 /// If [isAccurate] is false, we treat it as there may be many possible
67 /// targets.
68 /// * If [exists] is `maybe`, the value is considered 0 or more.
69 int get possibleTargets;
70
71 /// Whether the information about [possibleTargets] is accurate.
72 bool get isAccurate;
73 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698