| 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; | 17 class InterruptableThreadState; |
| 18 class Isolate; | 18 class Isolate; |
| 19 class LongJumpScope; |
| 19 class Object; | 20 class Object; |
| 20 class RawBool; | 21 class RawBool; |
| 21 class RawObject; | 22 class RawObject; |
| 22 class StackResource; | 23 class StackResource; |
| 23 class TimelineEventBlock; | 24 class TimelineEventBlock; |
| 24 class Zone; | 25 class Zone; |
| 25 | 26 |
| 26 | 27 |
| 27 // List of VM-global objects/addresses cached in each Thread object. | 28 // List of VM-global objects/addresses cached in each Thread object. |
| 28 #define CACHED_VM_OBJECTS_LIST(V) \ | 29 #define CACHED_VM_OBJECTS_LIST(V) \ |
| (...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 194 | 195 |
| 195 // Collection of isolate-specific state of a thread that is saved/restored | 196 // Collection of isolate-specific state of a thread that is saved/restored |
| 196 // on isolate exit/re-entry. | 197 // on isolate exit/re-entry. |
| 197 struct State { | 198 struct State { |
| 198 Zone* zone; | 199 Zone* zone; |
| 199 uword top_exit_frame_info; | 200 uword top_exit_frame_info; |
| 200 StackResource* top_resource; | 201 StackResource* top_resource; |
| 201 TimelineEventBlock* timeline_block; | 202 TimelineEventBlock* timeline_block; |
| 202 // TODO(koda): Migrate individual fields of InterruptableThreadState. | 203 // TODO(koda): Migrate individual fields of InterruptableThreadState. |
| 203 InterruptableThreadState* thread_state; | 204 InterruptableThreadState* thread_state; |
| 205 LongJumpScope* long_jump_base; |
| 204 #if defined(DEBUG) | 206 #if defined(DEBUG) |
| 205 HandleScope* top_handle_scope; | 207 HandleScope* top_handle_scope; |
| 206 intptr_t no_handle_scope_depth; | 208 intptr_t no_handle_scope_depth; |
| 207 int32_t no_safepoint_scope_depth; | 209 int32_t no_safepoint_scope_depth; |
| 208 #endif | 210 #endif |
| 209 }; | 211 }; |
| 210 | 212 |
| 211 #define DEFINE_OFFSET_METHOD(type_name, member_name, expr, default_init_value) \ | 213 #define DEFINE_OFFSET_METHOD(type_name, member_name, expr, default_init_value) \ |
| 212 static intptr_t member_name##offset() { \ | 214 static intptr_t member_name##offset() { \ |
| 213 return OFFSET_OF(Thread, member_name); \ | 215 return OFFSET_OF(Thread, member_name); \ |
| 214 } | 216 } |
| 215 CACHED_CONSTANTS_LIST(DEFINE_OFFSET_METHOD) | 217 CACHED_CONSTANTS_LIST(DEFINE_OFFSET_METHOD) |
| 216 #undef DEFINE_OFFSET_METHOD | 218 #undef DEFINE_OFFSET_METHOD |
| 217 | 219 |
| 218 static bool CanLoadFromThread(const Object& object); | 220 static bool CanLoadFromThread(const Object& object); |
| 219 static intptr_t OffsetFromThread(const Object& object); | 221 static intptr_t OffsetFromThread(const Object& object); |
| 220 | 222 |
| 221 TimelineEventBlock* timeline_block() const { | 223 TimelineEventBlock* timeline_block() const { |
| 222 return state_.timeline_block; | 224 return state_.timeline_block; |
| 223 } | 225 } |
| 224 | 226 |
| 225 void set_timeline_block(TimelineEventBlock* block) { | 227 void set_timeline_block(TimelineEventBlock* block) { |
| 226 state_.timeline_block = block; | 228 state_.timeline_block = block; |
| 227 } | 229 } |
| 228 | 230 |
| 231 LongJumpScope* long_jump_base() const { return state_.long_jump_base; } |
| 232 void set_long_jump_base(LongJumpScope* value) { |
| 233 state_.long_jump_base = value; |
| 234 } |
| 235 |
| 229 private: | 236 private: |
| 230 static ThreadLocalKey thread_key_; | 237 static ThreadLocalKey thread_key_; |
| 231 | 238 |
| 232 Isolate* isolate_; | 239 Isolate* isolate_; |
| 233 Heap* heap_; | 240 Heap* heap_; |
| 234 State state_; | 241 State state_; |
| 235 StoreBufferBlock* store_buffer_block_; | 242 StoreBufferBlock* store_buffer_block_; |
| 236 #define DECLARE_MEMBERS(type_name, member_name, expr, default_init_value) \ | 243 #define DECLARE_MEMBERS(type_name, member_name, expr, default_init_value) \ |
| 237 type_name member_name; | 244 type_name member_name; |
| 238 CACHED_CONSTANTS_LIST(DECLARE_MEMBERS) | 245 CACHED_CONSTANTS_LIST(DECLARE_MEMBERS) |
| (...skipping 23 matching lines...) Expand all Loading... |
| 262 friend class ApiZone; | 269 friend class ApiZone; |
| 263 friend class Isolate; | 270 friend class Isolate; |
| 264 friend class StackZone; | 271 friend class StackZone; |
| 265 friend class ThreadRegistry; | 272 friend class ThreadRegistry; |
| 266 DISALLOW_COPY_AND_ASSIGN(Thread); | 273 DISALLOW_COPY_AND_ASSIGN(Thread); |
| 267 }; | 274 }; |
| 268 | 275 |
| 269 } // namespace dart | 276 } // namespace dart |
| 270 | 277 |
| 271 #endif // VM_THREAD_H_ | 278 #endif // VM_THREAD_H_ |
| OLD | NEW |