| OLD | NEW |
| 1 // Copyright (c) 2012, 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 #ifndef VM_HANDLES_IMPL_H_ | 5 #ifndef VM_HANDLES_IMPL_H_ |
| 6 #define VM_HANDLES_IMPL_H_ | 6 #define VM_HANDLES_IMPL_H_ |
| 7 | 7 |
| 8 #include "vm/heap.h" | 8 #include "vm/heap.h" |
| 9 #include "vm/thread.h" | 9 #include "vm/thread.h" |
| 10 #include "vm/visitor.h" | 10 #include "vm/visitor.h" |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 86 | 86 |
| 87 // Figure out the current handle scope using the current Zone and | 87 // Figure out the current handle scope using the current Zone and |
| 88 // allocate a handle in that scope. The function assumes that a | 88 // allocate a handle in that scope. The function assumes that a |
| 89 // current handle scope exists. It asserts for this appropriately. | 89 // current handle scope exists. It asserts for this appropriately. |
| 90 template <int kHandleSizeInWords, int kHandlesPerChunk, int kOffsetOfRawPtr> | 90 template <int kHandleSizeInWords, int kHandlesPerChunk, int kOffsetOfRawPtr> |
| 91 uword Handles<kHandleSizeInWords, | 91 uword Handles<kHandleSizeInWords, |
| 92 kHandlesPerChunk, | 92 kHandlesPerChunk, |
| 93 kOffsetOfRawPtr>::AllocateHandle(Zone* zone) { | 93 kOffsetOfRawPtr>::AllocateHandle(Zone* zone) { |
| 94 #if defined(DEBUG) | 94 #if defined(DEBUG) |
| 95 Thread* thread = Thread::Current(); | 95 Thread* thread = Thread::Current(); |
| 96 ASSERT(thread->zone() == zone); | |
| 97 ASSERT(thread->top_handle_scope() != NULL); | 96 ASSERT(thread->top_handle_scope() != NULL); |
| 98 ASSERT(thread->no_handle_scope_depth() == 0); | 97 ASSERT(thread->no_handle_scope_depth() == 0); |
| 99 #endif // DEBUG | 98 #endif // DEBUG |
| 100 Handles* handles = zone->handles(); | 99 Handles* handles = zone->handles(); |
| 101 ASSERT(handles != NULL); | 100 ASSERT(handles != NULL); |
| 102 return handles->AllocateScopedHandle(); | 101 return handles->AllocateScopedHandle(); |
| 103 } | 102 } |
| 104 | 103 |
| 105 | 104 |
| 106 // The function assumes that 'zone' is the current zone and asserts for | 105 // The function assumes that 'zone' is the current zone and asserts for |
| (...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 363 template <int kHandleSizeInWords, int kHandlesPerChunk, int kOffsetOfRawPtr> | 362 template <int kHandleSizeInWords, int kHandlesPerChunk, int kOffsetOfRawPtr> |
| 364 int Handles<kHandleSizeInWords, | 363 int Handles<kHandleSizeInWords, |
| 365 kHandlesPerChunk, | 364 kHandlesPerChunk, |
| 366 kOffsetOfRawPtr>::HandlesBlock::HandleCount() const { | 365 kOffsetOfRawPtr>::HandlesBlock::HandleCount() const { |
| 367 return (next_handle_slot_ / kHandleSizeInWords); | 366 return (next_handle_slot_ / kHandleSizeInWords); |
| 368 } | 367 } |
| 369 | 368 |
| 370 } // namespace dart | 369 } // namespace dart |
| 371 | 370 |
| 372 #endif // VM_HANDLES_IMPL_H_ | 371 #endif // VM_HANDLES_IMPL_H_ |
| OLD | NEW |