Chromium Code Reviews| Index: runtime/vm/precompiler.h |
| diff --git a/runtime/vm/precompiler.h b/runtime/vm/precompiler.h |
| index 158a8ba88803215eb9bcf4805595f048ebb51d98..1d98aeb99a1a9951d3f9bea5abf42644a88c8f10 100644 |
| --- a/runtime/vm/precompiler.h |
| +++ b/runtime/vm/precompiler.h |
| @@ -6,6 +6,8 @@ |
| #define VM_PRECOMPILER_H_ |
| #include "vm/allocation.h" |
| +#include "vm/hash_map.h" |
| +#include "vm/object.h" |
| namespace dart { |
| @@ -18,6 +20,62 @@ class GrowableObjectArray; |
| class RawError; |
| class String; |
| +class SymbolPair { |
|
srdjan
2015/08/05 18:20:08
: public ValueObject ?
rmacnak
2015/08/05 19:51:50
DirectChainedHashMap uses the assignment operator.
|
| + public: |
| + // Typedefs needed for the DirectChainedHashMap template. |
| + typedef const String* Key; |
| + typedef bool Value; |
| + typedef SymbolPair Pair; |
| + |
| + SymbolPair() : key_(NULL), value_(false) {} |
| + SymbolPair(Key key, Value value) : key_(key), value_(value) { |
| + ASSERT(key->IsNotTemporaryScopedHandle()); |
| + } |
| + |
| + static Key KeyOf(Pair kv) { return kv.key_; } |
| + |
| + static Value ValueOf(Pair kv) { return kv.value_; } |
| + |
| + static inline intptr_t Hashcode(Key key) { |
| + return key->Hash(); |
| + } |
| + |
| + static inline bool IsKeyEqual(Pair pair, Key key) { |
| + return pair.key_->raw() == key->raw(); |
| + } |
| + |
| + private: |
| + Key key_; |
| + Value value_; |
| +}; |
| + |
| + |
| +class SymbolSet : public ValueObject { |
| + public: |
| + explicit SymbolSet(Zone* zone) : zone_(zone), map_() {} |
| + |
| + void Add(const String& symbol) { |
| + ASSERT(symbol.IsSymbol()); |
| + if (symbol.IsNotTemporaryScopedHandle()) { |
| + SymbolPair pair(&symbol, true); |
| + map_.Insert(pair); |
| + } else { |
| + SymbolPair pair(&String::ZoneHandle(zone_, symbol.raw()), true); |
| + map_.Insert(pair); |
| + } |
| + } |
| + |
| + bool Includes(const String& symbol) { |
| + ASSERT(symbol.IsSymbol()); |
| + return map_.Lookup(&symbol); |
| + } |
| + |
| + private: |
| + Zone* zone_; |
| + DirectChainedHashMap<SymbolPair> map_; |
| +}; |
| + |
| + |
| class Precompiler : public ValueObject { |
| public: |
| static RawError* CompileAll(); |
| @@ -41,6 +99,8 @@ class Precompiler : public ValueObject { |
| void ProcessFunction(const Function& function); |
| void CheckForNewDynamicFunctions(); |
| + void DropUncompiledFunctions(); |
| + |
| Thread* thread() const { return thread_; } |
| Zone* zone() const { return zone_; } |
| Isolate* isolate() const { return isolate_; } |
| @@ -52,11 +112,13 @@ class Precompiler : public ValueObject { |
| bool changed_; |
| intptr_t function_count_; |
| intptr_t class_count_; |
| + intptr_t selector_count_; |
| + intptr_t dropped_function_count_; |
| const GrowableObjectArray& libraries_; |
| const GrowableObjectArray& pending_functions_; |
| const GrowableObjectArray& collected_closures_; |
| - const GrowableObjectArray& sent_selectors_; |
| + SymbolSet sent_selectors_; |
| Error& error_; |
| }; |