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 #include "vm/thread.h" | 5 #include "vm/thread.h" |
6 | 6 |
7 #include "vm/compiler_stats.h" | 7 #include "vm/compiler_stats.h" |
8 #include "vm/dart_api_state.h" | 8 #include "vm/dart_api_state.h" |
9 #include "vm/growable_array.h" | 9 #include "vm/growable_array.h" |
10 #include "vm/isolate.h" | 10 #include "vm/isolate.h" |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
94 deferred_interrupts_mask_(0), | 94 deferred_interrupts_mask_(0), |
95 deferred_interrupts_(0), | 95 deferred_interrupts_(0), |
96 stack_overflow_count_(0), | 96 stack_overflow_count_(0), |
97 cha_(NULL), | 97 cha_(NULL), |
98 deopt_id_(0), | 98 deopt_id_(0), |
99 pending_functions_(GrowableObjectArray::null()), | 99 pending_functions_(GrowableObjectArray::null()), |
100 active_exception_(Object::null()), | 100 active_exception_(Object::null()), |
101 active_stacktrace_(Object::null()), | 101 active_stacktrace_(Object::null()), |
102 resume_pc_(0), | 102 resume_pc_(0), |
103 sticky_error_(Error::null()), | 103 sticky_error_(Error::null()), |
| 104 async_stack_trace_(StackTrace::null()), |
104 compiler_stats_(NULL), | 105 compiler_stats_(NULL), |
105 REUSABLE_HANDLE_LIST(REUSABLE_HANDLE_INITIALIZERS) | 106 REUSABLE_HANDLE_LIST(REUSABLE_HANDLE_INITIALIZERS) |
106 REUSABLE_HANDLE_LIST(REUSABLE_HANDLE_SCOPE_INIT) safepoint_state_(0), | 107 REUSABLE_HANDLE_LIST(REUSABLE_HANDLE_SCOPE_INIT) safepoint_state_(0), |
107 execution_state_(kThreadInNative), | 108 execution_state_(kThreadInNative), |
108 next_(NULL) { | 109 next_(NULL) { |
109 #if !defined(PRODUCT) | 110 #if !defined(PRODUCT) |
110 dart_stream_ = Timeline::GetDartStream(); | 111 dart_stream_ = Timeline::GetDartStream(); |
111 ASSERT(dart_stream_ != NULL); | 112 ASSERT(dart_stream_ != NULL); |
112 #endif | 113 #endif |
113 #define DEFAULT_INIT(type_name, member_name, init_expr, default_init_value) \ | 114 #define DEFAULT_INIT(type_name, member_name, init_expr, default_init_value) \ |
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
285 return "kMarkerTask"; | 286 return "kMarkerTask"; |
286 case kFinalizerTask: | 287 case kFinalizerTask: |
287 return "kFinalizerTask"; | 288 return "kFinalizerTask"; |
288 default: | 289 default: |
289 UNREACHABLE(); | 290 UNREACHABLE(); |
290 return ""; | 291 return ""; |
291 } | 292 } |
292 } | 293 } |
293 | 294 |
294 | 295 |
| 296 RawStackTrace* Thread::async_stack_trace() const { |
| 297 return async_stack_trace_; |
| 298 } |
| 299 |
| 300 |
| 301 void Thread::set_async_stack_trace(const StackTrace& stack_trace) { |
| 302 ASSERT(!stack_trace.IsNull()); |
| 303 async_stack_trace_ = stack_trace.raw(); |
| 304 } |
| 305 |
| 306 |
| 307 void Thread::clear_async_stack_trace() { |
| 308 async_stack_trace_ = StackTrace::null(); |
| 309 } |
| 310 |
| 311 |
295 bool Thread::EnterIsolate(Isolate* isolate) { | 312 bool Thread::EnterIsolate(Isolate* isolate) { |
296 const bool kIsMutatorThread = true; | 313 const bool kIsMutatorThread = true; |
297 Thread* thread = isolate->ScheduleThread(kIsMutatorThread); | 314 Thread* thread = isolate->ScheduleThread(kIsMutatorThread); |
298 if (thread != NULL) { | 315 if (thread != NULL) { |
299 ASSERT(thread->store_buffer_block_ == NULL); | 316 ASSERT(thread->store_buffer_block_ == NULL); |
300 thread->task_kind_ = kMutatorTask; | 317 thread->task_kind_ = kMutatorTask; |
301 thread->StoreBufferAcquire(); | 318 thread->StoreBufferAcquire(); |
302 return true; | 319 return true; |
303 } | 320 } |
304 return false; | 321 return false; |
(...skipping 358 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
663 zone_->VisitObjectPointers(visitor); | 680 zone_->VisitObjectPointers(visitor); |
664 } | 681 } |
665 | 682 |
666 // Visit objects in thread specific handles area. | 683 // Visit objects in thread specific handles area. |
667 reusable_handles_.VisitObjectPointers(visitor); | 684 reusable_handles_.VisitObjectPointers(visitor); |
668 | 685 |
669 visitor->VisitPointer(reinterpret_cast<RawObject**>(&pending_functions_)); | 686 visitor->VisitPointer(reinterpret_cast<RawObject**>(&pending_functions_)); |
670 visitor->VisitPointer(reinterpret_cast<RawObject**>(&active_exception_)); | 687 visitor->VisitPointer(reinterpret_cast<RawObject**>(&active_exception_)); |
671 visitor->VisitPointer(reinterpret_cast<RawObject**>(&active_stacktrace_)); | 688 visitor->VisitPointer(reinterpret_cast<RawObject**>(&active_stacktrace_)); |
672 visitor->VisitPointer(reinterpret_cast<RawObject**>(&sticky_error_)); | 689 visitor->VisitPointer(reinterpret_cast<RawObject**>(&sticky_error_)); |
| 690 visitor->VisitPointer(reinterpret_cast<RawObject**>(&async_stack_trace_)); |
673 | 691 |
674 // Visit the api local scope as it has all the api local handles. | 692 // Visit the api local scope as it has all the api local handles. |
675 ApiLocalScope* scope = api_top_scope_; | 693 ApiLocalScope* scope = api_top_scope_; |
676 while (scope != NULL) { | 694 while (scope != NULL) { |
677 scope->local_handles()->VisitObjectPointers(visitor); | 695 scope->local_handles()->VisitObjectPointers(visitor); |
678 scope = scope->previous(); | 696 scope = scope->previous(); |
679 } | 697 } |
680 | 698 |
681 // Iterate over all the stack frames and visit objects on the stack. | 699 // Iterate over all the stack frames and visit objects on the stack. |
682 StackFrameIterator frames_iterator(top_exit_frame_info(), validate_frames); | 700 StackFrameIterator frames_iterator(top_exit_frame_info(), validate_frames); |
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
844 | 862 |
845 DisableThreadInterruptsScope::~DisableThreadInterruptsScope() { | 863 DisableThreadInterruptsScope::~DisableThreadInterruptsScope() { |
846 if (thread() != NULL) { | 864 if (thread() != NULL) { |
847 OSThread* os_thread = thread()->os_thread(); | 865 OSThread* os_thread = thread()->os_thread(); |
848 ASSERT(os_thread != NULL); | 866 ASSERT(os_thread != NULL); |
849 os_thread->EnableThreadInterrupts(); | 867 os_thread->EnableThreadInterrupts(); |
850 } | 868 } |
851 } | 869 } |
852 | 870 |
853 } // namespace dart | 871 } // namespace dart |
OLD | NEW |