OLD | NEW |
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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 "platform/assert.h" | 8 #include "platform/assert.h" |
9 #include "vm/base_isolate.h" | 9 #include "vm/base_isolate.h" |
10 #include "vm/globals.h" | 10 #include "vm/globals.h" |
(...skipping 19 matching lines...) Expand all Loading... |
30 }; | 30 }; |
31 | 31 |
32 | 32 |
33 // Stack resources subclass from this base class. The VM will ensure that the | 33 // Stack resources subclass from this base class. The VM will ensure that the |
34 // destructors of these objects are called before the stack is unwound past the | 34 // destructors of these objects are called before the stack is unwound past the |
35 // objects location on the stack. Use stack resource objects if objects | 35 // objects location on the stack. Use stack resource objects if objects |
36 // need to be destroyed even in the case of exceptions when a Longjump is done | 36 // need to be destroyed even in the case of exceptions when a Longjump is done |
37 // to a stack frame above the frame where these objects were allocated. | 37 // to a stack frame above the frame where these objects were allocated. |
38 class StackResource { | 38 class StackResource { |
39 public: | 39 public: |
40 // DEPRECATED: Use Thread-based interface. During migration, this defaults | |
41 // to using the mutator thread (which must also be the current thread). | |
42 explicit StackResource(Isolate* isolate) : thread_(NULL), previous_(NULL) { | |
43 Init((isolate == NULL) ? | |
44 NULL : reinterpret_cast<BaseIsolate*>(isolate)->mutator_thread_); | |
45 } | |
46 | |
47 explicit StackResource(Thread* thread) : thread_(NULL), previous_(NULL) { | 40 explicit StackResource(Thread* thread) : thread_(NULL), previous_(NULL) { |
48 Init(thread); | 41 Init(thread); |
49 } | 42 } |
50 | 43 |
51 virtual ~StackResource(); | 44 virtual ~StackResource(); |
52 | 45 |
53 // Convenient access to the isolate of the thread of this resource. | 46 // Convenient access to the isolate of the thread of this resource. |
54 Isolate* isolate() const; | 47 Isolate* isolate() const; |
55 | 48 |
56 // The thread that owns this resource. | 49 // The thread that owns this resource. |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
125 public: | 118 public: |
126 NoSafepointScope() {} | 119 NoSafepointScope() {} |
127 private: | 120 private: |
128 DISALLOW_COPY_AND_ASSIGN(NoSafepointScope); | 121 DISALLOW_COPY_AND_ASSIGN(NoSafepointScope); |
129 }; | 122 }; |
130 #endif // defined(DEBUG) | 123 #endif // defined(DEBUG) |
131 | 124 |
132 } // namespace dart | 125 } // namespace dart |
133 | 126 |
134 #endif // VM_ALLOCATION_H_ | 127 #endif // VM_ALLOCATION_H_ |
OLD | NEW |