| OLD | NEW |
| 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 #include "vm/zone.h" | 5 #include "vm/zone.h" |
| 6 | 6 |
| 7 #include "vm/assert.h" | 7 #include "vm/assert.h" |
| 8 #include "vm/flags.h" | 8 #include "vm/flags.h" |
| 9 #include "vm/isolate.h" | 9 #include "vm/isolate.h" |
| 10 #include "vm/os.h" | 10 #include "vm/os.h" |
| (...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 216 #endif | 216 #endif |
| 217 | 217 |
| 218 | 218 |
| 219 Zone::Zone() | 219 Zone::Zone() |
| 220 : zone_(), | 220 : zone_(), |
| 221 handles_(), | 221 handles_(), |
| 222 previous_(NULL) { | 222 previous_(NULL) { |
| 223 // Assert that there is no current zone as we only want to scope | 223 // Assert that there is no current zone as we only want to scope |
| 224 // zones when transitioning from generated dart code to dart VM | 224 // zones when transitioning from generated dart code to dart VM |
| 225 // runtime code. | 225 // runtime code. |
| 226 Isolate* isolate = Isolate::Current(); | 226 previous_ = isolate()->current_zone(); |
| 227 previous_ = isolate->current_zone(); | 227 isolate()->set_current_zone(this); |
| 228 Isolate::Current()->set_current_zone(this); | |
| 229 } | 228 } |
| 230 | 229 |
| 231 | 230 |
| 232 Zone::~Zone() { | 231 Zone::~Zone() { |
| 233 Isolate* isolate = Isolate::Current(); | 232 ASSERT(isolate()->current_zone() == this); |
| 234 ASSERT(isolate->current_zone() == this); | 233 isolate()->set_current_zone(previous_); |
| 235 isolate->set_current_zone(previous_); | |
| 236 } | 234 } |
| 237 | 235 |
| 238 | 236 |
| 239 void Zone::VisitObjectPointers(ObjectPointerVisitor* visitor) { | 237 void Zone::VisitObjectPointers(ObjectPointerVisitor* visitor) { |
| 240 Zone* zone = this; | 238 Zone* zone = this; |
| 241 while (zone != NULL) { | 239 while (zone != NULL) { |
| 242 zone->handles()->VisitObjectPointers(visitor); | 240 zone->handles()->VisitObjectPointers(visitor); |
| 243 zone = zone->previous_; | 241 zone = zone->previous_; |
| 244 } | 242 } |
| 245 } | 243 } |
| 246 | 244 |
| 247 } // namespace dart | 245 } // namespace dart |
| OLD | NEW |