OLD | NEW |
---|---|
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 "platform/assert.h" | |
5 #include "vm/allocation.h" | 6 #include "vm/allocation.h" |
Ivan Posva
2012/01/13 23:22:06
first, and many others.
Søren Gjesse
2012/01/16 08:58:00
Done.
| |
6 | |
7 #include "vm/assert.h" | |
8 #include "vm/isolate.h" | 7 #include "vm/isolate.h" |
9 #include "vm/zone.h" | 8 #include "vm/zone.h" |
10 | 9 |
11 namespace dart { | 10 namespace dart { |
12 | 11 |
13 StackResource::StackResource(Isolate* isolate) : isolate_(isolate) { | 12 StackResource::StackResource(Isolate* isolate) : isolate_(isolate) { |
14 previous_ = isolate->top_resource(); | 13 previous_ = isolate->top_resource(); |
15 isolate->set_top_resource(this); | 14 isolate->set_top_resource(this); |
16 } | 15 } |
17 | 16 |
18 | 17 |
19 StackResource::~StackResource() { | 18 StackResource::~StackResource() { |
20 StackResource* top = isolate()->top_resource(); | 19 StackResource* top = isolate()->top_resource(); |
21 ASSERT(top == this); | 20 ASSERT(top == this); |
22 isolate()->set_top_resource(previous_); | 21 isolate()->set_top_resource(previous_); |
23 } | 22 } |
24 | 23 |
25 ZoneAllocated::~ZoneAllocated() { | 24 ZoneAllocated::~ZoneAllocated() { |
26 UNREACHABLE(); | 25 UNREACHABLE(); |
27 } | 26 } |
28 | 27 |
29 void* ZoneAllocated::operator new(uword size) { | 28 void* ZoneAllocated::operator new(uword size) { |
30 Isolate* isolate = Isolate::Current(); | 29 Isolate* isolate = Isolate::Current(); |
31 ASSERT(isolate != NULL); | 30 ASSERT(isolate != NULL); |
32 ASSERT(isolate->current_zone() != NULL); | 31 ASSERT(isolate->current_zone() != NULL); |
33 return reinterpret_cast<void*>(isolate->current_zone()->Allocate(size)); | 32 return reinterpret_cast<void*>(isolate->current_zone()->Allocate(size)); |
34 } | 33 } |
35 | 34 |
36 } // namespace dart | 35 } // namespace dart |
OLD | NEW |