diff options
Diffstat (limited to 'deps/v8/src/zone/zone.h')
-rw-r--r-- | deps/v8/src/zone/zone.h | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/deps/v8/src/zone/zone.h b/deps/v8/src/zone/zone.h index 6f863f27fd..5fcc25b350 100644 --- a/deps/v8/src/zone/zone.h +++ b/deps/v8/src/zone/zone.h @@ -9,8 +9,10 @@ #include "src/base/hashmap.h" #include "src/base/logging.h" +#include "src/base/threaded-list.h" #include "src/globals.h" #include "src/splay-tree.h" +#include "src/utils.h" #include "src/zone/accounting-allocator.h" #ifndef ZONE_NAME @@ -56,6 +58,10 @@ class V8_EXPORT_PRIVATE Zone final { // Seals the zone to prevent any further allocation. void Seal() { sealed_ = true; } + // Allows the zone to be safely reused. Releases the memory and fires zone + // destruction and creation events for the accounting allocator. + void ReleaseMemory(); + // Returns true if more memory has been allocated in zones than // the limit allows. bool excess_allocation() const { @@ -69,6 +75,9 @@ class V8_EXPORT_PRIVATE Zone final { AccountingAllocator* allocator() const { return allocator_; } private: + // Deletes all objects and free all memory allocated in the Zone. + void DeleteAll(); + // All pointers returned from New() are 8-byte aligned. static const size_t kAlignmentInBytes = 8; @@ -81,9 +90,6 @@ class V8_EXPORT_PRIVATE Zone final { // Report zone excess when allocation exceeds this limit. static const size_t kExcessLimit = 256 * MB; - // Deletes all objects and free all memory allocated in the Zone. - void DeleteAll(); - // The number of bytes allocated in this zone so far. size_t allocation_size_; @@ -295,6 +301,11 @@ class ZoneList final { template <typename T> using ZonePtrList = ZoneList<T*>; +// ZoneThreadedList is a special variant of the ThreadedList that can be put +// into a Zone. +template <typename T, typename TLTraits = base::ThreadedListTraits<T>> +using ZoneThreadedList = base::ThreadedListBase<T, ZoneObject, TLTraits>; + // A zone splay tree. The config type parameter encapsulates the // different configurations of a concrete splay tree (see splay-tree.h). // The tree itself and all its elements are allocated in the Zone. |