Index: runtime/vm/zone.cc |
diff --git a/runtime/vm/zone.cc b/runtime/vm/zone.cc |
index 2632f3a3e5436f8a19b6522880d09741a4fffaec..36e962260dd30ed433c67ff89812392ece46ec04 100644 |
--- a/runtime/vm/zone.cc |
+++ b/runtime/vm/zone.cc |
@@ -136,6 +136,22 @@ intptr_t Zone::SizeInBytes() const { |
} |
+intptr_t Zone::CapacityInBytes() const { |
+ intptr_t size = 0; |
+ for (Segment* s = large_segments_; s != NULL; s = s->next()) { |
+ size += s->size(); |
+ } |
+ if (head_ == NULL) { |
+ return size + initial_buffer_.size(); |
+ } |
+ size += initial_buffer_.size(); |
+ for (Segment* s = head_; s != NULL; s = s->next()) { |
+ size += s->size(); |
+ } |
+ return size; |
+} |
+ |
+ |
uword Zone::AllocateExpand(intptr_t size) { |
ASSERT(size >= 0); |
if (FLAG_trace_zones) { |
@@ -263,8 +279,8 @@ char* Zone::VPrint(const char* format, va_list args) { |
#ifndef PRODUCT |
void Zone::PrintJSON(JSONStream* stream) const { |
JSONObject jsobj(stream); |
- intptr_t capacity = SizeInBytes(); |
- intptr_t used_size = UsedSizeInBytes(); |
+ intptr_t capacity = CapacityInBytes(); |
+ intptr_t used_size = SizeInBytes(); |
jsobj.AddProperty("type", "_Zone"); |
jsobj.AddProperty("capacity", capacity); |
jsobj.AddProperty("used", used_size); |