Chromium Code Reviews| OLD | NEW |
|---|---|
| 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<DartType>. | 16 final Set<DartType> isChecks; |
| 17 final Set<Element> isChecks; | 17 // TODO(karlklose): move this data to RuntimeTypeInformation. |
| 18 Set<Element> checkedClasses; | |
| 18 final RuntimeTypeInformation rti; | 19 final RuntimeTypeInformation rti; |
| 19 | 20 |
| 20 Universe() : generatedCode = new Map<Element, CodeBuffer>(), | 21 Universe() : generatedCode = new Map<Element, CodeBuffer>(), |
| 21 generatedBailoutCode = new Map<Element, CodeBuffer>(), | 22 generatedBailoutCode = new Map<Element, CodeBuffer>(), |
| 22 instantiatedClasses = new Set<ClassElement>(), | 23 instantiatedClasses = new Set<ClassElement>(), |
| 23 instantiatedClassInstanceFields = new Set<SourceString>(), | 24 instantiatedClassInstanceFields = new Set<SourceString>(), |
| 24 staticFunctionsNeedingGetter = new Set<FunctionElement>(), | 25 staticFunctionsNeedingGetter = new Set<FunctionElement>(), |
| 25 invokedNames = new Map<SourceString, Set<Selector>>(), | 26 invokedNames = new Map<SourceString, Set<Selector>>(), |
| 26 invokedGetters = new Map<SourceString, Set<Selector>>(), | 27 invokedGetters = new Map<SourceString, Set<Selector>>(), |
| 27 invokedSetters = new Map<SourceString, Set<Selector>>(), | 28 invokedSetters = new Map<SourceString, Set<Selector>>(), |
| 28 fieldGetters = new Map<SourceString, Set<Selector>>(), | 29 fieldGetters = new Map<SourceString, Set<Selector>>(), |
| 29 fieldSetters = new Map<SourceString, Set<Selector>>(), | 30 fieldSetters = new Map<SourceString, Set<Selector>>(), |
| 30 isChecks = new Set<Element>(), | 31 isChecks = new Set<DartType>(), |
| 31 rti = new RuntimeTypeInformation(); | 32 rti = new RuntimeTypeInformation(); |
| 32 | 33 |
| 34 // TODO(karlklose): add the set of instantiatedtypes as second argument. | |
|
ngeoffray
2012/09/05 12:50:40
Why is the set of instantiatedTypes needed? You wa
karlklose
2012/09/06 11:04:02
It is important for checks on type arguments to kn
ngeoffray
2012/09/06 11:07:46
So you can just return false for them?
| |
| 35 void computeRequiredTypes(Set<DartType> isChecks) { | |
| 36 assert(checkedClasses == null); | |
| 37 checkedClasses = new Set<Element>(); | |
| 38 isChecks.forEach((DartType t) => checkedClasses.add(t.element)); | |
| 39 } | |
| 40 | |
| 33 void addGeneratedCode(WorkItem work, CodeBuffer codeBuffer) { | 41 void addGeneratedCode(WorkItem work, CodeBuffer codeBuffer) { |
| 34 generatedCode[work.element] = codeBuffer; | 42 generatedCode[work.element] = codeBuffer; |
| 35 } | 43 } |
| 36 | 44 |
| 37 void addBailoutCode(WorkItem work, CodeBuffer codeBuffer) { | 45 void addBailoutCode(WorkItem work, CodeBuffer codeBuffer) { |
| 38 generatedBailoutCode[work.element] = codeBuffer; | 46 generatedBailoutCode[work.element] = codeBuffer; |
| 39 } | 47 } |
| 40 | 48 |
| 41 bool hasMatchingSelector(Set<Selector> selectors, | 49 bool hasMatchingSelector(Set<Selector> selectors, |
| 42 Element member, | 50 Element member, |
| (...skipping 343 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 386 } | 394 } |
| 387 | 395 |
| 388 return false; | 396 return false; |
| 389 } | 397 } |
| 390 | 398 |
| 391 toString() { | 399 toString() { |
| 392 return 'Selector($kind, "${name.slowToString()}", ' | 400 return 'Selector($kind, "${name.slowToString()}", ' |
| 393 '$argumentCount, type=$receiverType)'; | 401 '$argumentCount, type=$receiverType)'; |
| 394 } | 402 } |
| 395 } | 403 } |
| OLD | NEW |