Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(81)

Side by Side Diff: runtime/vm/hash_map.h

Issue 12340050: Add DISALLOW_COPY_AND_ASSIGN to subclasses of ValueObject and make ValueObject copyable. Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « runtime/vm/flow_graph_inliner.cc ('k') | runtime/vm/il_printer.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 #ifndef VM_HASH_MAP_H_ 5 #ifndef VM_HASH_MAP_H_
6 #define VM_HASH_MAP_H_ 6 #define VM_HASH_MAP_H_
7 7
8 namespace dart { 8 namespace dart {
9 9
10 template <typename KeyValueTrait> 10 template <typename KeyValueTrait>
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 void ResizeLists(intptr_t new_size); 43 void ResizeLists(intptr_t new_size);
44 uword Bound(uword value) const { return value & (array_size_ - 1); } 44 uword Bound(uword value) const { return value & (array_size_ - 1); }
45 45
46 intptr_t array_size_; 46 intptr_t array_size_;
47 intptr_t lists_size_; 47 intptr_t lists_size_;
48 intptr_t count_; // The number of values stored in the HashMap. 48 intptr_t count_; // The number of values stored in the HashMap.
49 HashMapListElement* array_; // Primary store - contains the first value 49 HashMapListElement* array_; // Primary store - contains the first value
50 // with a given hash. Colliding elements are stored in linked lists. 50 // with a given hash. Colliding elements are stored in linked lists.
51 HashMapListElement* lists_; // The linked lists containing hash collisions. 51 HashMapListElement* lists_; // The linked lists containing hash collisions.
52 intptr_t free_list_head_; // Unused elements in lists_ are on the free list. 52 intptr_t free_list_head_; // Unused elements in lists_ are on the free list.
53
54 // Disallow operator=. Use public copy constructor to copy instead.
55 DirectChainedHashMap<KeyValueTrait>& operator=(
56 const DirectChainedHashMap& other);
53 }; 57 };
54 58
55 59
56 template <typename KeyValueTrait> 60 template <typename KeyValueTrait>
57 typename KeyValueTrait::Value 61 typename KeyValueTrait::Value
58 DirectChainedHashMap<KeyValueTrait>:: 62 DirectChainedHashMap<KeyValueTrait>::
59 Lookup(typename KeyValueTrait::Key key) const { 63 Lookup(typename KeyValueTrait::Key key) const {
60 uword hash = static_cast<uword>(KeyValueTrait::Hashcode(key)); 64 uword hash = static_cast<uword>(KeyValueTrait::Hashcode(key));
61 uword pos = Bound(hash); 65 uword pos = Bound(hash);
62 if (KeyValueTrait::ValueOf(array_[pos].kv) != NULL) { 66 if (KeyValueTrait::ValueOf(array_[pos].kv) != NULL) {
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
212 } 216 }
213 217
214 static inline bool IsKeyEqual(Pair kv, Key key) { 218 static inline bool IsKeyEqual(Pair kv, Key key) {
215 return kv->Equals(key); 219 return kv->Equals(key);
216 } 220 }
217 }; 221 };
218 222
219 } // namespace dart 223 } // namespace dart
220 224
221 #endif // VM_HASH_MAP_H_ 225 #endif // VM_HASH_MAP_H_
OLDNEW
« no previous file with comments | « runtime/vm/flow_graph_inliner.cc ('k') | runtime/vm/il_printer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698