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

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

Issue 10911006: Collect the types used in is-checks in the resolver phase. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 3 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
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, CodeBuffer> generatedCode; 6 Map<Element, CodeBuffer> generatedCode;
7 Map<Element, CodeBuffer> generatedBailoutCode; 7 Map<Element, CodeBuffer> 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; 14 final Map<SourceString, Set<Selector>> fieldGetters;
15 final Map<SourceString, Set<Selector>> fieldSetters; 15 final Map<SourceString, Set<Selector>> fieldSetters;
16 // TODO(ngeoffray): This should be a Set<Type>. 16 final Set<Type> isChecks;
17 final Set<Element> isChecks; 17 // TODO(karlklose): move this data to RuntimeTypeInformation.
18 Set<Element> checkedClasses;
19
18 final RuntimeTypeInformation rti; 20 final RuntimeTypeInformation rti;
19 21
20 Universe() : generatedCode = new Map<Element, CodeBuffer>(), 22 Universe() : generatedCode = new Map<Element, CodeBuffer>(),
21 generatedBailoutCode = new Map<Element, CodeBuffer>(), 23 generatedBailoutCode = new Map<Element, CodeBuffer>(),
22 instantiatedClasses = new Set<ClassElement>(), 24 instantiatedClasses = new Set<ClassElement>(),
23 instantiatedClassInstanceFields = new Set<SourceString>(), 25 instantiatedClassInstanceFields = new Set<SourceString>(),
24 staticFunctionsNeedingGetter = new Set<FunctionElement>(), 26 staticFunctionsNeedingGetter = new Set<FunctionElement>(),
25 invokedNames = new Map<SourceString, Set<Selector>>(), 27 invokedNames = new Map<SourceString, Set<Selector>>(),
26 invokedGetters = new Map<SourceString, Set<Selector>>(), 28 invokedGetters = new Map<SourceString, Set<Selector>>(),
27 invokedSetters = new Map<SourceString, Set<Selector>>(), 29 invokedSetters = new Map<SourceString, Set<Selector>>(),
28 fieldGetters = new Map<SourceString, Set<Selector>>(), 30 fieldGetters = new Map<SourceString, Set<Selector>>(),
29 fieldSetters = new Map<SourceString, Set<Selector>>(), 31 fieldSetters = new Map<SourceString, Set<Selector>>(),
30 isChecks = new Set<Element>(), 32 isChecks = new Set<Type>(),
31 rti = new RuntimeTypeInformation(); 33 rti = new RuntimeTypeInformation();
32 34
35 // TODO(karlklose): the second argument should be a set of types, too.
ngeoffray 2012/08/30 13:17:46 The second argument is not used.
karlklose 2012/09/05 09:36:01 Done, removed.
36 void computeRequiredTypes(Set<Type> isChecks,
37 Set<Element> instantiatedTypes) {
38 assert(checkedClasses == null);
39 checkedClasses = new Set<Element>();
40 isChecks.forEach((Type t) => checkedClasses.add(t.element));
41 }
42
33 void addGeneratedCode(WorkItem work, CodeBuffer codeBuffer) { 43 void addGeneratedCode(WorkItem work, CodeBuffer codeBuffer) {
34 generatedCode[work.element] = codeBuffer; 44 generatedCode[work.element] = codeBuffer;
35 } 45 }
36 46
37 void addBailoutCode(WorkItem work, CodeBuffer codeBuffer) { 47 void addBailoutCode(WorkItem work, CodeBuffer codeBuffer) {
38 generatedBailoutCode[work.element] = codeBuffer; 48 generatedBailoutCode[work.element] = codeBuffer;
39 } 49 }
40 50
41 bool hasMatchingSelector(Set<Selector> selectors, 51 bool hasMatchingSelector(Set<Selector> selectors,
42 Element member, 52 Element member,
(...skipping 343 matching lines...) Expand 10 before | Expand all | Expand 10 after
386 } 396 }
387 397
388 return false; 398 return false;
389 } 399 }
390 400
391 toString() { 401 toString() {
392 return 'Selector($kind, "${name.slowToString()}", ' 402 return 'Selector($kind, "${name.slowToString()}", '
393 '$argumentCount, type=$receiverType)'; 403 '$argumentCount, type=$receiverType)';
394 } 404 }
395 } 405 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698