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/flags.h" | 9 #include "vm/flags.h" |
10 #include "vm/isolate.h" | 10 #include "vm/isolate.h" |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
62 | 62 |
63 | 63 |
64 int VMHandles::ZoneHandleCount() { | 64 int VMHandles::ZoneHandleCount() { |
65 Isolate* isolate = Isolate::Current(); | 65 Isolate* isolate = Isolate::Current(); |
66 ASSERT(isolate->current_zone() != NULL); | 66 ASSERT(isolate->current_zone() != NULL); |
67 VMHandles* handles = isolate->current_zone()->handles(); | 67 VMHandles* handles = isolate->current_zone()->handles(); |
68 return handles->CountZoneHandles(); | 68 return handles->CountZoneHandles(); |
69 } | 69 } |
70 | 70 |
71 | 71 |
72 HandleScope::HandleScope(Isolate* isolate) : StackResource(isolate) { | 72 HandleScope::HandleScope(BaseIsolate* isolate) : StackResource(isolate) { |
73 ASSERT(isolate->no_handle_scope_depth() == 0); | 73 ASSERT(isolate->no_handle_scope_depth() == 0); |
74 VMHandles* handles = isolate->current_zone()->handles(); | 74 VMHandles* handles = isolate->current_zone()->handles(); |
75 ASSERT(handles != NULL); | 75 ASSERT(handles != NULL); |
76 saved_handle_block_ = handles->scoped_blocks_; | 76 saved_handle_block_ = handles->scoped_blocks_; |
77 saved_handle_slot_ = handles->scoped_blocks_->next_handle_slot(); | 77 saved_handle_slot_ = handles->scoped_blocks_->next_handle_slot(); |
78 #if defined(DEBUG) | 78 #if defined(DEBUG) |
79 link_ = isolate->top_handle_scope(); | 79 link_ = isolate->top_handle_scope(); |
80 isolate->set_top_handle_scope(this); | 80 isolate->set_top_handle_scope(this); |
81 #endif | 81 #endif |
82 } | 82 } |
83 | 83 |
84 | 84 |
85 HandleScope::~HandleScope() { | 85 HandleScope::~HandleScope() { |
86 ASSERT(isolate()->current_zone() != NULL); | 86 ASSERT(isolate()->current_zone() != NULL); |
87 VMHandles* handles = isolate()->current_zone()->handles(); | 87 VMHandles* handles = isolate()->current_zone()->handles(); |
88 ASSERT(handles != NULL); | 88 ASSERT(handles != NULL); |
89 handles->scoped_blocks_ = saved_handle_block_; | 89 handles->scoped_blocks_ = saved_handle_block_; |
90 handles->scoped_blocks_->set_next_handle_slot(saved_handle_slot_); | 90 handles->scoped_blocks_->set_next_handle_slot(saved_handle_slot_); |
91 #if defined(DEBUG) | 91 #if defined(DEBUG) |
92 handles->VerifyScopedHandleState(); | 92 handles->VerifyScopedHandleState(); |
93 handles->ZapFreeScopedHandles(); | 93 handles->ZapFreeScopedHandles(); |
94 ASSERT(isolate()->top_handle_scope() == this); | 94 ASSERT(isolate()->top_handle_scope() == this); |
95 isolate()->set_top_handle_scope(link_); | 95 isolate()->set_top_handle_scope(link_); |
96 #endif | 96 #endif |
97 } | 97 } |
98 | 98 |
99 | 99 |
100 #if defined(DEBUG) | 100 #if defined(DEBUG) |
101 NoHandleScope::NoHandleScope(Isolate* isolate) : StackResource(isolate) { | 101 NoHandleScope::NoHandleScope(BaseIsolate* isolate) : StackResource(isolate) { |
102 isolate->IncrementNoHandleScopeDepth(); | 102 isolate->IncrementNoHandleScopeDepth(); |
103 } | 103 } |
104 | 104 |
105 | 105 |
106 NoHandleScope::~NoHandleScope() { | 106 NoHandleScope::~NoHandleScope() { |
107 isolate()->DecrementNoHandleScopeDepth(); | 107 isolate()->DecrementNoHandleScopeDepth(); |
108 } | 108 } |
109 #endif // defined(DEBUG) | 109 #endif // defined(DEBUG) |
110 | 110 |
111 } // namespace dart | 111 } // namespace dart |
OLD | NEW |