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

Unified Diff: src/zone.h

Issue 1847543002: Expose a lower bound of malloc'd memory via heap statistics (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: updates Created 4 years, 9 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: src/zone.h
diff --git a/src/zone.h b/src/zone.h
index 753e2035d3ac612060cb1391c33f29db5df9110f..4973405a4ec1b7bf07d7080feac62423419a7794 100644
--- a/src/zone.h
+++ b/src/zone.h
@@ -7,7 +7,7 @@
#include <limits>
-#include "src/allocation.h"
+#include "src/base/accounting_allocator.h"
#include "src/base/logging.h"
#include "src/globals.h"
#include "src/hashmap.h"
@@ -33,9 +33,9 @@ class Segment;
//
// Note: The implementation is inherently not thread safe. Do not use
// from multi-threaded code.
-class Zone final {
+class Zone {
public:
- Zone();
+ explicit Zone(base::AccountingAllocator* allocator);
~Zone();
// Allocate 'size' bytes of memory in the Zone; expands the Zone by
@@ -64,6 +64,8 @@ class Zone final {
size_t allocation_size() const { return allocation_size_; }
+ base::AccountingAllocator* allocator() const { return allocator_; }
+
private:
// All pointers returned from New() have this alignment. In addition, if the
// object being allocated has a size that is divisible by 8 then its alignment
@@ -114,6 +116,8 @@ class Zone final {
Address position_;
Address limit_;
+ base::AccountingAllocator* allocator_;
+
Segment* segment_head_;
};
@@ -165,6 +169,16 @@ class ZoneAllocationPolicy final {
Zone* zone_;
};
+class ZoneForTesting : public Zone {
+ public:
+ ZoneForTesting() : Zone(&allocator_) {}
+ ~ZoneForTesting() = default;
+
+ private:
+ base::AccountingAllocator allocator_;
+
+ DISALLOW_COPY_AND_ASSIGN(ZoneForTesting);
+};
// ZoneLists are growable lists with constant-time access to the
// elements. The list itself and all its elements are allocated in the
« src/base/accounting_allocator.cc ('K') | « src/wasm/wasm-module.cc ('k') | src/zone.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698