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 2073 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2084 if (!handlers.IsNull()) { | 2084 if (!handlers.IsNull()) { |
2085 JSONArray extensions(&jsobj, "extensionRPCs"); | 2085 JSONArray extensions(&jsobj, "extensionRPCs"); |
2086 String& handler_name = String::Handle(); | 2086 String& handler_name = String::Handle(); |
2087 for (intptr_t i = 0; i < handlers.Length(); i += kRegisteredEntrySize) { | 2087 for (intptr_t i = 0; i < handlers.Length(); i += kRegisteredEntrySize) { |
2088 handler_name ^= handlers.At(i + kRegisteredNameIndex); | 2088 handler_name ^= handlers.At(i + kRegisteredNameIndex); |
2089 extensions.AddValue(handler_name.ToCString()); | 2089 extensions.AddValue(handler_name.ToCString()); |
2090 } | 2090 } |
2091 } | 2091 } |
2092 } | 2092 } |
2093 } | 2093 } |
2094 | |
2095 | |
2096 void Isolate::PrintThreadsInfoToJSONObject(JSONObject* obj) { | |
2097 obj->AddPropertyF("isolate_address", "0x%" Px "", | |
2098 reinterpret_cast<uword>(this)); | |
siva
2016/12/07 22:12:52
Can we use isolate id instead of isolate address h
bkonyi
2016/12/08 18:04:14
Yes, I've gone ahead and switched from addresses t
| |
2099 ASSERT(thread_registry_ != NULL); | |
2100 thread_registry_->PrintToJSONObjectLocked(obj); | |
2101 } | |
2094 #endif | 2102 #endif |
2095 | 2103 |
2096 | 2104 |
2097 void Isolate::set_tag_table(const GrowableObjectArray& value) { | 2105 void Isolate::set_tag_table(const GrowableObjectArray& value) { |
2098 tag_table_ = value.raw(); | 2106 tag_table_ = value.raw(); |
2099 } | 2107 } |
2100 | 2108 |
2101 | 2109 |
2102 void Isolate::set_current_tag(const UserTag& tag) { | 2110 void Isolate::set_current_tag(const UserTag& tag) { |
2103 uword user_tag = tag.tag(); | 2111 uword user_tag = tag.tag(); |
(...skipping 377 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2481 return; | 2489 return; |
2482 } | 2490 } |
2483 previous = current; | 2491 previous = current; |
2484 current = current->next_; | 2492 current = current->next_; |
2485 } | 2493 } |
2486 // If we are shutting down the VM, the isolate may not be in the list. | 2494 // If we are shutting down the VM, the isolate may not be in the list. |
2487 ASSERT(!creation_enabled_); | 2495 ASSERT(!creation_enabled_); |
2488 } | 2496 } |
2489 | 2497 |
2490 | 2498 |
2499 #ifndef RELEASE | |
2500 void Isolate::PrintAllIsolatesMemoryInfoToJSONLocked(JSONStream* stream) { | |
Cutch
2016/12/06 19:11:14
The suffix of 'Locked' is usually applied to funct
bkonyi
2016/12/08 18:04:13
Done.
| |
2501 MonitorLocker ml(isolates_list_monitor_); | |
2502 JSONArray arr(stream); | |
2503 Isolate* current = isolates_list_head_; | |
2504 while (current != NULL) { | |
Cutch
2016/12/06 19:11:14
Please use Isolates::VisitIsolates instead of walk
bkonyi
2016/12/08 18:04:14
Done.
| |
2505 JSONObject isolate_obj(&arr); | |
2506 current->PrintThreadsInfoToJSONObject(&isolate_obj); | |
2507 current = current->next_; | |
2508 } | |
2509 } | |
2510 #endif | |
2511 | |
2512 | |
2491 void Isolate::DisableIsolateCreation() { | 2513 void Isolate::DisableIsolateCreation() { |
2492 MonitorLocker ml(isolates_list_monitor_); | 2514 MonitorLocker ml(isolates_list_monitor_); |
2493 creation_enabled_ = false; | 2515 creation_enabled_ = false; |
2494 } | 2516 } |
2495 | 2517 |
2496 | 2518 |
2497 void Isolate::EnableIsolateCreation() { | 2519 void Isolate::EnableIsolateCreation() { |
2498 MonitorLocker ml(isolates_list_monitor_); | 2520 MonitorLocker ml(isolates_list_monitor_); |
2499 creation_enabled_ = true; | 2521 creation_enabled_ = true; |
2500 } | 2522 } |
(...skipping 435 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2936 void IsolateSpawnState::DecrementSpawnCount() { | 2958 void IsolateSpawnState::DecrementSpawnCount() { |
2937 ASSERT(spawn_count_monitor_ != NULL); | 2959 ASSERT(spawn_count_monitor_ != NULL); |
2938 ASSERT(spawn_count_ != NULL); | 2960 ASSERT(spawn_count_ != NULL); |
2939 MonitorLocker ml(spawn_count_monitor_); | 2961 MonitorLocker ml(spawn_count_monitor_); |
2940 ASSERT(*spawn_count_ > 0); | 2962 ASSERT(*spawn_count_ > 0); |
2941 *spawn_count_ = *spawn_count_ - 1; | 2963 *spawn_count_ = *spawn_count_ - 1; |
2942 ml.Notify(); | 2964 ml.Notify(); |
2943 } | 2965 } |
2944 | 2966 |
2945 } // namespace dart | 2967 } // namespace dart |
OLD | NEW |