summaryrefslogtreecommitdiffstats
path: root/runtime/safe_map.h
diff options
context:
space:
mode:
authorVladimir Marko <vmarko@google.com>2014-02-12 18:02:05 +0000
committerVladimir Marko <vmarko@google.com>2014-03-06 15:37:40 +0000
commit83cc7ae96d4176533dd0391a1591d321b0a87f4f (patch)
tree6b3c607119c1dc2850810f8463dfd968c486fba4 /runtime/safe_map.h
parent8785d615122d4abbd22db702139584e8c472f502 (diff)
downloadandroid_art-83cc7ae96d4176533dd0391a1591d321b0a87f4f.tar.gz
android_art-83cc7ae96d4176533dd0391a1591d321b0a87f4f.tar.bz2
android_art-83cc7ae96d4176533dd0391a1591d321b0a87f4f.zip
Create a scoped arena allocator and use that for LVN.
This saves more than 0.5s of boot.oat compilation time on Nexus 5. TODO: Move other stuff to the scoped allocator. This CL alone increases the peak memory allocation. By reusing the memory for other parts of the compilation we should reduce this overhead. Change-Id: Ifbc00aab4f3afd0000da818dfe68b96713824a08
Diffstat (limited to 'runtime/safe_map.h')
-rw-r--r--runtime/safe_map.h15
1 files changed, 11 insertions, 4 deletions
diff --git a/runtime/safe_map.h b/runtime/safe_map.h
index 89da927cc2..393bf92ba2 100644
--- a/runtime/safe_map.h
+++ b/runtime/safe_map.h
@@ -33,10 +33,17 @@ class SafeMap {
typedef SafeMap<K, V, Comparator, Allocator> Self;
public:
- typedef typename ::std::map<K, V, Comparator>::iterator iterator;
- typedef typename ::std::map<K, V, Comparator>::const_iterator const_iterator;
- typedef typename ::std::map<K, V, Comparator>::size_type size_type;
- typedef typename ::std::map<K, V, Comparator>::value_type value_type;
+ typedef typename ::std::map<K, V, Comparator, Allocator>::key_compare key_compare;
+ typedef typename ::std::map<K, V, Comparator, Allocator>::allocator_type allocator_type;
+ typedef typename ::std::map<K, V, Comparator, Allocator>::iterator iterator;
+ typedef typename ::std::map<K, V, Comparator, Allocator>::const_iterator const_iterator;
+ typedef typename ::std::map<K, V, Comparator, Allocator>::size_type size_type;
+ typedef typename ::std::map<K, V, Comparator, Allocator>::value_type value_type;
+
+ SafeMap() = default;
+ explicit SafeMap(const key_compare& cmp, const allocator_type& allocator = allocator_type())
+ : map_(cmp, allocator) {
+ }
Self& operator=(const Self& rhs) {
map_ = rhs.map_;