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