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

Side by Side Diff: lib/compiler/implementation/universe.dart

Issue 10535074: Add field getters and setters to the collection of getters and setters. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Removed code in comments Created 8 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 | Annotate | Revision Log
« no previous file with comments | « lib/compiler/implementation/ssa/codegen.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) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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 class Universe { 5 class Universe {
6 Map<Element, String> generatedCode; 6 Map<Element, String> generatedCode;
7 Map<Element, String> generatedBailoutCode; 7 Map<Element, String> generatedBailoutCode;
8 final Set<ClassElement> instantiatedClasses; 8 final Set<ClassElement> instantiatedClasses;
9 final Set<SourceString> instantiatedClassInstanceFields; 9 final Set<SourceString> instantiatedClassInstanceFields;
10 final Set<FunctionElement> staticFunctionsNeedingGetter; 10 final Set<FunctionElement> staticFunctionsNeedingGetter;
11 final Map<SourceString, Set<Selector>> invokedNames; 11 final Map<SourceString, Set<Selector>> invokedNames;
12 final Map<SourceString, Set<Selector>> invokedGetters; 12 final Map<SourceString, Set<Selector>> invokedGetters;
13 final Map<SourceString, Set<Selector>> invokedSetters; 13 final Map<SourceString, Set<Selector>> invokedSetters;
14 final Map<SourceString, Set<Selector>> fieldGetters;
15 final Map<SourceString, Set<Selector>> fieldSetters;
14 // TODO(ngeoffray): This should be a Set<Type>. 16 // TODO(ngeoffray): This should be a Set<Type>.
15 final Set<Element> isChecks; 17 final Set<Element> isChecks;
16 final RuntimeTypeInformation rti; 18 final RuntimeTypeInformation rti;
17 19
18 Universe() : generatedCode = new Map<Element, String>(), 20 Universe() : generatedCode = new Map<Element, String>(),
19 generatedBailoutCode = new Map<Element, String>(), 21 generatedBailoutCode = new Map<Element, String>(),
20 instantiatedClasses = new Set<ClassElement>(), 22 instantiatedClasses = new Set<ClassElement>(),
21 instantiatedClassInstanceFields = new Set<SourceString>(), 23 instantiatedClassInstanceFields = new Set<SourceString>(),
22 staticFunctionsNeedingGetter = new Set<FunctionElement>(), 24 staticFunctionsNeedingGetter = new Set<FunctionElement>(),
23 invokedNames = new Map<SourceString, Set<Selector>>(), 25 invokedNames = new Map<SourceString, Set<Selector>>(),
24 invokedGetters = new Map<SourceString, Set<Selector>>(), 26 invokedGetters = new Map<SourceString, Set<Selector>>(),
25 invokedSetters = new Map<SourceString, Set<Selector>>(), 27 invokedSetters = new Map<SourceString, Set<Selector>>(),
28 fieldGetters = new Map<SourceString, Set<Selector>>(),
29 fieldSetters = new Map<SourceString, Set<Selector>>(),
26 isChecks = new Set<Element>(), 30 isChecks = new Set<Element>(),
27 rti = new RuntimeTypeInformation(); 31 rti = new RuntimeTypeInformation();
28 32
29 void addGeneratedCode(WorkItem work, String code) { 33 void addGeneratedCode(WorkItem work, String code) {
30 generatedCode[work.element] = code; 34 generatedCode[work.element] = code;
31 } 35 }
32 36
33 void addBailoutCode(WorkItem work, String code) { 37 void addBailoutCode(WorkItem work, String code) {
34 generatedBailoutCode[work.element] = code; 38 generatedBailoutCode[work.element] = code;
35 } 39 }
36 40
37 bool hasMatchingSelector(Set<Selector> selectors, 41 bool hasMatchingSelector(Set<Selector> selectors,
38 Element member, 42 Element member,
39 Compiler compiler) { 43 Compiler compiler) {
40 if (selectors === null) return false; 44 if (selectors === null) return false;
41 for (Selector selector in selectors) { 45 for (Selector selector in selectors) {
42 if (selector.applies(member, compiler)) return true; 46 if (selector.applies(member, compiler)) return true;
43 } 47 }
44 return false; 48 return false;
45 } 49 }
46 50
47 bool hasInvocation(Element member, Compiler compiler) { 51 bool hasInvocation(Element member, Compiler compiler) {
48 return hasMatchingSelector(invokedNames[member.name], member, compiler); 52 return hasMatchingSelector(invokedNames[member.name], member, compiler);
49 } 53 }
50 54
51 bool hasGetter(Element member, Compiler compiler) { 55 bool hasInvokedGetter(Element member, Compiler compiler) {
52 return hasMatchingSelector(invokedGetters[member.name], member, compiler); 56 return hasMatchingSelector(invokedGetters[member.name], member, compiler);
53 } 57 }
54 58
55 bool hasSetter(Element member, Compiler compiler) { 59 bool hasInvokedSetter(Element member, Compiler compiler) {
56 return hasMatchingSelector(invokedSetters[member.name], member, compiler); 60 return hasMatchingSelector(invokedSetters[member.name], member, compiler);
57 } 61 }
62
63 bool hasFieldGetter(Element member, Compiler compiler) {
64 return hasMatchingSelector(fieldGetters[member.name], member, compiler);
65 }
66
67 bool hasFieldSetter(Element member, Compiler compiler) {
68 return hasMatchingSelector(fieldSetters[member.name], member, compiler);
69 }
58 } 70 }
59 71
60 class SelectorKind { 72 class SelectorKind {
61 final String name; 73 final String name;
62 const SelectorKind(this.name); 74 const SelectorKind(this.name);
63 75
64 static final SelectorKind GETTER = const SelectorKind('getter'); 76 static final SelectorKind GETTER = const SelectorKind('getter');
65 static final SelectorKind SETTER = const SelectorKind('setter'); 77 static final SelectorKind SETTER = const SelectorKind('setter');
66 static final SelectorKind INVOCATION = const SelectorKind('invocation'); 78 static final SelectorKind INVOCATION = const SelectorKind('invocation');
67 static final SelectorKind OPERATOR = const SelectorKind('operator'); 79 static final SelectorKind OPERATOR = const SelectorKind('operator');
(...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after
333 345
334 return false; 346 return false;
335 } 347 }
336 348
337 bool operator ==(other) { 349 bool operator ==(other) {
338 if (other is !TypedSelector) return false; 350 if (other is !TypedSelector) return false;
339 if (other.receiverType !== receiverType) return false; 351 if (other.receiverType !== receiverType) return false;
340 return super == other; 352 return super == other;
341 } 353 }
342 } 354 }
OLDNEW
« no previous file with comments | « lib/compiler/implementation/ssa/codegen.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698