OLD | NEW |
---|---|
1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef V8_SRC_ZONE_ZONE_CONTAINERS_H_ | 5 #ifndef V8_SRC_ZONE_ZONE_CONTAINERS_H_ |
6 #define V8_SRC_ZONE_ZONE_CONTAINERS_H_ | 6 #define V8_SRC_ZONE_ZONE_CONTAINERS_H_ |
7 | 7 |
8 #include <deque> | 8 #include <deque> |
9 #include <list> | 9 #include <list> |
10 #include <map> | 10 #include <map> |
11 #include <queue> | 11 #include <queue> |
12 #include <set> | 12 #include <set> |
13 #include <stack> | 13 #include <stack> |
14 #include <vector> | 14 #include <vector> |
15 | 15 |
16 #include "src/utils.h" | |
marja
2017/01/10 10:10:43
Why?
rmcilroy
2017/01/11 10:20:11
You are right , this wasn't needed (removed anyway
| |
16 #include "src/zone/zone-allocator.h" | 17 #include "src/zone/zone-allocator.h" |
17 | 18 |
18 namespace v8 { | 19 namespace v8 { |
19 namespace internal { | 20 namespace internal { |
20 | 21 |
21 // A wrapper subclass for std::vector to make it easy to construct one | 22 // A wrapper subclass for std::vector to make it easy to construct one |
22 // that uses a zone allocator. | 23 // that uses a zone allocator. |
23 template <typename T> | 24 template <typename T> |
24 class ZoneVector : public std::vector<T, zone_allocator<T>> { | 25 class ZoneVector : public std::vector<T, zone_allocator<T>> { |
25 public: | 26 public: |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
132 // Constructs an empty multimap. | 133 // Constructs an empty multimap. |
133 explicit ZoneMultimap(Zone* zone) | 134 explicit ZoneMultimap(Zone* zone) |
134 : std::multimap<K, V, Compare, zone_allocator<std::pair<const K, V>>>( | 135 : std::multimap<K, V, Compare, zone_allocator<std::pair<const K, V>>>( |
135 Compare(), zone_allocator<std::pair<const K, V>>(zone)) {} | 136 Compare(), zone_allocator<std::pair<const K, V>>(zone)) {} |
136 }; | 137 }; |
137 | 138 |
138 // Typedefs to shorten commonly used vectors. | 139 // Typedefs to shorten commonly used vectors. |
139 typedef ZoneVector<bool> BoolVector; | 140 typedef ZoneVector<bool> BoolVector; |
140 typedef ZoneVector<int> IntVector; | 141 typedef ZoneVector<int> IntVector; |
141 | 142 |
143 // Can be used to create a threaded list of |T|. | |
144 template <typename T> | |
145 class ThreadedListZoneEntry final : public ZoneObject { | |
Michael Starzinger
2017/01/10 12:26:09
This file is specifically meant to contain stdlib
rmcilroy
2017/01/11 10:20:11
I had it there originally but it means src/utils.h
| |
146 public: | |
147 explicit ThreadedListZoneEntry(T value) : value_(value), next_(nullptr) {} | |
148 | |
149 T value() { return value_; } | |
150 ThreadedListZoneEntry<T>** next() { return &next_; } | |
151 | |
152 private: | |
153 T value_; | |
154 ThreadedListZoneEntry<T>* next_; | |
155 }; | |
jochen (gone - plz use gerrit)
2017/01/10 09:57:39
disallow copy/assign?
rmcilroy
2017/01/11 10:20:11
Done.
| |
156 | |
142 } // namespace internal | 157 } // namespace internal |
143 } // namespace v8 | 158 } // namespace v8 |
144 | 159 |
145 #endif // V8_SRC_ZONE_ZONE_CONTAINERS_H_ | 160 #endif // V8_SRC_ZONE_ZONE_CONTAINERS_H_ |
OLD | NEW |