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 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
86 reusable_handles_(), | 86 reusable_handles_(), |
87 saved_stack_limit_(0), | 87 saved_stack_limit_(0), |
88 defer_oob_messages_count_(0), | 88 defer_oob_messages_count_(0), |
89 deferred_interrupts_mask_(0), | 89 deferred_interrupts_mask_(0), |
90 deferred_interrupts_(0), | 90 deferred_interrupts_(0), |
91 stack_overflow_count_(0), | 91 stack_overflow_count_(0), |
92 cha_(NULL), | 92 cha_(NULL), |
93 type_range_cache_(NULL), | 93 type_range_cache_(NULL), |
94 deopt_id_(0), | 94 deopt_id_(0), |
95 pending_functions_(GrowableObjectArray::null()), | 95 pending_functions_(GrowableObjectArray::null()), |
96 active_exception_(Object::null()), | |
97 active_stacktrace_(Object::null()), | |
98 resume_pc_(0), | |
99 sticky_error_(Error::null()), | 96 sticky_error_(Error::null()), |
100 compiler_stats_(NULL), | 97 compiler_stats_(NULL), |
101 REUSABLE_HANDLE_LIST(REUSABLE_HANDLE_INITIALIZERS) | 98 REUSABLE_HANDLE_LIST(REUSABLE_HANDLE_INITIALIZERS) |
102 REUSABLE_HANDLE_LIST(REUSABLE_HANDLE_SCOPE_INIT) safepoint_state_(0), | 99 REUSABLE_HANDLE_LIST(REUSABLE_HANDLE_SCOPE_INIT) safepoint_state_(0), |
103 execution_state_(kThreadInNative), | 100 execution_state_(kThreadInNative), |
104 next_(NULL) { | 101 next_(NULL) { |
105 #if !defined(PRODUCT) | 102 #if !defined(PRODUCT) |
106 dart_stream_ = Timeline::GetDartStream(); | 103 dart_stream_ = Timeline::GetDartStream(); |
107 ASSERT(dart_stream_ != NULL); | 104 ASSERT(dart_stream_ != NULL); |
108 #endif | 105 #endif |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
211 } | 208 } |
212 return pending_functions_; | 209 return pending_functions_; |
213 } | 210 } |
214 | 211 |
215 | 212 |
216 void Thread::clear_pending_functions() { | 213 void Thread::clear_pending_functions() { |
217 pending_functions_ = GrowableObjectArray::null(); | 214 pending_functions_ = GrowableObjectArray::null(); |
218 } | 215 } |
219 | 216 |
220 | 217 |
221 void Thread::set_active_exception(const Object& value) { | |
222 ASSERT(!value.IsNull()); | |
223 active_exception_ = value.raw(); | |
224 } | |
225 | |
226 | |
227 void Thread::set_active_stacktrace(const Object& value) { | |
228 active_stacktrace_ = value.raw(); | |
229 } | |
230 | |
231 | |
232 RawError* Thread::sticky_error() const { | 218 RawError* Thread::sticky_error() const { |
233 return sticky_error_; | 219 return sticky_error_; |
234 } | 220 } |
235 | 221 |
236 | 222 |
237 void Thread::set_sticky_error(const Error& value) { | 223 void Thread::set_sticky_error(const Error& value) { |
238 ASSERT(!value.IsNull()); | 224 ASSERT(!value.IsNull()); |
239 sticky_error_ = value.raw(); | 225 sticky_error_ = value.raw(); |
240 } | 226 } |
241 | 227 |
(...skipping 371 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
613 ASSERT(visitor != NULL); | 599 ASSERT(visitor != NULL); |
614 | 600 |
615 if (zone_ != NULL) { | 601 if (zone_ != NULL) { |
616 zone_->VisitObjectPointers(visitor); | 602 zone_->VisitObjectPointers(visitor); |
617 } | 603 } |
618 | 604 |
619 // Visit objects in thread specific handles area. | 605 // Visit objects in thread specific handles area. |
620 reusable_handles_.VisitObjectPointers(visitor); | 606 reusable_handles_.VisitObjectPointers(visitor); |
621 | 607 |
622 visitor->VisitPointer(reinterpret_cast<RawObject**>(&pending_functions_)); | 608 visitor->VisitPointer(reinterpret_cast<RawObject**>(&pending_functions_)); |
623 visitor->VisitPointer(reinterpret_cast<RawObject**>(&active_exception_)); | |
624 visitor->VisitPointer(reinterpret_cast<RawObject**>(&active_stacktrace_)); | |
625 visitor->VisitPointer(reinterpret_cast<RawObject**>(&sticky_error_)); | 609 visitor->VisitPointer(reinterpret_cast<RawObject**>(&sticky_error_)); |
626 | 610 |
627 // Visit the api local scope as it has all the api local handles. | 611 // Visit the api local scope as it has all the api local handles. |
628 ApiLocalScope* scope = api_top_scope_; | 612 ApiLocalScope* scope = api_top_scope_; |
629 while (scope != NULL) { | 613 while (scope != NULL) { |
630 scope->local_handles()->VisitObjectPointers(visitor); | 614 scope->local_handles()->VisitObjectPointers(visitor); |
631 scope = scope->previous(); | 615 scope = scope->previous(); |
632 } | 616 } |
633 | 617 |
634 // Iterate over all the stack frames and visit objects on the stack. | 618 // Iterate over all the stack frames and visit objects on the stack. |
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
773 | 757 |
774 DisableThreadInterruptsScope::~DisableThreadInterruptsScope() { | 758 DisableThreadInterruptsScope::~DisableThreadInterruptsScope() { |
775 if (thread() != NULL) { | 759 if (thread() != NULL) { |
776 OSThread* os_thread = thread()->os_thread(); | 760 OSThread* os_thread = thread()->os_thread(); |
777 ASSERT(os_thread != NULL); | 761 ASSERT(os_thread != NULL); |
778 os_thread->EnableThreadInterrupts(); | 762 os_thread->EnableThreadInterrupts(); |
779 } | 763 } |
780 } | 764 } |
781 | 765 |
782 } // namespace dart | 766 } // namespace dart |
OLD | NEW |