Index: runtime/vm/zone.h |
diff --git a/runtime/vm/zone.h b/runtime/vm/zone.h |
index 4e2e8a91e182a2f1cf8a012a687fc725ca816289..9cf29714e29bd2de0f39200fbfd78f485a5ed646 100644 |
--- a/runtime/vm/zone.h |
+++ b/runtime/vm/zone.h |
@@ -8,6 +8,7 @@ |
#include "platform/utils.h" |
#include "vm/allocation.h" |
#include "vm/handles.h" |
+#include "vm/json_stream.h" |
#include "vm/thread.h" |
#include "vm/memory_region.h" |
@@ -65,6 +66,11 @@ class Zone { |
// due to internal fragmentation in the segments. |
intptr_t SizeInBytes() const; |
+ // Computes the amount of space used in the zone. |
+ intptr_t UsedSizeInBytes() const { |
+ return SizeInBytes() - (limit_ - position_); |
+ } |
+ |
// Structure for managing handles allocation. |
VMHandles* handles() { return &handles_; } |
@@ -72,6 +78,10 @@ class Zone { |
Zone* previous() const { return previous_; } |
+#ifndef PRODUCT |
+ void PrintJSON(JSONStream* stream) const; |
+#endif |
+ |
private: |
Zone(); |
~Zone(); // Delete all memory associated with the zone. |
@@ -174,6 +184,9 @@ class StackZone : public StackResource { |
// due to internal fragmentation in the segments. |
intptr_t SizeInBytes() const { return zone_.SizeInBytes(); } |
+ // Computes the used space in the zone. |
+ intptr_t UsedSizeInBytes() const { return zone_.UsedSizeInBytes(); } |
+ |
Zone* GetZone() { return &zone_; } |
private: |