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 #ifndef VM_ALLOCATION_H_ | 5 #ifndef VM_ALLOCATION_H_ |
6 #define VM_ALLOCATION_H_ | 6 #define VM_ALLOCATION_H_ |
7 | 7 |
8 #include "vm/assert.h" | 8 #include "vm/assert.h" |
9 | 9 |
10 namespace dart { | 10 namespace dart { |
(...skipping 17 matching lines...) Expand all Loading... |
28 }; | 28 }; |
29 | 29 |
30 | 30 |
31 // Stack resources subclass from this base class. The VM will ensure that the | 31 // Stack resources subclass from this base class. The VM will ensure that the |
32 // destructors of these objects are called before the stack is unwound past the | 32 // destructors of these objects are called before the stack is unwound past the |
33 // objects location on the stack. Use stack resource objects if objects | 33 // objects location on the stack. Use stack resource objects if objects |
34 // need to be destroyed even in the case of exceptions when a Longjump is done | 34 // need to be destroyed even in the case of exceptions when a Longjump is done |
35 // to a stack frame above the frame where these objects were allocated. | 35 // to a stack frame above the frame where these objects were allocated. |
36 class StackResource { | 36 class StackResource { |
37 public: | 37 public: |
38 StackResource(); | 38 explicit StackResource(Isolate* isolate); |
39 virtual ~StackResource(); | 39 virtual ~StackResource(); |
40 | 40 |
41 Isolate* isolate() const { return isolate_; } | 41 Isolate* isolate() const { return isolate_; } |
42 | 42 |
43 // The delete operator should be private instead of public, but unfortunately | 43 // The delete operator should be private instead of public, but unfortunately |
44 // the compiler complains when compiling the destructors for subclasses. | 44 // the compiler complains when compiling the destructors for subclasses. |
45 void operator delete(void* pointer) { UNREACHABLE(); } | 45 void operator delete(void* pointer) { UNREACHABLE(); } |
46 | 46 |
47 private: | 47 private: |
48 Isolate* isolate_; // Current isolate for this stack resource. | 48 Isolate* isolate_; // Current isolate for this stack resource. |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
86 // deallocated by invoking DeleteAll() on the zone they live in. | 86 // deallocated by invoking DeleteAll() on the zone they live in. |
87 void operator delete(void* pointer) { UNREACHABLE(); } | 87 void operator delete(void* pointer) { UNREACHABLE(); } |
88 | 88 |
89 private: | 89 private: |
90 DISALLOW_COPY_AND_ASSIGN(ZoneAllocated); | 90 DISALLOW_COPY_AND_ASSIGN(ZoneAllocated); |
91 }; | 91 }; |
92 | 92 |
93 } // namespace dart | 93 } // namespace dart |
94 | 94 |
95 #endif // VM_ALLOCATION_H_ | 95 #endif // VM_ALLOCATION_H_ |
OLD | NEW |