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, CodeBlock> generatedCode; | 6 Map<Element, CodeBuffer> generatedCode; |
7 Map<Element, CodeBlock> 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 // TODO(ngeoffray): This should be a Set<Type>. |
17 final Set<Element> isChecks; | 17 final Set<Element> isChecks; |
18 final RuntimeTypeInformation rti; | 18 final RuntimeTypeInformation rti; |
19 | 19 |
20 Universe() : generatedCode = new Map<Element, CodeBlock>(), | 20 Universe() : generatedCode = new Map<Element, CodeBuffer>(), |
21 generatedBailoutCode = new Map<Element, CodeBlock>(), | 21 generatedBailoutCode = new Map<Element, CodeBuffer>(), |
22 instantiatedClasses = new Set<ClassElement>(), | 22 instantiatedClasses = new Set<ClassElement>(), |
23 instantiatedClassInstanceFields = new Set<SourceString>(), | 23 instantiatedClassInstanceFields = new Set<SourceString>(), |
24 staticFunctionsNeedingGetter = new Set<FunctionElement>(), | 24 staticFunctionsNeedingGetter = new Set<FunctionElement>(), |
25 invokedNames = new Map<SourceString, Set<Selector>>(), | 25 invokedNames = new Map<SourceString, Set<Selector>>(), |
26 invokedGetters = new Map<SourceString, Set<Selector>>(), | 26 invokedGetters = new Map<SourceString, Set<Selector>>(), |
27 invokedSetters = new Map<SourceString, Set<Selector>>(), | 27 invokedSetters = new Map<SourceString, Set<Selector>>(), |
28 fieldGetters = new Map<SourceString, Set<Selector>>(), | 28 fieldGetters = new Map<SourceString, Set<Selector>>(), |
29 fieldSetters = new Map<SourceString, Set<Selector>>(), | 29 fieldSetters = new Map<SourceString, Set<Selector>>(), |
30 isChecks = new Set<Element>(), | 30 isChecks = new Set<Element>(), |
31 rti = new RuntimeTypeInformation(); | 31 rti = new RuntimeTypeInformation(); |
32 | 32 |
33 void addGeneratedCode(WorkItem work, CodeBlock codeBlock) { | 33 void addGeneratedCode(WorkItem work, CodeBuffer codeBuffer) { |
34 generatedCode[work.element] = codeBlock; | 34 generatedCode[work.element] = codeBuffer; |
35 } | 35 } |
36 | 36 |
37 void addBailoutCode(WorkItem work, CodeBlock codeBlock) { | 37 void addBailoutCode(WorkItem work, CodeBuffer codeBuffer) { |
38 generatedBailoutCode[work.element] = codeBlock; | 38 generatedBailoutCode[work.element] = codeBuffer; |
39 } | 39 } |
40 | 40 |
41 bool hasMatchingSelector(Set<Selector> selectors, | 41 bool hasMatchingSelector(Set<Selector> selectors, |
42 Element member, | 42 Element member, |
43 Compiler compiler) { | 43 Compiler compiler) { |
44 if (selectors === null) return false; | 44 if (selectors === null) return false; |
45 for (Selector selector in selectors) { | 45 for (Selector selector in selectors) { |
46 if (selector.applies(member, compiler)) return true; | 46 if (selector.applies(member, compiler)) return true; |
47 } | 47 } |
48 return false; | 48 return false; |
(...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
345 | 345 |
346 return false; | 346 return false; |
347 } | 347 } |
348 | 348 |
349 bool operator ==(other) { | 349 bool operator ==(other) { |
350 if (other is !TypedSelector) return false; | 350 if (other is !TypedSelector) return false; |
351 if (other.receiverType !== receiverType) return false; | 351 if (other.receiverType !== receiverType) return false; |
352 return super == other; | 352 return super == other; |
353 } | 353 } |
354 } | 354 } |
355 | |
356 class CodeBlock { | |
357 String code; | |
358 List<SourceMappingEntry> sourceMappings; | |
359 CodeBlock(this.code, this.sourceMappings); | |
360 } | |
OLD | NEW |