Index: runtime/vm/zone.cc |
diff --git a/runtime/vm/zone.cc b/runtime/vm/zone.cc |
index 461fd874a66ad003b98eaa047bbd430f7c3fc5b4..754933992b29dc7f0a349b4d14f016e935cc4457 100644 |
--- a/runtime/vm/zone.cc |
+++ b/runtime/vm/zone.cc |
@@ -79,7 +79,9 @@ Zone::Zone() |
limit_(initial_buffer_.end()), |
head_(NULL), |
large_segments_(NULL), |
- handles_() { |
+ handles_(), |
+ previous_(NULL), |
+ next_(NULL) { |
#ifdef DEBUG |
// Zap the entire initial buffer. |
memset(initial_buffer_.pointer(), kZapUninitializedByte, |
@@ -206,24 +208,21 @@ void Zone::DumpZoneSizes() { |
StackZone::StackZone(BaseIsolate* isolate) |
: StackResource(isolate), |
- zone_(), |
- previous_(NULL) { |
- // Assert that there is no current zone as we only want to scope |
- // zones when transitioning from generated dart code to dart VM |
- // runtime code. |
- previous_ = isolate->current_zone(); |
- isolate->set_current_zone(this); |
+ zone_() { |
+ zone_.Link(isolate->current_zone()); |
+ isolate->set_current_zone(&zone_); |
} |
StackZone::~StackZone() { |
- ASSERT(isolate()->current_zone() == this); |
- isolate()->set_current_zone(previous_); |
+ ASSERT(isolate()->current_zone() == &zone_); |
+ isolate()->set_current_zone(zone_.previous_); |
+ zone_.Unlink(); |
} |
-void StackZone::VisitObjectPointers(ObjectPointerVisitor* visitor) { |
- StackZone* zone = this; |
+void Zone::VisitObjectPointers(ObjectPointerVisitor* visitor) { |
+ Zone* zone = this; |
while (zone != NULL) { |
zone->handles()->VisitObjectPointers(visitor); |
zone = zone->previous_; |
@@ -231,7 +230,7 @@ void StackZone::VisitObjectPointers(ObjectPointerVisitor* visitor) { |
} |
-char* StackZone::PrintToString(const char* format, ...) { |
+char* Zone::PrintToString(const char* format, ...) { |
va_list args; |
va_start(args, format); |
intptr_t len = OS::VSNPrint(NULL, 0, format, args); |