OLD | NEW |
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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/isolate.h" | 5 #include "vm/isolate.h" |
6 | 6 |
7 #include "include/dart_api.h" | 7 #include "include/dart_api.h" |
8 #include "include/dart_native_api.h" | 8 #include "include/dart_native_api.h" |
9 #include "platform/assert.h" | 9 #include "platform/assert.h" |
10 #include "platform/text_buffer.h" | 10 #include "platform/text_buffer.h" |
(...skipping 795 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
806 deopt_context_(NULL), | 806 deopt_context_(NULL), |
807 compiler_stats_(NULL), | 807 compiler_stats_(NULL), |
808 is_service_isolate_(false), | 808 is_service_isolate_(false), |
809 stacktrace_(NULL), | 809 stacktrace_(NULL), |
810 stack_frame_index_(-1), | 810 stack_frame_index_(-1), |
811 last_allocationprofile_accumulator_reset_timestamp_(0), | 811 last_allocationprofile_accumulator_reset_timestamp_(0), |
812 last_allocationprofile_gc_timestamp_(0), | 812 last_allocationprofile_gc_timestamp_(0), |
813 object_id_ring_(NULL), | 813 object_id_ring_(NULL), |
814 tag_table_(GrowableObjectArray::null()), | 814 tag_table_(GrowableObjectArray::null()), |
815 deoptimized_code_array_(GrowableObjectArray::null()), | 815 deoptimized_code_array_(GrowableObjectArray::null()), |
| 816 sticky_error_(Error::null()), |
816 background_compiler_(NULL), | 817 background_compiler_(NULL), |
817 pending_service_extension_calls_(GrowableObjectArray::null()), | 818 pending_service_extension_calls_(GrowableObjectArray::null()), |
818 registered_service_extension_handlers_(GrowableObjectArray::null()), | 819 registered_service_extension_handlers_(GrowableObjectArray::null()), |
819 metrics_list_head_(NULL), | 820 metrics_list_head_(NULL), |
820 compilation_allowed_(true), | 821 compilation_allowed_(true), |
821 all_classes_finalized_(false), | 822 all_classes_finalized_(false), |
822 next_(NULL), | 823 next_(NULL), |
823 pause_loop_monitor_(NULL), | 824 pause_loop_monitor_(NULL), |
824 cha_invalidation_gen_(kInvalidGen), | 825 cha_invalidation_gen_(kInvalidGen), |
825 field_invalidation_gen_(kInvalidGen), | 826 field_invalidation_gen_(kInvalidGen), |
(...skipping 1031 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1857 visitor->VisitPointer(reinterpret_cast<RawObject**>(&tag_table_)); | 1858 visitor->VisitPointer(reinterpret_cast<RawObject**>(&tag_table_)); |
1858 | 1859 |
1859 if (background_compiler() != NULL) { | 1860 if (background_compiler() != NULL) { |
1860 background_compiler()->VisitPointers(visitor); | 1861 background_compiler()->VisitPointers(visitor); |
1861 } | 1862 } |
1862 | 1863 |
1863 // Visit the deoptimized code array which is stored in the isolate. | 1864 // Visit the deoptimized code array which is stored in the isolate. |
1864 visitor->VisitPointer( | 1865 visitor->VisitPointer( |
1865 reinterpret_cast<RawObject**>(&deoptimized_code_array_)); | 1866 reinterpret_cast<RawObject**>(&deoptimized_code_array_)); |
1866 | 1867 |
| 1868 visitor->VisitPointer( |
| 1869 reinterpret_cast<RawObject**>(&sticky_error_)); |
| 1870 |
1867 // Visit the pending service extension calls. | 1871 // Visit the pending service extension calls. |
1868 visitor->VisitPointer( | 1872 visitor->VisitPointer( |
1869 reinterpret_cast<RawObject**>(&pending_service_extension_calls_)); | 1873 reinterpret_cast<RawObject**>(&pending_service_extension_calls_)); |
1870 | 1874 |
1871 // Visit the registered service extension handlers. | 1875 // Visit the registered service extension handlers. |
1872 visitor->VisitPointer( | 1876 visitor->VisitPointer( |
1873 reinterpret_cast<RawObject**>(®istered_service_extension_handlers_)); | 1877 reinterpret_cast<RawObject**>(®istered_service_extension_handlers_)); |
1874 | 1878 |
1875 // Visit the boxed_field_list. | 1879 // Visit the boxed_field_list. |
1876 // 'boxed_field_list_' access via mutator and background compilation threads | 1880 // 'boxed_field_list_' access via mutator and background compilation threads |
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2074 if (deoptimized_code.IsNull()) { | 2078 if (deoptimized_code.IsNull()) { |
2075 // Not tracking deoptimized code. | 2079 // Not tracking deoptimized code. |
2076 return; | 2080 return; |
2077 } | 2081 } |
2078 // TODO(johnmccutchan): Scan this array and the isolate's profile before | 2082 // TODO(johnmccutchan): Scan this array and the isolate's profile before |
2079 // old space GC and remove the keep_code flag. | 2083 // old space GC and remove the keep_code flag. |
2080 deoptimized_code.Add(code); | 2084 deoptimized_code.Add(code); |
2081 } | 2085 } |
2082 | 2086 |
2083 | 2087 |
| 2088 void Isolate::clear_sticky_error() { |
| 2089 sticky_error_ = Error::null(); |
| 2090 } |
| 2091 |
| 2092 |
2084 void Isolate::set_pending_service_extension_calls( | 2093 void Isolate::set_pending_service_extension_calls( |
2085 const GrowableObjectArray& value) { | 2094 const GrowableObjectArray& value) { |
2086 pending_service_extension_calls_ = value.raw(); | 2095 pending_service_extension_calls_ = value.raw(); |
2087 } | 2096 } |
2088 | 2097 |
2089 | 2098 |
2090 void Isolate::set_registered_service_extension_handlers( | 2099 void Isolate::set_registered_service_extension_handlers( |
2091 const GrowableObjectArray& value) { | 2100 const GrowableObjectArray& value) { |
2092 registered_service_extension_handlers_ = value.raw(); | 2101 registered_service_extension_handlers_ = value.raw(); |
2093 } | 2102 } |
(...skipping 491 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2585 bool is_mutator, | 2594 bool is_mutator, |
2586 bool bypass_safepoint) { | 2595 bool bypass_safepoint) { |
2587 // Disassociate the 'Thread' structure and unschedule the thread | 2596 // Disassociate the 'Thread' structure and unschedule the thread |
2588 // from this isolate. | 2597 // from this isolate. |
2589 // We are disassociating the thread from an isolate and it would | 2598 // We are disassociating the thread from an isolate and it would |
2590 // not be possible to correctly track no_safepoint_scope_depth for the | 2599 // not be possible to correctly track no_safepoint_scope_depth for the |
2591 // thread in the constructor/destructor of MonitorLocker, | 2600 // thread in the constructor/destructor of MonitorLocker, |
2592 // so we create a MonitorLocker object which does not do any | 2601 // so we create a MonitorLocker object which does not do any |
2593 // no_safepoint_scope_depth increments/decrements. | 2602 // no_safepoint_scope_depth increments/decrements. |
2594 MonitorLocker ml(threads_lock(), false); | 2603 MonitorLocker ml(threads_lock(), false); |
| 2604 if (is_mutator) { |
| 2605 if (thread->sticky_error() != Error::null()) { |
| 2606 ASSERT(sticky_error_ == Error::null()); |
| 2607 sticky_error_ = thread->sticky_error(); |
| 2608 thread->clear_sticky_error(); |
| 2609 } |
| 2610 } |
2595 if (!bypass_safepoint) { | 2611 if (!bypass_safepoint) { |
2596 // Ensure that the thread reports itself as being at a safepoint. | 2612 // Ensure that the thread reports itself as being at a safepoint. |
2597 thread->EnterSafepoint(); | 2613 thread->EnterSafepoint(); |
2598 } | 2614 } |
2599 OSThread* os_thread = thread->os_thread(); | 2615 OSThread* os_thread = thread->os_thread(); |
2600 ASSERT(os_thread != NULL); | 2616 ASSERT(os_thread != NULL); |
2601 os_thread->DisableThreadInterrupts(); | 2617 os_thread->DisableThreadInterrupts(); |
2602 os_thread->set_thread(NULL); | 2618 os_thread->set_thread(NULL); |
2603 OSThread::SetCurrent(os_thread); | 2619 OSThread::SetCurrent(os_thread); |
2604 if (is_mutator) { | 2620 if (is_mutator) { |
(...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2839 void IsolateSpawnState::DecrementSpawnCount() { | 2855 void IsolateSpawnState::DecrementSpawnCount() { |
2840 ASSERT(spawn_count_monitor_ != NULL); | 2856 ASSERT(spawn_count_monitor_ != NULL); |
2841 ASSERT(spawn_count_ != NULL); | 2857 ASSERT(spawn_count_ != NULL); |
2842 MonitorLocker ml(spawn_count_monitor_); | 2858 MonitorLocker ml(spawn_count_monitor_); |
2843 ASSERT(*spawn_count_ > 0); | 2859 ASSERT(*spawn_count_ > 0); |
2844 *spawn_count_ = *spawn_count_ - 1; | 2860 *spawn_count_ = *spawn_count_ - 1; |
2845 ml.Notify(); | 2861 ml.Notify(); |
2846 } | 2862 } |
2847 | 2863 |
2848 } // namespace dart | 2864 } // namespace dart |
OLD | NEW |