| 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" |
| 11 | 11 |
| 12 namespace dart { | 12 namespace dart { |
| 13 | 13 |
| 14 class CHA; | 14 class CHA; |
| 15 class HandleScope; | 15 class HandleScope; |
| 16 class Heap; | 16 class Heap; |
| 17 class InterruptableThreadState; | |
| 18 class Isolate; | 17 class Isolate; |
| 19 class LongJumpScope; | 18 class LongJumpScope; |
| 20 class Object; | 19 class Object; |
| 21 class RawBool; | 20 class RawBool; |
| 22 class RawObject; | 21 class RawObject; |
| 23 class StackResource; | 22 class StackResource; |
| 24 class TimelineEventBlock; | 23 class TimelineEventBlock; |
| 25 class Zone; | 24 class Zone; |
| 26 | 25 |
| 27 | 26 |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 135 } | 134 } |
| 136 | 135 |
| 137 StackResource* top_resource() const { return state_.top_resource; } | 136 StackResource* top_resource() const { return state_.top_resource; } |
| 138 void set_top_resource(StackResource* value) { | 137 void set_top_resource(StackResource* value) { |
| 139 state_.top_resource = value; | 138 state_.top_resource = value; |
| 140 } | 139 } |
| 141 static intptr_t top_resource_offset() { | 140 static intptr_t top_resource_offset() { |
| 142 return OFFSET_OF(Thread, state_) + OFFSET_OF(State, top_resource); | 141 return OFFSET_OF(Thread, state_) + OFFSET_OF(State, top_resource); |
| 143 } | 142 } |
| 144 | 143 |
| 145 void set_thread_state(InterruptableThreadState* state) { | |
| 146 ASSERT((thread_state() == NULL) || (state == NULL)); | |
| 147 state_.thread_state = state; | |
| 148 } | |
| 149 | |
| 150 InterruptableThreadState* thread_state() const { | |
| 151 return state_.thread_state; | |
| 152 } | |
| 153 | |
| 154 static intptr_t heap_offset() { | 144 static intptr_t heap_offset() { |
| 155 return OFFSET_OF(Thread, heap_); | 145 return OFFSET_OF(Thread, heap_); |
| 156 } | 146 } |
| 157 | 147 |
| 158 int32_t no_handle_scope_depth() const { | 148 int32_t no_handle_scope_depth() const { |
| 159 #if defined(DEBUG) | 149 #if defined(DEBUG) |
| 160 return state_.no_handle_scope_depth; | 150 return state_.no_handle_scope_depth; |
| 161 #else | 151 #else |
| 162 return 0; | 152 return 0; |
| 163 #endif | 153 #endif |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 213 #endif | 203 #endif |
| 214 } | 204 } |
| 215 | 205 |
| 216 // Collection of isolate-specific state of a thread that is saved/restored | 206 // Collection of isolate-specific state of a thread that is saved/restored |
| 217 // on isolate exit/re-entry. | 207 // on isolate exit/re-entry. |
| 218 struct State { | 208 struct State { |
| 219 Zone* zone; | 209 Zone* zone; |
| 220 uword top_exit_frame_info; | 210 uword top_exit_frame_info; |
| 221 StackResource* top_resource; | 211 StackResource* top_resource; |
| 222 TimelineEventBlock* timeline_block; | 212 TimelineEventBlock* timeline_block; |
| 223 // TODO(koda): Migrate individual fields of InterruptableThreadState. | |
| 224 InterruptableThreadState* thread_state; | |
| 225 LongJumpScope* long_jump_base; | 213 LongJumpScope* long_jump_base; |
| 226 #if defined(DEBUG) | 214 #if defined(DEBUG) |
| 227 HandleScope* top_handle_scope; | 215 HandleScope* top_handle_scope; |
| 228 intptr_t no_handle_scope_depth; | 216 intptr_t no_handle_scope_depth; |
| 229 int32_t no_safepoint_scope_depth; | 217 int32_t no_safepoint_scope_depth; |
| 230 #endif | 218 #endif |
| 231 }; | 219 }; |
| 232 | 220 |
| 233 #define DEFINE_OFFSET_METHOD(type_name, member_name, expr, default_init_value) \ | 221 #define DEFINE_OFFSET_METHOD(type_name, member_name, expr, default_init_value) \ |
| 234 static intptr_t member_name##offset() { \ | 222 static intptr_t member_name##offset() { \ |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 305 friend class ApiZone; | 293 friend class ApiZone; |
| 306 friend class Isolate; | 294 friend class Isolate; |
| 307 friend class StackZone; | 295 friend class StackZone; |
| 308 friend class ThreadRegistry; | 296 friend class ThreadRegistry; |
| 309 DISALLOW_COPY_AND_ASSIGN(Thread); | 297 DISALLOW_COPY_AND_ASSIGN(Thread); |
| 310 }; | 298 }; |
| 311 | 299 |
| 312 } // namespace dart | 300 } // namespace dart |
| 313 | 301 |
| 314 #endif // VM_THREAD_H_ | 302 #endif // VM_THREAD_H_ |
| OLD | NEW |