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