Index: runtime/vm/handles.cc |
diff --git a/runtime/vm/handles.cc b/runtime/vm/handles.cc |
index bd45c731369df723f4733bf35f1d0c64c20bfb58..f636fdd29171a1d6d6747da37717c655090f22c7 100644 |
--- a/runtime/vm/handles.cc |
+++ b/runtime/vm/handles.cc |
@@ -91,47 +91,57 @@ int VMHandles::ZoneHandleCount() { |
} |
-HandleScope::HandleScope(Isolate* isolate) : StackResource(isolate) { |
- ASSERT(isolate->no_handle_scope_depth() == 0); |
- VMHandles* handles = isolate->current_zone()->handles(); |
+void HandleScope::Initialize() { |
+ ASSERT(thread()->no_handle_scope_depth() == 0); |
+ VMHandles* handles = thread()->zone()->handles(); |
ASSERT(handles != NULL); |
saved_handle_block_ = handles->scoped_blocks_; |
saved_handle_slot_ = handles->scoped_blocks_->next_handle_slot(); |
#if defined(DEBUG) |
- link_ = isolate->top_handle_scope(); |
- isolate->set_top_handle_scope(this); |
+ link_ = thread()->top_handle_scope(); |
+ thread()->set_top_handle_scope(this); |
#endif |
} |
+HandleScope::HandleScope(Thread* thread) : StackResource(thread) { |
+ Initialize(); |
+} |
+ |
+ |
+HandleScope::HandleScope(Isolate* isolate) : StackResource(isolate) { |
+ Initialize(); |
+} |
+ |
+ |
HandleScope::~HandleScope() { |
- ASSERT(isolate()->current_zone() != NULL); |
- VMHandles* handles = isolate()->current_zone()->handles(); |
+ ASSERT(thread()->zone() != NULL); |
+ VMHandles* handles = thread()->zone()->handles(); |
ASSERT(handles != NULL); |
handles->scoped_blocks_ = saved_handle_block_; |
handles->scoped_blocks_->set_next_handle_slot(saved_handle_slot_); |
#if defined(DEBUG) |
handles->VerifyScopedHandleState(); |
handles->ZapFreeScopedHandles(); |
- ASSERT(isolate()->top_handle_scope() == this); |
- isolate()->set_top_handle_scope(link_); |
+ ASSERT(thread()->top_handle_scope() == this); |
+ thread()->set_top_handle_scope(link_); |
#endif |
} |
#if defined(DEBUG) |
NoHandleScope::NoHandleScope(Isolate* isolate) : StackResource(isolate) { |
- isolate->IncrementNoHandleScopeDepth(); |
+ thread()->IncrementNoHandleScopeDepth(); |
} |
-NoHandleScope::NoHandleScope() : StackResource(Isolate::Current()) { |
- isolate()->IncrementNoHandleScopeDepth(); |
+NoHandleScope::NoHandleScope() : StackResource(Thread::Current()) { |
+ thread()->IncrementNoHandleScopeDepth(); |
} |
NoHandleScope::~NoHandleScope() { |
- isolate()->DecrementNoHandleScopeDepth(); |
+ thread()->DecrementNoHandleScopeDepth(); |
} |
#endif // defined(DEBUG) |