OLD | NEW |
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, 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_THREAD_H_ | 5 #ifndef VM_THREAD_H_ |
6 #define VM_THREAD_H_ | 6 #define VM_THREAD_H_ |
7 | 7 |
8 #include "vm/globals.h" | 8 #include "vm/globals.h" |
9 #include "vm/os_thread.h" | 9 #include "vm/os_thread.h" |
10 #include "vm/store_buffer.h" | 10 #include "vm/store_buffer.h" |
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
146 return 0; | 146 return 0; |
147 #endif | 147 #endif |
148 } | 148 } |
149 | 149 |
150 void set_top_handle_scope(HandleScope* handle_scope) { | 150 void set_top_handle_scope(HandleScope* handle_scope) { |
151 #if defined(DEBUG) | 151 #if defined(DEBUG) |
152 state_.top_handle_scope = handle_scope; | 152 state_.top_handle_scope = handle_scope; |
153 #endif | 153 #endif |
154 } | 154 } |
155 | 155 |
| 156 int32_t no_safepoint_scope_depth() const { |
| 157 #if defined(DEBUG) |
| 158 return state_.no_safepoint_scope_depth; |
| 159 #else |
| 160 return 0; |
| 161 #endif |
| 162 } |
| 163 |
| 164 void IncrementNoSafepointScopeDepth() { |
| 165 #if defined(DEBUG) |
| 166 ASSERT(state_.no_safepoint_scope_depth < INT_MAX); |
| 167 state_.no_safepoint_scope_depth += 1; |
| 168 #endif |
| 169 } |
| 170 |
| 171 void DecrementNoSafepointScopeDepth() { |
| 172 #if defined(DEBUG) |
| 173 ASSERT(state_.no_safepoint_scope_depth > 0); |
| 174 state_.no_safepoint_scope_depth -= 1; |
| 175 #endif |
| 176 } |
| 177 |
156 // Collection of isolate-specific state of a thread that is saved/restored | 178 // Collection of isolate-specific state of a thread that is saved/restored |
157 // on isolate exit/re-entry. | 179 // on isolate exit/re-entry. |
158 struct State { | 180 struct State { |
159 Zone* zone; | 181 Zone* zone; |
160 uword top_exit_frame_info; | 182 uword top_exit_frame_info; |
161 StackResource* top_resource; | 183 StackResource* top_resource; |
162 #if defined(DEBUG) | 184 #if defined(DEBUG) |
163 HandleScope* top_handle_scope; | 185 HandleScope* top_handle_scope; |
164 intptr_t no_handle_scope_depth; | 186 intptr_t no_handle_scope_depth; |
| 187 int32_t no_safepoint_scope_depth; |
165 #endif | 188 #endif |
166 }; | 189 }; |
167 | 190 |
168 #define DEFINE_OFFSET_METHOD(type_name, member_name, expr, default_init_value) \ | 191 #define DEFINE_OFFSET_METHOD(type_name, member_name, expr, default_init_value) \ |
169 static intptr_t member_name##offset() { \ | 192 static intptr_t member_name##offset() { \ |
170 return OFFSET_OF(Thread, member_name); \ | 193 return OFFSET_OF(Thread, member_name); \ |
171 } | 194 } |
172 CACHED_CONSTANTS_LIST(DEFINE_OFFSET_METHOD) | 195 CACHED_CONSTANTS_LIST(DEFINE_OFFSET_METHOD) |
173 #undef DEFINE_OFFSET_METHOD | 196 #undef DEFINE_OFFSET_METHOD |
174 | 197 |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
208 void Unschedule(); | 231 void Unschedule(); |
209 | 232 |
210 friend class Isolate; | 233 friend class Isolate; |
211 friend class StackZone; | 234 friend class StackZone; |
212 DISALLOW_COPY_AND_ASSIGN(Thread); | 235 DISALLOW_COPY_AND_ASSIGN(Thread); |
213 }; | 236 }; |
214 | 237 |
215 } // namespace dart | 238 } // namespace dart |
216 | 239 |
217 #endif // VM_THREAD_H_ | 240 #endif // VM_THREAD_H_ |
OLD | NEW |