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/json_stream.h" | |
11 #include "vm/lockers.h" | 12 #include "vm/lockers.h" |
12 #include "vm/log.h" | 13 #include "vm/log.h" |
13 #include "vm/message_handler.h" | 14 #include "vm/message_handler.h" |
14 #include "vm/native_entry.h" | 15 #include "vm/native_entry.h" |
15 #include "vm/object.h" | 16 #include "vm/object.h" |
16 #include "vm/os_thread.h" | 17 #include "vm/os_thread.h" |
17 #include "vm/profiler.h" | 18 #include "vm/profiler.h" |
18 #include "vm/runtime_entry.h" | 19 #include "vm/runtime_entry.h" |
19 #include "vm/stub_code.h" | 20 #include "vm/stub_code.h" |
20 #include "vm/symbols.h" | 21 #include "vm/symbols.h" |
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
198 #undef INIT_VALUE | 199 #undef INIT_VALUE |
199 | 200 |
200 // Setup the thread specific reusable handles. | 201 // Setup the thread specific reusable handles. |
201 #define REUSABLE_HANDLE_ALLOCATION(object) \ | 202 #define REUSABLE_HANDLE_ALLOCATION(object) \ |
202 this->object##_handle_ = this->AllocateReusableHandle<object>(); | 203 this->object##_handle_ = this->AllocateReusableHandle<object>(); |
203 REUSABLE_HANDLE_LIST(REUSABLE_HANDLE_ALLOCATION) | 204 REUSABLE_HANDLE_LIST(REUSABLE_HANDLE_ALLOCATION) |
204 #undef REUSABLE_HANDLE_ALLOCATION | 205 #undef REUSABLE_HANDLE_ALLOCATION |
205 } | 206 } |
206 | 207 |
207 | 208 |
209 #if defined(DEBUG) | |
zra
2016/12/08 18:54:13
#ifndef PRODUCT?
bkonyi
2016/12/08 20:58:32
Done.
| |
210 // Collect information about each individual zone associated with this thread. | |
211 void Thread::PrintJSON(JSONStream* stream, bool ref) const { | |
zra
2016/12/08 18:54:13
ref is unused.
bkonyi
2016/12/08 20:58:32
Removed ref.
| |
212 JSONObject jsobj(stream); | |
213 jsobj.AddProperty("type", "_Thread"); | |
214 jsobj.AddPropertyF("id", "threads/%" Pd64 "", os_thread()->trace_id()); | |
215 Zone* zone = zone_; | |
216 { | |
217 JSONArray zone_info_array(&jsobj, "zones"); | |
218 zone = zone_; | |
219 while (zone != NULL) { | |
220 zone_info_array.AddValue(zone); | |
221 zone = zone->previous(); | |
222 } | |
223 } | |
224 } | |
225 #endif | |
226 | |
227 | |
208 RawGrowableObjectArray* Thread::pending_functions() { | 228 RawGrowableObjectArray* Thread::pending_functions() { |
209 if (pending_functions_ == GrowableObjectArray::null()) { | 229 if (pending_functions_ == GrowableObjectArray::null()) { |
210 pending_functions_ = GrowableObjectArray::New(Heap::kOld); | 230 pending_functions_ = GrowableObjectArray::New(Heap::kOld); |
211 } | 231 } |
212 return pending_functions_; | 232 return pending_functions_; |
213 } | 233 } |
214 | 234 |
215 | 235 |
216 void Thread::clear_pending_functions() { | 236 void Thread::clear_pending_functions() { |
217 pending_functions_ = GrowableObjectArray::null(); | 237 pending_functions_ = GrowableObjectArray::null(); |
(...skipping 555 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
773 | 793 |
774 DisableThreadInterruptsScope::~DisableThreadInterruptsScope() { | 794 DisableThreadInterruptsScope::~DisableThreadInterruptsScope() { |
775 if (thread() != NULL) { | 795 if (thread() != NULL) { |
776 OSThread* os_thread = thread()->os_thread(); | 796 OSThread* os_thread = thread()->os_thread(); |
777 ASSERT(os_thread != NULL); | 797 ASSERT(os_thread != NULL); |
778 os_thread->EnableThreadInterrupts(); | 798 os_thread->EnableThreadInterrupts(); |
779 } | 799 } |
780 } | 800 } |
781 | 801 |
782 } // namespace dart | 802 } // namespace dart |
OLD | NEW |