| OLD | NEW |
| 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, 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 final Element scope; | 6 final Element scope; |
| 7 | 7 |
| 8 Map<SourceString, Element> elements; | 8 Map<SourceString, Element> elements; |
| 9 Map<Element, String> generatedCode; | 9 Map<Element, String> generatedCode; |
| 10 Map<Element, String> generatedBailoutCode; | 10 Map<Element, String> generatedBailoutCode; |
| 11 final Set<ClassElement> instantiatedClasses; | 11 final Set<ClassElement> instantiatedClasses; |
| 12 // TODO(floitsch): we want more information than just the method name. For | 12 // TODO(floitsch): we want more information than just the method name. For |
| 13 // example the number of arguments, etc. | 13 // example the number of arguments, etc. |
| 14 final Set<String> invokedNames; | 14 final Map<SourceString, Set<int>> invokedNames; |
| 15 final Set<String> invokedGetters; | 15 final Set<SourceString> invokedGetters; |
| 16 final Set<String> invokedSetters; | 16 final Set<SourceString> invokedSetters; |
| 17 | 17 |
| 18 Universe() : elements = {}, generatedCode = {}, generatedBailoutCode = {}, | 18 Universe() : elements = {}, generatedCode = {}, generatedBailoutCode = {}, |
| 19 instantiatedClasses = new Set<ClassElement>(), | 19 instantiatedClasses = new Set<ClassElement>(), |
| 20 invokedNames = new Set<String>(), | 20 invokedNames = new Map<SourceString, Set<int>>(), |
| 21 invokedGetters = new Set<String>(), | 21 invokedGetters = new Set<SourceString>(), |
| 22 invokedSetters = new Set<String>(), | 22 invokedSetters = new Set<SourceString>(), |
| 23 scope = new Element(const SourceString('global scope'), | 23 scope = new Element(const SourceString('global scope'), |
| 24 null, null); | 24 null, null); |
| 25 | 25 |
| 26 Element find(SourceString name) { | 26 Element find(SourceString name) { |
| 27 return elements[name]; | 27 return elements[name]; |
| 28 } | 28 } |
| 29 | 29 |
| 30 void define(Element element) { | 30 void define(Element element) { |
| 31 assert(elements[element.name] == null); | 31 assert(elements[element.name] == null); |
| 32 elements[element.name] = element; | 32 elements[element.name] = element; |
| 33 } | 33 } |
| 34 | 34 |
| 35 void addGeneratedCode(WorkItem work, String code) { | 35 void addGeneratedCode(WorkItem work, String code) { |
| 36 if (work.isBailoutVersion()) { | 36 if (work.isBailoutVersion()) { |
| 37 generatedBailoutCode[work.element] = code; | 37 generatedBailoutCode[work.element] = code; |
| 38 } else { | 38 } else { |
| 39 generatedCode[work.element] = code; | 39 generatedCode[work.element] = code; |
| 40 } | 40 } |
| 41 } | 41 } |
| 42 } | 42 } |
| OLD | NEW |