| Index: runtime/vm/zone.cc
|
| diff --git a/runtime/vm/zone.cc b/runtime/vm/zone.cc
|
| index 743727a54f91a3abffc9b8b9efb41a1798ae8620..ac79f356b6c94d9eb50f8b688465736eceaf8252 100644
|
| --- a/runtime/vm/zone.cc
|
| +++ b/runtime/vm/zone.cc
|
| @@ -72,6 +72,31 @@ Zone::Segment* Zone::Segment::New(intptr_t size, Zone::Segment* next) {
|
| }
|
|
|
|
|
| +Zone::Zone()
|
| + : initial_buffer_(buffer_, kInitialChunkSize),
|
| + position_(initial_buffer_.start()),
|
| + limit_(initial_buffer_.end()),
|
| + head_(NULL),
|
| + large_segments_(NULL),
|
| + handles_(),
|
| + previous_(NULL) {
|
| + ASSERT(Utils::IsAligned(position_, kAlignment));
|
| +#ifdef DEBUG
|
| + // Zap the entire initial buffer.
|
| + memset(initial_buffer_.pointer(), kZapUninitializedByte,
|
| + initial_buffer_.size());
|
| +#endif
|
| +}
|
| +
|
| +
|
| +Zone::~Zone() {
|
| + if (FLAG_trace_zones) {
|
| + DumpZoneSizes();
|
| + }
|
| + DeleteAll();
|
| +}
|
| +
|
| +
|
| void Zone::DeleteAll() {
|
| // Traverse the chained list of segments, zapping (in debug mode)
|
| // and freeing every zone segment.
|
| @@ -234,4 +259,25 @@ char* Zone::VPrint(const char* format, va_list args) {
|
| }
|
|
|
|
|
| +StackZone::StackZone(Thread* thread) : StackResource(thread), zone_() {
|
| + if (FLAG_trace_zones) {
|
| + OS::PrintErr("*** Starting a new Stack zone 0x%" Px "(0x%" Px ")\n",
|
| + reinterpret_cast<intptr_t>(this),
|
| + reinterpret_cast<intptr_t>(&zone_));
|
| + }
|
| + zone_.Link(thread->zone());
|
| + thread->set_zone(&zone_);
|
| +}
|
| +
|
| +
|
| +StackZone::~StackZone() {
|
| + ASSERT(thread()->zone() == &zone_);
|
| + thread()->set_zone(zone_.previous_);
|
| + if (FLAG_trace_zones) {
|
| + OS::PrintErr("*** Deleting Stack zone 0x%" Px "(0x%" Px ")\n",
|
| + reinterpret_cast<intptr_t>(this),
|
| + reinterpret_cast<intptr_t>(&zone_));
|
| + }
|
| +}
|
| +
|
| } // namespace dart
|
|
|