| 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 #include "vm/handles.h" | 5 #include "vm/handles.h" |
| 6 | 6 |
| 7 #include "platform/assert.h" | 7 #include "platform/assert.h" |
| 8 #include "platform/utils.h" | 8 #include "platform/utils.h" |
| 9 #include "vm/dart_api_state.h" | 9 #include "vm/dart_api_state.h" |
| 10 #include "vm/flags.h" | 10 #include "vm/flags.h" |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 102 thread()->set_top_handle_scope(this); | 102 thread()->set_top_handle_scope(this); |
| 103 #endif | 103 #endif |
| 104 } | 104 } |
| 105 | 105 |
| 106 | 106 |
| 107 HandleScope::HandleScope(Thread* thread) : StackResource(thread) { | 107 HandleScope::HandleScope(Thread* thread) : StackResource(thread) { |
| 108 Initialize(); | 108 Initialize(); |
| 109 } | 109 } |
| 110 | 110 |
| 111 | 111 |
| 112 HandleScope::HandleScope(Isolate* isolate) : StackResource(isolate) { | |
| 113 Initialize(); | |
| 114 } | |
| 115 | |
| 116 | |
| 117 HandleScope::~HandleScope() { | 112 HandleScope::~HandleScope() { |
| 118 ASSERT(thread()->zone() != NULL); | 113 ASSERT(thread()->zone() != NULL); |
| 119 VMHandles* handles = thread()->zone()->handles(); | 114 VMHandles* handles = thread()->zone()->handles(); |
| 120 ASSERT(handles != NULL); | 115 ASSERT(handles != NULL); |
| 121 handles->scoped_blocks_ = saved_handle_block_; | 116 handles->scoped_blocks_ = saved_handle_block_; |
| 122 handles->scoped_blocks_->set_next_handle_slot(saved_handle_slot_); | 117 handles->scoped_blocks_->set_next_handle_slot(saved_handle_slot_); |
| 123 #if defined(DEBUG) | 118 #if defined(DEBUG) |
| 124 handles->VerifyScopedHandleState(); | 119 handles->VerifyScopedHandleState(); |
| 125 handles->ZapFreeScopedHandles(); | 120 handles->ZapFreeScopedHandles(); |
| 126 ASSERT(thread()->top_handle_scope() == this); | 121 ASSERT(thread()->top_handle_scope() == this); |
| 127 thread()->set_top_handle_scope(link_); | 122 thread()->set_top_handle_scope(link_); |
| 128 #endif | 123 #endif |
| 129 } | 124 } |
| 130 | 125 |
| 131 | 126 |
| 132 #if defined(DEBUG) | 127 #if defined(DEBUG) |
| 133 NoHandleScope::NoHandleScope(Isolate* isolate) : StackResource(isolate) { | 128 NoHandleScope::NoHandleScope(Thread* thread) : StackResource(thread) { |
| 134 thread()->IncrementNoHandleScopeDepth(); | 129 thread->IncrementNoHandleScopeDepth(); |
| 135 } | 130 } |
| 136 | 131 |
| 137 | 132 |
| 138 NoHandleScope::NoHandleScope() : StackResource(Thread::Current()) { | |
| 139 thread()->IncrementNoHandleScopeDepth(); | |
| 140 } | |
| 141 | |
| 142 | |
| 143 NoHandleScope::~NoHandleScope() { | 133 NoHandleScope::~NoHandleScope() { |
| 144 thread()->DecrementNoHandleScopeDepth(); | 134 thread()->DecrementNoHandleScopeDepth(); |
| 145 } | 135 } |
| 146 #endif // defined(DEBUG) | 136 #endif // defined(DEBUG) |
| 147 | 137 |
| 148 } // namespace dart | 138 } // namespace dart |
| OLD | NEW |