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 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
69 | 69 |
70 | 70 |
71 bool VMHandles::IsZoneHandle(uword handle) { | 71 bool VMHandles::IsZoneHandle(uword handle) { |
72 return Handles<kVMHandleSizeInWords, | 72 return Handles<kVMHandleSizeInWords, |
73 kVMHandlesPerChunk, | 73 kVMHandlesPerChunk, |
74 kOffsetOfRawPtr >::IsZoneHandle(handle); | 74 kOffsetOfRawPtr >::IsZoneHandle(handle); |
75 } | 75 } |
76 | 76 |
77 | 77 |
78 int VMHandles::ScopedHandleCount() { | 78 int VMHandles::ScopedHandleCount() { |
79 Isolate* isolate = Isolate::Current(); | 79 Thread* thread = Thread::Current(); |
80 ASSERT(isolate->current_zone() != NULL); | 80 ASSERT(thread->zone() != NULL); |
81 VMHandles* handles = isolate->current_zone()->handles(); | 81 VMHandles* handles = thread->zone()->handles(); |
82 return handles->CountScopedHandles(); | 82 return handles->CountScopedHandles(); |
83 } | 83 } |
84 | 84 |
85 | 85 |
86 int VMHandles::ZoneHandleCount() { | 86 int VMHandles::ZoneHandleCount() { |
87 Isolate* isolate = Isolate::Current(); | 87 Thread* thread = Thread::Current(); |
88 ASSERT(isolate->current_zone() != NULL); | 88 ASSERT(thread->zone() != NULL); |
89 VMHandles* handles = isolate->current_zone()->handles(); | 89 VMHandles* handles = thread->zone()->handles(); |
90 return handles->CountZoneHandles(); | 90 return handles->CountZoneHandles(); |
91 } | 91 } |
92 | 92 |
93 | 93 |
94 void HandleScope::Initialize() { | 94 void HandleScope::Initialize() { |
95 ASSERT(thread()->no_handle_scope_depth() == 0); | 95 ASSERT(thread()->no_handle_scope_depth() == 0); |
96 VMHandles* handles = thread()->zone()->handles(); | 96 VMHandles* handles = thread()->zone()->handles(); |
97 ASSERT(handles != NULL); | 97 ASSERT(handles != NULL); |
98 saved_handle_block_ = handles->scoped_blocks_; | 98 saved_handle_block_ = handles->scoped_blocks_; |
99 saved_handle_slot_ = handles->scoped_blocks_->next_handle_slot(); | 99 saved_handle_slot_ = handles->scoped_blocks_->next_handle_slot(); |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
139 thread()->IncrementNoHandleScopeDepth(); | 139 thread()->IncrementNoHandleScopeDepth(); |
140 } | 140 } |
141 | 141 |
142 | 142 |
143 NoHandleScope::~NoHandleScope() { | 143 NoHandleScope::~NoHandleScope() { |
144 thread()->DecrementNoHandleScopeDepth(); | 144 thread()->DecrementNoHandleScopeDepth(); |
145 } | 145 } |
146 #endif // defined(DEBUG) | 146 #endif // defined(DEBUG) |
147 | 147 |
148 } // namespace dart | 148 } // namespace dart |
OLD | NEW |