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" |
11 #include "vm/lockers.h" | 11 #include "vm/lockers.h" |
12 #include "vm/log.h" | 12 #include "vm/log.h" |
13 #include "vm/message_handler.h" | 13 #include "vm/message_handler.h" |
14 #include "vm/native_entry.h" | 14 #include "vm/native_entry.h" |
15 #include "vm/object.h" | 15 #include "vm/object.h" |
16 #include "vm/os_thread.h" | 16 #include "vm/os_thread.h" |
17 #include "vm/profiler.h" | 17 #include "vm/profiler.h" |
18 #include "vm/runtime_entry.h" | 18 #include "vm/runtime_entry.h" |
19 #include "vm/stub_code.h" | 19 #include "vm/stub_code.h" |
20 #include "vm/symbols.h" | 20 #include "vm/symbols.h" |
21 #include "vm/thread_interrupter.h" | 21 #include "vm/thread_interrupter.h" |
22 #include "vm/thread_registry.h" | 22 #include "vm/thread_registry.h" |
| 23 #include "vm/timeline.h" |
23 | 24 |
24 namespace dart { | 25 namespace dart { |
25 | 26 |
26 | 27 |
27 DECLARE_FLAG(bool, trace_service); | 28 DECLARE_FLAG(bool, trace_service); |
28 DECLARE_FLAG(bool, trace_service_verbose); | 29 DECLARE_FLAG(bool, trace_service_verbose); |
29 | 30 |
30 | 31 |
31 Thread::~Thread() { | 32 Thread::~Thread() { |
32 // We should cleanly exit any isolate before destruction. | 33 // We should cleanly exit any isolate before destruction. |
(...skipping 23 matching lines...) Expand all Loading... |
56 | 57 |
57 #define REUSABLE_HANDLE_INITIALIZERS(object) \ | 58 #define REUSABLE_HANDLE_INITIALIZERS(object) \ |
58 object##_handle_(NULL), | 59 object##_handle_(NULL), |
59 | 60 |
60 | 61 |
61 Thread::Thread(Isolate* isolate) | 62 Thread::Thread(Isolate* isolate) |
62 : BaseThread(false), | 63 : BaseThread(false), |
63 stack_limit_(0), | 64 stack_limit_(0), |
64 stack_overflow_flags_(0), | 65 stack_overflow_flags_(0), |
65 isolate_(NULL), | 66 isolate_(NULL), |
| 67 dart_stream_(NULL), |
66 heap_(NULL), | 68 heap_(NULL), |
67 top_exit_frame_info_(0), | 69 top_exit_frame_info_(0), |
68 store_buffer_block_(NULL), | 70 store_buffer_block_(NULL), |
69 vm_tag_(0), | 71 vm_tag_(0), |
70 task_kind_(kUnknownTask), | 72 task_kind_(kUnknownTask), |
71 os_thread_(NULL), | 73 os_thread_(NULL), |
72 thread_lock_(new Monitor()), | 74 thread_lock_(new Monitor()), |
73 zone_(NULL), | 75 zone_(NULL), |
74 api_reusable_scope_(NULL), | 76 api_reusable_scope_(NULL), |
75 api_top_scope_(NULL), | 77 api_top_scope_(NULL), |
(...skipping 13 matching lines...) Expand all Loading... |
89 cha_(NULL), | 91 cha_(NULL), |
90 deopt_id_(0), | 92 deopt_id_(0), |
91 pending_functions_(GrowableObjectArray::null()), | 93 pending_functions_(GrowableObjectArray::null()), |
92 sticky_error_(Error::null()), | 94 sticky_error_(Error::null()), |
93 compiler_stats_(NULL), | 95 compiler_stats_(NULL), |
94 REUSABLE_HANDLE_LIST(REUSABLE_HANDLE_INITIALIZERS) | 96 REUSABLE_HANDLE_LIST(REUSABLE_HANDLE_INITIALIZERS) |
95 REUSABLE_HANDLE_LIST(REUSABLE_HANDLE_SCOPE_INIT) | 97 REUSABLE_HANDLE_LIST(REUSABLE_HANDLE_SCOPE_INIT) |
96 safepoint_state_(0), | 98 safepoint_state_(0), |
97 execution_state_(kThreadInVM), | 99 execution_state_(kThreadInVM), |
98 next_(NULL) { | 100 next_(NULL) { |
| 101 dart_stream_ = Timeline::GetDartStream(); |
| 102 ASSERT(dart_stream_ != NULL); |
99 #define DEFAULT_INIT(type_name, member_name, init_expr, default_init_value) \ | 103 #define DEFAULT_INIT(type_name, member_name, init_expr, default_init_value) \ |
100 member_name = default_init_value; | 104 member_name = default_init_value; |
101 CACHED_CONSTANTS_LIST(DEFAULT_INIT) | 105 CACHED_CONSTANTS_LIST(DEFAULT_INIT) |
102 #undef DEFAULT_INIT | 106 #undef DEFAULT_INIT |
103 | 107 |
104 #define DEFAULT_INIT(name) \ | 108 #define DEFAULT_INIT(name) \ |
105 name##_entry_point_ = 0; | 109 name##_entry_point_ = 0; |
106 RUNTIME_ENTRY_LIST(DEFAULT_INIT) | 110 RUNTIME_ENTRY_LIST(DEFAULT_INIT) |
107 #undef DEFAULT_INIT | 111 #undef DEFAULT_INIT |
108 | 112 |
(...skipping 622 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
731 | 735 |
732 DisableThreadInterruptsScope::~DisableThreadInterruptsScope() { | 736 DisableThreadInterruptsScope::~DisableThreadInterruptsScope() { |
733 if (thread() != NULL) { | 737 if (thread() != NULL) { |
734 OSThread* os_thread = thread()->os_thread(); | 738 OSThread* os_thread = thread()->os_thread(); |
735 ASSERT(os_thread != NULL); | 739 ASSERT(os_thread != NULL); |
736 os_thread->EnableThreadInterrupts(); | 740 os_thread->EnableThreadInterrupts(); |
737 } | 741 } |
738 } | 742 } |
739 | 743 |
740 } // namespace dart | 744 } // namespace dart |
OLD | NEW |