| 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 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 63 } | 63 } |
| 64 | 64 |
| 65 // Convenient access to the isolate of the thread of this resource. | 65 // Convenient access to the isolate of the thread of this resource. |
| 66 Isolate* isolate() const { | 66 Isolate* isolate() const { |
| 67 return thread_ == NULL ? NULL : thread_->isolate(); | 67 return thread_ == NULL ? NULL : thread_->isolate(); |
| 68 } | 68 } |
| 69 | 69 |
| 70 // The thread that owns this resource. | 70 // The thread that owns this resource. |
| 71 Thread* thread() const { return thread_; } | 71 Thread* thread() const { return thread_; } |
| 72 | 72 |
| 73 // Destroy stack resources of isolate until top exit frame. | 73 // Destroy stack resources of thread until top exit frame. |
| 74 // TODO(koda): Migrate to Thread. | 74 static void Unwind(Thread* thread) { UnwindAbove(thread, NULL); } |
| 75 static void Unwind(Isolate* isolate) { UnwindAbove(isolate, NULL); } | 75 // Destroy stack resources of thread above new_top, exclusive. |
| 76 // TODO(koda): Migrate to Thread. | 76 static void UnwindAbove(Thread* thread, StackResource* new_top); |
| 77 // Destroy stack resources of isolate above new_top, exclusive. | |
| 78 static void UnwindAbove(Isolate* isolate, StackResource* new_top); | |
| 79 | 77 |
| 80 private: | 78 private: |
| 81 void Init(Thread* thread) { | 79 void Init(Thread* thread) { |
| 82 // We can only have longjumps and exceptions when there is a current | 80 // We can only have longjumps and exceptions when there is a current |
| 83 // thread and isolate. If there is no current thread, we don't need to | 81 // thread and isolate. If there is no current thread, we don't need to |
| 84 // protect this case. | 82 // protect this case. |
| 85 // TODO(23807): Eliminate this special case. | 83 // TODO(23807): Eliminate this special case. |
| 86 if (thread != NULL) { | 84 if (thread != NULL) { |
| 87 ASSERT(Thread::Current() == thread); | 85 ASSERT(Thread::Current() == thread); |
| 88 thread_ = thread; | 86 thread_ = thread; |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 132 // deallocated by invoking DeleteAll() on the zone they live in. | 130 // deallocated by invoking DeleteAll() on the zone they live in. |
| 133 void operator delete(void* pointer) { UNREACHABLE(); } | 131 void operator delete(void* pointer) { UNREACHABLE(); } |
| 134 | 132 |
| 135 private: | 133 private: |
| 136 DISALLOW_COPY_AND_ASSIGN(ZoneAllocated); | 134 DISALLOW_COPY_AND_ASSIGN(ZoneAllocated); |
| 137 }; | 135 }; |
| 138 | 136 |
| 139 } // namespace dart | 137 } // namespace dart |
| 140 | 138 |
| 141 #endif // VM_ALLOCATION_H_ | 139 #endif // VM_ALLOCATION_H_ |
| OLD | NEW |