Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(496)

Unified Diff: runtime/vm/zone.cc

Issue 11028145: Changed StackZone and ApiZone to be containers for Zone. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Added assertion for ApiZone linking. Created 8 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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);
« runtime/vm/zone.h ('K') | « runtime/vm/zone.h ('k') | runtime/vm/zone_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698