Chromium Code Reviews| Index: runtime/vm/precompiler.h |
| diff --git a/runtime/vm/precompiler.h b/runtime/vm/precompiler.h |
| index c32a955269d43287faa9958dac99e0cd8b9e3404..a8c98d82b57fd6f3076c0dbf255d988cc64b61a9 100644 |
| --- a/runtime/vm/precompiler.h |
| +++ b/runtime/vm/precompiler.h |
| @@ -166,6 +166,75 @@ class FieldKeyValueTrait { |
| typedef DirectChainedHashMap<FieldKeyValueTrait> FieldSet; |
| +class ClassKeyValueTrait { |
| + public: |
| + // Typedefs needed for the DirectChainedHashMap template. |
| + typedef const Class* Key; |
| + typedef const Class* Value; |
| + typedef const Class* Pair; |
| + |
| + static Key KeyOf(Pair kv) { return kv; } |
| + |
| + static Value ValueOf(Pair kv) { return kv; } |
| + |
| + static inline intptr_t Hashcode(Key key) { |
| + return key->token_pos().value(); |
| + } |
| + |
| + static inline bool IsKeyEqual(Pair pair, Key key) { |
| + return pair->raw() == key->raw(); |
| + } |
| +}; |
| + |
| +typedef DirectChainedHashMap<ClassKeyValueTrait> ClassSet; |
| + |
| + |
| +class AbstractTypeKeyValueTrait { |
| + public: |
| + // Typedefs needed for the DirectChainedHashMap template. |
| + typedef const AbstractType* Key; |
| + typedef const AbstractType* Value; |
| + typedef const AbstractType* Pair; |
| + |
| + static Key KeyOf(Pair kv) { return kv; } |
| + |
| + static Value ValueOf(Pair kv) { return kv; } |
| + |
| + static inline intptr_t Hashcode(Key key) { |
| + return key->token_pos().value(); |
|
regis
2016/02/22 15:44:03
So the hash does not work?
rmacnak
2016/02/22 22:03:46
Forgot. Switched to ->Hash().
|
| + } |
| + |
| + static inline bool IsKeyEqual(Pair pair, Key key) { |
| + return pair->raw() == key->raw(); |
| + } |
| +}; |
| + |
| +typedef DirectChainedHashMap<AbstractTypeKeyValueTrait> AbstractTypeSet; |
| + |
| + |
| +class TypeArgumentsKeyValueTrait { |
| + public: |
| + // Typedefs needed for the DirectChainedHashMap template. |
| + typedef const TypeArguments* Key; |
| + typedef const TypeArguments* Value; |
| + typedef const TypeArguments* Pair; |
| + |
| + static Key KeyOf(Pair kv) { return kv; } |
| + |
| + static Value ValueOf(Pair kv) { return kv; } |
| + |
| + static inline intptr_t Hashcode(Key key) { |
| + return key->Hash(); |
| + } |
| + |
| + static inline bool IsKeyEqual(Pair pair, Key key) { |
| + return pair->raw() == key->raw(); |
| + } |
| +}; |
| + |
| +typedef DirectChainedHashMap<TypeArgumentsKeyValueTrait> TypeArgumentsSet; |
| + |
| + |
| class Precompiler : public ValueObject { |
| public: |
| static RawError* CompileAll( |
| @@ -199,6 +268,10 @@ class Precompiler : public ValueObject { |
| void AddEntryPoints(Dart_QualifiedFunctionName entry_points[]); |
| void Iterate(); |
| + void AddType(const AbstractType& type); |
| + void AddTypesOf(const Class& cls); |
| + void AddTypesOf(const Function& function); |
| + void AddTypeArguments(const TypeArguments& args); |
| void AddCalleesOf(const Function& function); |
| void AddConstObject(const Instance& instance); |
| void AddClosureCall(const ICData& call_site); |
| @@ -213,6 +286,12 @@ class Precompiler : public ValueObject { |
| void DropFunctions(); |
| void DropFields(); |
| + void TraceTypesFromRetainedClasses(); |
| + void DropTypes(); |
| + void DropTypeArguments(); |
| + void DropClasses(); |
| + void DropLibraries(); |
| + |
| void BindStaticCalls(); |
| void DedupStackmaps(); |
| void DedupStackmapLists(); |
| @@ -247,12 +326,19 @@ class Precompiler : public ValueObject { |
| intptr_t selector_count_; |
| intptr_t dropped_function_count_; |
| intptr_t dropped_field_count_; |
| + intptr_t dropped_class_count_; |
| + intptr_t dropped_typearg_count_; |
| + intptr_t dropped_type_count_; |
| + intptr_t dropped_library_count_; |
| - const GrowableObjectArray& libraries_; |
| + GrowableObjectArray& libraries_; |
| const GrowableObjectArray& pending_functions_; |
| SymbolSet sent_selectors_; |
| FunctionSet enqueued_functions_; |
| FieldSet fields_to_retain_; |
| + ClassSet classes_to_retain_; |
| + TypeArgumentsSet typeargs_to_retain_; |
| + AbstractTypeSet types_to_retain_; |
| Error& error_; |
| }; |