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/handles.h" | 9 #include "vm/handles.h" |
10 #include "vm/os_thread.h" | 10 #include "vm/os_thread.h" |
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
159 | 159 |
160 // The topmost zone used for allocation in this thread. | 160 // The topmost zone used for allocation in this thread. |
161 Zone* zone() const { return state_.zone; } | 161 Zone* zone() const { return state_.zone; } |
162 | 162 |
163 // The isolate that this thread is operating on, or NULL if none. | 163 // The isolate that this thread is operating on, or NULL if none. |
164 Isolate* isolate() const { return isolate_; } | 164 Isolate* isolate() const { return isolate_; } |
165 static intptr_t isolate_offset() { | 165 static intptr_t isolate_offset() { |
166 return OFFSET_OF(Thread, isolate_); | 166 return OFFSET_OF(Thread, isolate_); |
167 } | 167 } |
168 | 168 |
169 // The (topmost) CHA for the compilation in the isolate of this thread. | 169 // The (topmost) CHA for the compilation in this thread. |
170 // TODO(23153): Move this out of Isolate/Thread. | |
171 CHA* cha() const; | 170 CHA* cha() const; |
172 void set_cha(CHA* value); | 171 void set_cha(CHA* value); |
173 | 172 |
| 173 int32_t no_callback_scope_depth() const { |
| 174 return no_callback_scope_depth_; |
| 175 } |
| 176 |
| 177 void IncrementNoCallbackScopeDepth() { |
| 178 ASSERT(no_callback_scope_depth_ < INT_MAX); |
| 179 no_callback_scope_depth_ += 1; |
| 180 } |
| 181 |
| 182 void DecrementNoCallbackScopeDepth() { |
| 183 ASSERT(no_callback_scope_depth_ > 0); |
| 184 no_callback_scope_depth_ -= 1; |
| 185 } |
| 186 |
174 void StoreBufferAddObject(RawObject* obj); | 187 void StoreBufferAddObject(RawObject* obj); |
175 void StoreBufferAddObjectGC(RawObject* obj); | 188 void StoreBufferAddObjectGC(RawObject* obj); |
176 #if defined(TESTING) | 189 #if defined(TESTING) |
177 bool StoreBufferContains(RawObject* obj) const { | 190 bool StoreBufferContains(RawObject* obj) const { |
178 return store_buffer_block_->Contains(obj); | 191 return store_buffer_block_->Contains(obj); |
179 } | 192 } |
180 #endif | 193 #endif |
181 void StoreBufferBlockProcess(StoreBuffer::ThresholdPolicy policy); | 194 void StoreBufferBlockProcess(StoreBuffer::ThresholdPolicy policy); |
182 static intptr_t store_buffer_block_offset() { | 195 static intptr_t store_buffer_block_offset() { |
183 return OFFSET_OF(Thread, store_buffer_block_); | 196 return OFFSET_OF(Thread, store_buffer_block_); |
(...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
438 | 451 |
439 #if defined(DEBUG) | 452 #if defined(DEBUG) |
440 #define REUSABLE_HANDLE_SCOPE_VARIABLE(object) \ | 453 #define REUSABLE_HANDLE_SCOPE_VARIABLE(object) \ |
441 bool reusable_##object##_handle_scope_active_; | 454 bool reusable_##object##_handle_scope_active_; |
442 REUSABLE_HANDLE_LIST(REUSABLE_HANDLE_SCOPE_VARIABLE); | 455 REUSABLE_HANDLE_LIST(REUSABLE_HANDLE_SCOPE_VARIABLE); |
443 #undef REUSABLE_HANDLE_SCOPE_VARIABLE | 456 #undef REUSABLE_HANDLE_SCOPE_VARIABLE |
444 #endif // defined(DEBUG) | 457 #endif // defined(DEBUG) |
445 | 458 |
446 VMHandles reusable_handles_; | 459 VMHandles reusable_handles_; |
447 | 460 |
| 461 CHA* cha_; |
| 462 int32_t no_callback_scope_depth_; |
| 463 |
448 // All |Thread|s are registered in the thread list. | 464 // All |Thread|s are registered in the thread list. |
449 Thread* thread_list_next_; | 465 Thread* thread_list_next_; |
450 | 466 |
451 static Thread* thread_list_head_; | 467 static Thread* thread_list_head_; |
452 static Mutex* thread_list_lock_; | 468 static Mutex* thread_list_lock_; |
453 | 469 |
454 static void AddThreadToList(Thread* thread); | 470 static void AddThreadToList(Thread* thread); |
455 static void RemoveThreadFromList(Thread* thread); | 471 static void RemoveThreadFromList(Thread* thread); |
456 | 472 |
457 explicit Thread(bool init_vm_constants = true); | 473 explicit Thread(bool init_vm_constants = true); |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
508 // Returns the current thread and moves forward. | 524 // Returns the current thread and moves forward. |
509 Thread* Next(); | 525 Thread* Next(); |
510 | 526 |
511 private: | 527 private: |
512 Thread* next_; | 528 Thread* next_; |
513 }; | 529 }; |
514 | 530 |
515 } // namespace dart | 531 } // namespace dart |
516 | 532 |
517 #endif // VM_THREAD_H_ | 533 #endif // VM_THREAD_H_ |
OLD | NEW |