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

Unified Diff: runtime/vm/hash_map.h

Issue 10872035: Add a simple dominator based redundancy elimination. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 4 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 side-by-side diff with in-line comments
Download patch
Index: runtime/vm/hash_map.h
===================================================================
--- runtime/vm/hash_map.h (revision 11221)
+++ runtime/vm/hash_map.h (working copy)
@@ -20,6 +20,8 @@
Resize(kInitialSize);
}
+ DirectChainedHashMap(const DirectChainedHashMap& other);
+
void Insert(T value);
T Lookup(T value) const;
@@ -48,8 +50,6 @@
// with a given hash. Colliding elements are stored in linked lists.
HashMapListElement* lists_; // The linked lists containing hash collisions.
intptr_t free_list_head_; // Unused elements in lists_ are on the free list.
-
- DISALLOW_COPY_AND_ASSIGN(DirectChainedHashMap);
};
@@ -70,6 +70,21 @@
template <typename T>
+DirectChainedHashMap<T>::DirectChainedHashMap(const DirectChainedHashMap& other)
+ : array_size_(other.array_size_),
+ lists_size_(other.lists_size_),
+ count_(other.count_),
+ array_(Isolate::Current()->current_zone()->
+ Alloc<HashMapListElement>(other.array_size_)),
+ lists_(Isolate::Current()->current_zone()->
+ Alloc<HashMapListElement>(other.lists_size_)),
+ free_list_head_(other.free_list_head_) {
+ memmove(array_, other.array_, array_size_ * sizeof(HashMapListElement));
+ memmove(lists_, other.lists_, lists_size_ * sizeof(HashMapListElement));
+}
+
+
+template <typename T>
void DirectChainedHashMap<T>::Resize(intptr_t new_size) {
ASSERT(new_size > count_);
// Hashing the values into the new array has no more collisions than in the

Powered by Google App Engine
This is Rietveld 408576698