Chromium Code Reviews| Index: runtime/vm/zone.h |
| diff --git a/runtime/vm/zone.h b/runtime/vm/zone.h |
| index 4e2e8a91e182a2f1cf8a012a687fc725ca816289..fcf91e68c03a6d93293bbae9e6cf24b47fc76a94 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_; } |
| +#if defined(DEBUG) |
|
zra
2016/12/08 18:54:14
ditto
bkonyi
2016/12/08 20:58:32
Done.
|
| + void PrintJSON(JSONStream* stream, bool ref = true) const; |
|
zra
2016/12/08 18:54:14
ditto
bkonyi
2016/12/08 20:58:33
Done.
|
| +#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: |