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

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

Issue 14021016: Track side-effect free paths in the graph to allow CSE and LICM for instructions that depend on som… (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 7 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_type_propagator.cc ('k') | runtime/vm/intermediate_language.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 10 matching lines...) Expand all
21 } 21 }
22 22
23 DirectChainedHashMap(const DirectChainedHashMap& other); 23 DirectChainedHashMap(const DirectChainedHashMap& other);
24 24
25 void Insert(typename KeyValueTrait::Pair kv); 25 void Insert(typename KeyValueTrait::Pair kv);
26 26
27 typename KeyValueTrait::Value Lookup(typename KeyValueTrait::Key key) const; 27 typename KeyValueTrait::Value Lookup(typename KeyValueTrait::Key key) const;
28 28
29 bool IsEmpty() const { return count_ == 0; } 29 bool IsEmpty() const { return count_ == 0; }
30 30
31 private: 31 void Clear() {
32 if (!IsEmpty()) {
33 count_ = 0;
34 memset(array_, 0, sizeof(HashMapListElement) * array_size_);
35 memset(lists_, 0, sizeof(HashMapListElement) * lists_size_);
36 lists_[0].next = kNil;
37 for (intptr_t i = 1; i < lists_size_; ++i) {
38 lists_[i].next = i - 1;
39 }
40 free_list_head_ = lists_size_ - 1;
41 }
42 }
43
44 protected:
32 // A linked list of T values. Stored in arrays. 45 // A linked list of T values. Stored in arrays.
33 struct HashMapListElement { 46 struct HashMapListElement {
34 typename KeyValueTrait::Pair kv; 47 typename KeyValueTrait::Pair kv;
35 intptr_t next; // Index in the array of the next list element. 48 intptr_t next; // Index in the array of the next list element.
36 }; 49 };
37 static const intptr_t kNil = -1; // The end of a linked list 50 static const intptr_t kNil = -1; // The end of a linked list
38 51
39 // Must be a power of 2. 52 // Must be a power of 2.
40 static const intptr_t kInitialSize = 16; 53 static const intptr_t kInitialSize = 16;
41 54
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after
221 } 234 }
222 235
223 static inline bool IsKeyEqual(Pair kv, Key key) { 236 static inline bool IsKeyEqual(Pair kv, Key key) {
224 return kv->Equals(key); 237 return kv->Equals(key);
225 } 238 }
226 }; 239 };
227 240
228 } // namespace dart 241 } // namespace dart
229 242
230 #endif // VM_HASH_MAP_H_ 243 #endif // VM_HASH_MAP_H_
OLDNEW
« no previous file with comments | « runtime/vm/flow_graph_type_propagator.cc ('k') | runtime/vm/intermediate_language.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698