| 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<FunctionElement> staticFunctionsNeedingGetter; | 9 final Set<FunctionElement> staticFunctionsNeedingGetter; |
| 10 final Map<SourceString, Set<Selector>> invokedNames; | 10 final Map<SourceString, Set<Selector>> invokedNames; |
| 11 final Map<SourceString, Set<Selector>> invokedGetters; | 11 final Map<SourceString, Set<Selector>> invokedGetters; |
| 12 final Map<SourceString, Set<Selector>> invokedSetters; | 12 final Map<SourceString, Set<Selector>> invokedSetters; |
| 13 final Map<SourceString, Set<Selector>> fieldGetters; | 13 final Map<SourceString, Set<Selector>> fieldGetters; |
| 14 final Map<SourceString, Set<Selector>> fieldSetters; | 14 final Map<SourceString, Set<Selector>> fieldSetters; |
| 15 final Set<DartType> isChecks; | 15 // TODO(ngeoffray): This should be a Set<DartType>. |
| 16 // TODO(karlklose): move this data to RuntimeTypeInformation. | 16 final Set<Element> isChecks; |
| 17 Set<Element> checkedClasses; | |
| 18 final RuntimeTypeInformation rti; | 17 final RuntimeTypeInformation rti; |
| 19 | 18 |
| 20 Universe() : generatedCode = new Map<Element, CodeBuffer>(), | 19 Universe() : generatedCode = new Map<Element, CodeBuffer>(), |
| 21 generatedBailoutCode = new Map<Element, CodeBuffer>(), | 20 generatedBailoutCode = new Map<Element, CodeBuffer>(), |
| 22 instantiatedClasses = new Set<ClassElement>(), | 21 instantiatedClasses = new Set<ClassElement>(), |
| 23 staticFunctionsNeedingGetter = new Set<FunctionElement>(), | 22 staticFunctionsNeedingGetter = new Set<FunctionElement>(), |
| 24 invokedNames = new Map<SourceString, Set<Selector>>(), | 23 invokedNames = new Map<SourceString, Set<Selector>>(), |
| 25 invokedGetters = new Map<SourceString, Set<Selector>>(), | 24 invokedGetters = new Map<SourceString, Set<Selector>>(), |
| 26 invokedSetters = new Map<SourceString, Set<Selector>>(), | 25 invokedSetters = new Map<SourceString, Set<Selector>>(), |
| 27 fieldGetters = new Map<SourceString, Set<Selector>>(), | 26 fieldGetters = new Map<SourceString, Set<Selector>>(), |
| 28 fieldSetters = new Map<SourceString, Set<Selector>>(), | 27 fieldSetters = new Map<SourceString, Set<Selector>>(), |
| 29 isChecks = new Set<DartType>(), | 28 isChecks = new Set<Element>(), |
| 30 rti = new RuntimeTypeInformation(); | 29 rti = new RuntimeTypeInformation(); |
| 31 | 30 |
| 32 // TODO(karlklose): add the set of instantiatedtypes as second argument. | |
| 33 void computeRequiredTypes(Set<DartType> isChecks) { | |
| 34 assert(checkedClasses == null); | |
| 35 checkedClasses = new Set<Element>(); | |
| 36 isChecks.forEach((DartType t) => checkedClasses.add(t.element)); | |
| 37 } | |
| 38 | |
| 39 void addGeneratedCode(WorkItem work, CodeBuffer codeBuffer) { | 31 void addGeneratedCode(WorkItem work, CodeBuffer codeBuffer) { |
| 40 generatedCode[work.element] = codeBuffer; | 32 generatedCode[work.element] = codeBuffer; |
| 41 } | 33 } |
| 42 | 34 |
| 43 void addBailoutCode(WorkItem work, CodeBuffer codeBuffer) { | 35 void addBailoutCode(WorkItem work, CodeBuffer codeBuffer) { |
| 44 generatedBailoutCode[work.element] = codeBuffer; | 36 generatedBailoutCode[work.element] = codeBuffer; |
| 45 } | 37 } |
| 46 | 38 |
| 47 bool hasMatchingSelector(Set<Selector> selectors, | 39 bool hasMatchingSelector(Set<Selector> selectors, |
| 48 Element member, | 40 Element member, |
| (...skipping 357 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 406 | 398 |
| 407 if (!self.isInterface() && self.isSubclassOf(other)) { | 399 if (!self.isInterface() && self.isSubclassOf(other)) { |
| 408 // Resolve an invocation of [element.name] on [self]. If it | 400 // Resolve an invocation of [element.name] on [self]. If it |
| 409 // is found, this selector is a candidate. | 401 // is found, this selector is a candidate. |
| 410 return hasElementIn(self, element) && appliesUntyped(element, compiler); | 402 return hasElementIn(self, element) && appliesUntyped(element, compiler); |
| 411 } | 403 } |
| 412 | 404 |
| 413 return false; | 405 return false; |
| 414 } | 406 } |
| 415 } | 407 } |
| OLD | NEW |