| OLD | NEW |
| 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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 #ifndef VM_HASH_TABLE_H_ | 5 #ifndef VM_HASH_TABLE_H_ |
| 6 #define VM_HASH_TABLE_H_ | 6 #define VM_HASH_TABLE_H_ |
| 7 | 7 |
| 8 // Temporarily used when sorting the indices in EnumIndexHashTable. | 8 // Temporarily used when sorting the indices in EnumIndexHashTable. |
| 9 // TODO(koda): Remove these dependencies before using in production. | 9 // TODO(koda): Remove these dependencies before using in production. |
| 10 #include <map> | 10 #include <map> |
| (...skipping 23 matching lines...) Expand all Loading... |
| 34 // - UnorderedHashMap | 34 // - UnorderedHashMap |
| 35 // - EnumIndexHashMap | 35 // - EnumIndexHashMap |
| 36 // - LinkedListHashMap | 36 // - LinkedListHashMap |
| 37 // - UnorderedHashSet | 37 // - UnorderedHashSet |
| 38 // - EnumIndexHashSet | 38 // - EnumIndexHashSet |
| 39 // - LinkedListHashSet | 39 // - LinkedListHashSet |
| 40 // Each of these can be finally specialized with KeyTraits to support any set of | 40 // Each of these can be finally specialized with KeyTraits to support any set of |
| 41 // lookup key types (e.g., look up a char* in a set of String objects), and | 41 // lookup key types (e.g., look up a char* in a set of String objects), and |
| 42 // any equality and hash code computation. | 42 // any equality and hash code computation. |
| 43 // | 43 // |
| 44 // The classes all wrap an Array handle, and metods like HashSet::Insert can | 44 // The classes all wrap an Array handle, and methods like HashSet::Insert can |
| 45 // trigger growth into a new RawArray, updating the handle. Debug mode asserts | 45 // trigger growth into a new RawArray, updating the handle. Debug mode asserts |
| 46 // that 'Release' was called once to access the final array before destruction. | 46 // that 'Release' was called once to access the final array before destruction. |
| 47 // NOTE: The handle returned by 'Release' is cleared by ~HashTable. | 47 // NOTE: The handle returned by 'Release' is cleared by ~HashTable. |
| 48 // | 48 // |
| 49 // Example use: | 49 // Example use: |
| 50 // typedef UnorderedHashMap<FooTraits> FooMap; | 50 // typedef UnorderedHashMap<FooTraits> FooMap; |
| 51 // ... | 51 // ... |
| 52 // FooMap cache(get_foo_cache()); | 52 // FooMap cache(get_foo_cache()); |
| 53 // cache.UpdateOrInsert(name0, obj0); | 53 // cache.UpdateOrInsert(name0, obj0); |
| 54 // cache.UpdateOrInsert(name1, obj1); | 54 // cache.UpdateOrInsert(name1, obj1); |
| (...skipping 636 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 691 class EnumIndexHashSet : public HashSet<EnumIndexHashTable<KeyTraits, 0> > { | 691 class EnumIndexHashSet : public HashSet<EnumIndexHashTable<KeyTraits, 0> > { |
| 692 public: | 692 public: |
| 693 typedef HashSet<EnumIndexHashTable<KeyTraits, 0> > BaseSet; | 693 typedef HashSet<EnumIndexHashTable<KeyTraits, 0> > BaseSet; |
| 694 explicit EnumIndexHashSet(RawArray* data) : BaseSet(data) {} | 694 explicit EnumIndexHashSet(RawArray* data) : BaseSet(data) {} |
| 695 EnumIndexHashSet(Zone* zone, RawArray* data) : BaseSet(zone, data) {} | 695 EnumIndexHashSet(Zone* zone, RawArray* data) : BaseSet(zone, data) {} |
| 696 }; | 696 }; |
| 697 | 697 |
| 698 } // namespace dart | 698 } // namespace dart |
| 699 | 699 |
| 700 #endif // VM_HASH_TABLE_H_ | 700 #endif // VM_HASH_TABLE_H_ |
| OLD | NEW |