| 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 2085 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2096 if (!handlers.IsNull()) { | 2096 if (!handlers.IsNull()) { |
| 2097 JSONArray extensions(&jsobj, "extensionRPCs"); | 2097 JSONArray extensions(&jsobj, "extensionRPCs"); |
| 2098 String& handler_name = String::Handle(); | 2098 String& handler_name = String::Handle(); |
| 2099 for (intptr_t i = 0; i < handlers.Length(); i += kRegisteredEntrySize) { | 2099 for (intptr_t i = 0; i < handlers.Length(); i += kRegisteredEntrySize) { |
| 2100 handler_name ^= handlers.At(i + kRegisteredNameIndex); | 2100 handler_name ^= handlers.At(i + kRegisteredNameIndex); |
| 2101 extensions.AddValue(handler_name.ToCString()); | 2101 extensions.AddValue(handler_name.ToCString()); |
| 2102 } | 2102 } |
| 2103 } | 2103 } |
| 2104 } | 2104 } |
| 2105 | 2105 |
| 2106 jsobj.AddProperty("isolateMemoryHighWatermark", | |
| 2107 isolate_memory_high_watermark_); | |
| 2108 jsobj.AddProperty("threads", thread_registry_); | 2106 jsobj.AddProperty("threads", thread_registry_); |
| 2109 } | 2107 } |
| 2110 #endif | 2108 #endif |
| 2111 | 2109 |
| 2112 | 2110 |
| 2113 void Isolate::set_tag_table(const GrowableObjectArray& value) { | 2111 void Isolate::set_tag_table(const GrowableObjectArray& value) { |
| 2114 tag_table_ = value.raw(); | 2112 tag_table_ = value.raw(); |
| 2115 } | 2113 } |
| 2116 | 2114 |
| 2117 | 2115 |
| (...skipping 576 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2694 thread->clear_sticky_error(); | 2692 thread->clear_sticky_error(); |
| 2695 } | 2693 } |
| 2696 } else { | 2694 } else { |
| 2697 ASSERT(thread->api_top_scope_ == NULL); | 2695 ASSERT(thread->api_top_scope_ == NULL); |
| 2698 ASSERT(thread->zone_ == NULL); | 2696 ASSERT(thread->zone_ == NULL); |
| 2699 } | 2697 } |
| 2700 if (!bypass_safepoint) { | 2698 if (!bypass_safepoint) { |
| 2701 // Ensure that the thread reports itself as being at a safepoint. | 2699 // Ensure that the thread reports itself as being at a safepoint. |
| 2702 thread->EnterSafepoint(); | 2700 thread->EnterSafepoint(); |
| 2703 } | 2701 } |
| 2704 UpdateIsolateHighWatermark(); | |
| 2705 OSThread* os_thread = thread->os_thread(); | 2702 OSThread* os_thread = thread->os_thread(); |
| 2706 ASSERT(os_thread != NULL); | 2703 ASSERT(os_thread != NULL); |
| 2707 os_thread->DisableThreadInterrupts(); | 2704 os_thread->DisableThreadInterrupts(); |
| 2708 os_thread->set_thread(NULL); | 2705 os_thread->set_thread(NULL); |
| 2709 OSThread::SetCurrent(os_thread); | 2706 OSThread::SetCurrent(os_thread); |
| 2710 if (is_mutator) { | 2707 if (is_mutator) { |
| 2711 mutator_thread_ = NULL; | 2708 mutator_thread_ = NULL; |
| 2712 } | 2709 } |
| 2713 thread->isolate_ = NULL; | 2710 thread->isolate_ = NULL; |
| 2714 thread->heap_ = NULL; | 2711 thread->heap_ = NULL; |
| 2715 thread->set_os_thread(NULL); | 2712 thread->set_os_thread(NULL); |
| 2716 thread->set_execution_state(Thread::kThreadInNative); | 2713 thread->set_execution_state(Thread::kThreadInNative); |
| 2717 thread->set_safepoint_state(Thread::SetAtSafepoint(true, 0)); | 2714 thread->set_safepoint_state(Thread::SetAtSafepoint(true, 0)); |
| 2718 thread->clear_pending_functions(); | 2715 thread->clear_pending_functions(); |
| 2719 thread->ClearThreadMemoryUsageStats(); | |
| 2720 ASSERT(thread->no_safepoint_scope_depth() == 0); | 2716 ASSERT(thread->no_safepoint_scope_depth() == 0); |
| 2721 // Return thread structure. | 2717 // Return thread structure. |
| 2722 thread_registry()->ReturnThreadLocked(is_mutator, thread); | 2718 thread_registry()->ReturnThreadLocked(is_mutator, thread); |
| 2723 } | 2719 } |
| 2724 | 2720 |
| 2725 | 2721 |
| 2726 void Isolate::UpdateIsolateHighWatermark() { | |
| 2727 intptr_t thread_watermarks_total = | |
| 2728 thread_registry()->ThreadHighWatermarksTotalLocked(); | |
| 2729 if (thread_watermarks_total > isolate_memory_high_watermark_) { | |
| 2730 isolate_memory_high_watermark_ = thread_watermarks_total; | |
| 2731 } | |
| 2732 } | |
| 2733 | |
| 2734 | |
| 2735 static RawInstance* DeserializeObject(Thread* thread, | 2722 static RawInstance* DeserializeObject(Thread* thread, |
| 2736 uint8_t* obj_data, | 2723 uint8_t* obj_data, |
| 2737 intptr_t obj_len) { | 2724 intptr_t obj_len) { |
| 2738 if (obj_data == NULL) { | 2725 if (obj_data == NULL) { |
| 2739 return Instance::null(); | 2726 return Instance::null(); |
| 2740 } | 2727 } |
| 2741 MessageSnapshotReader reader(obj_data, obj_len, thread); | 2728 MessageSnapshotReader reader(obj_data, obj_len, thread); |
| 2742 Zone* zone = thread->zone(); | 2729 Zone* zone = thread->zone(); |
| 2743 const Object& obj = Object::Handle(zone, reader.ReadObject()); | 2730 const Object& obj = Object::Handle(zone, reader.ReadObject()); |
| 2744 ASSERT(!obj.IsError()); | 2731 ASSERT(!obj.IsError()); |
| (...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2961 void IsolateSpawnState::DecrementSpawnCount() { | 2948 void IsolateSpawnState::DecrementSpawnCount() { |
| 2962 ASSERT(spawn_count_monitor_ != NULL); | 2949 ASSERT(spawn_count_monitor_ != NULL); |
| 2963 ASSERT(spawn_count_ != NULL); | 2950 ASSERT(spawn_count_ != NULL); |
| 2964 MonitorLocker ml(spawn_count_monitor_); | 2951 MonitorLocker ml(spawn_count_monitor_); |
| 2965 ASSERT(*spawn_count_ > 0); | 2952 ASSERT(*spawn_count_ > 0); |
| 2966 *spawn_count_ = *spawn_count_ - 1; | 2953 *spawn_count_ = *spawn_count_ - 1; |
| 2967 ml.Notify(); | 2954 ml.Notify(); |
| 2968 } | 2955 } |
| 2969 | 2956 |
| 2970 } // namespace dart | 2957 } // namespace dart |
| OLD | NEW |