Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(68)

Side by Side Diff: runtime/vm/isolate.cc

Issue 1293253005: Completely remove InterruptableThreadState and Fix ThreadRegistry leak (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 "platform/assert.h" 8 #include "platform/assert.h"
9 #include "platform/json.h" 9 #include "platform/json.h"
10 #include "vm/code_observers.h" 10 #include "vm/code_observers.h"
(...skipping 1748 matching lines...) Expand 10 before | Expand all | Expand 10 after
1759 // Paused at breakpoint. Don't tick. 1759 // Paused at breakpoint. Don't tick.
1760 return 0; 1760 return 0;
1761 } 1761 }
1762 MessageHandler* msg_handler = message_handler(); 1762 MessageHandler* msg_handler = message_handler();
1763 if ((msg_handler != NULL) && 1763 if ((msg_handler != NULL) &&
1764 (msg_handler->paused_on_start() || 1764 (msg_handler->paused_on_start() ||
1765 msg_handler->paused_on_exit())) { 1765 msg_handler->paused_on_exit())) {
1766 // Paused at start / exit . Don't tick. 1766 // Paused at start / exit . Don't tick.
1767 return 0; 1767 return 0;
1768 } 1768 }
1769 InterruptableThreadState* state = thread_state(); 1769 if (mutator_thread_ == NULL) {
1770 if (state == NULL) { 1770 // No active mutator.
1771 // Isolate is not scheduled on a thread.
1772 ProfileIdle(); 1771 ProfileIdle();
1773 return 1; 1772 return 1;
1774 } 1773 }
1775 ASSERT(state->id != OSThread::kInvalidThreadId); 1774
1776 ThreadInterrupter::InterruptThread(state); 1775 // TODO(johnmccutchan): Sample all threads, not just the mutator thread.
Ivan Posva 2015/08/20 18:00:10 Please make a note that sampling should be happeni
Cutch 2015/08/20 20:40:18 Done.
1776 ThreadRegistry::EntryIterator it(thread_registry());
1777 while (it.HasNext()) {
1778 const ThreadRegistry::Entry& entry = it.Next();
1779 if (entry.thread == mutator_thread_) {
1780 ThreadInterrupter::InterruptThread(mutator_thread_);
1781 break;
1782 }
1783 }
1777 return 1; 1784 return 1;
1778 } 1785 }
1779 1786
1780 1787
1781 void Isolate::ProfileIdle() { 1788 void Isolate::ProfileIdle() {
1782 vm_tag_counters_.Increment(vm_tag()); 1789 vm_tag_counters_.Increment(vm_tag());
1783 } 1790 }
1784 1791
1785 1792
1786 void Isolate::set_tag_table(const GrowableObjectArray& value) { 1793 void Isolate::set_tag_table(const GrowableObjectArray& value) {
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
1919 previous->next_ = current->next_; 1926 previous->next_ = current->next_;
1920 return; 1927 return;
1921 } 1928 }
1922 previous = current; 1929 previous = current;
1923 current = current->next_; 1930 current = current->next_;
1924 } 1931 }
1925 UNREACHABLE(); 1932 UNREACHABLE();
1926 } 1933 }
1927 1934
1928 1935
1929 #if defined(DEBUG)
1930 void Isolate::CheckForDuplicateThreadState(InterruptableThreadState* state) {
1931 MonitorLocker ml(isolates_list_monitor_);
1932 ASSERT(state != NULL);
1933 Isolate* current = isolates_list_head_;
1934 while (current) {
1935 ASSERT(current->thread_state() != state);
1936 current = current->next_;
1937 }
1938 }
1939 #endif
1940
1941
1942 template<class T> 1936 template<class T>
1943 T* Isolate::AllocateReusableHandle() { 1937 T* Isolate::AllocateReusableHandle() {
1944 T* handle = reinterpret_cast<T*>(reusable_handles_.AllocateScopedHandle()); 1938 T* handle = reinterpret_cast<T*>(reusable_handles_.AllocateScopedHandle());
1945 T::initializeHandle(handle, T::null()); 1939 T::initializeHandle(handle, T::null());
1946 return handle; 1940 return handle;
1947 } 1941 }
1948 1942
1949 1943
1950 static RawInstance* DeserializeObject(Isolate* isolate, 1944 static RawInstance* DeserializeObject(Isolate* isolate,
1951 Zone* zone, 1945 Zone* zone,
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after
2146 serialized_message_, serialized_message_len_); 2140 serialized_message_, serialized_message_len_);
2147 } 2141 }
2148 2142
2149 2143
2150 void IsolateSpawnState::Cleanup() { 2144 void IsolateSpawnState::Cleanup() {
2151 SwitchIsolateScope switch_scope(I); 2145 SwitchIsolateScope switch_scope(I);
2152 Dart::ShutdownIsolate(); 2146 Dart::ShutdownIsolate();
2153 } 2147 }
2154 2148
2155 } // namespace dart 2149 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/isolate.h ('k') | runtime/vm/profiler.cc » ('j') | runtime/vm/profiler.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698