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 "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 1650 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1661 // Not tracking deoptimized code. | 1661 // Not tracking deoptimized code. |
1662 return; | 1662 return; |
1663 } | 1663 } |
1664 // TODO(johnmccutchan): Scan this array and the isolate's profile before | 1664 // TODO(johnmccutchan): Scan this array and the isolate's profile before |
1665 // old space GC and remove the keep_code flag. | 1665 // old space GC and remove the keep_code flag. |
1666 deoptimized_code.Add(code); | 1666 deoptimized_code.Add(code); |
1667 } | 1667 } |
1668 | 1668 |
1669 | 1669 |
1670 void Isolate::WakePauseEventHandler(Dart_Isolate isolate) { | 1670 void Isolate::WakePauseEventHandler(Dart_Isolate isolate) { |
1671 Isolate* iso = FindIsolateInList(isolate); | 1671 Isolate* iso = reinterpret_cast<Isolate*>(isolate); |
1672 ASSERT(iso != NULL); | |
1673 MonitorLocker ml(iso->pause_loop_monitor_); | 1672 MonitorLocker ml(iso->pause_loop_monitor_); |
1674 ml.Notify(); | 1673 ml.Notify(); |
1675 } | 1674 } |
1676 | 1675 |
1677 | 1676 |
1678 void Isolate::PauseEventHandler() { | 1677 void Isolate::PauseEventHandler() { |
1679 // We are stealing a pause event (like a breakpoint) from the | 1678 // We are stealing a pause event (like a breakpoint) from the |
1680 // embedder. We don't know what kind of thread we are on -- it | 1679 // embedder. We don't know what kind of thread we are on -- it |
1681 // could be from our thread pool or it could be a thread from the | 1680 // could be from our thread pool or it could be a thread from the |
1682 // embedder. Sit on the current thread handling service events | 1681 // embedder. Sit on the current thread handling service events |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1731 intptr_t count = 0; | 1730 intptr_t count = 0; |
1732 Isolate* current = isolates_list_head_; | 1731 Isolate* current = isolates_list_head_; |
1733 while (current != NULL) { | 1732 while (current != NULL) { |
1734 count++; | 1733 count++; |
1735 current = current->next_; | 1734 current = current->next_; |
1736 } | 1735 } |
1737 return count; | 1736 return count; |
1738 } | 1737 } |
1739 | 1738 |
1740 | 1739 |
1741 Isolate* Isolate::FindIsolateInList(Dart_Isolate isolate) { | |
1742 MonitorLocker ml(isolates_list_monitor_); | |
1743 Isolate* current = isolates_list_head_; | |
1744 while (current != NULL) { | |
1745 if (Api::CastIsolate(current) == isolate) { | |
1746 // We've found the isolate. | |
1747 return current; | |
1748 } | |
1749 current = current->next_; | |
1750 } | |
1751 return NULL; | |
1752 } | |
1753 | |
1754 | |
1755 void Isolate::AddIsolateTolist(Isolate* isolate) { | 1740 void Isolate::AddIsolateTolist(Isolate* isolate) { |
1756 MonitorLocker ml(isolates_list_monitor_); | 1741 MonitorLocker ml(isolates_list_monitor_); |
1757 ASSERT(isolate != NULL); | 1742 ASSERT(isolate != NULL); |
1758 ASSERT(isolate->next_ == NULL); | 1743 ASSERT(isolate->next_ == NULL); |
1759 isolate->next_ = isolates_list_head_; | 1744 isolate->next_ = isolates_list_head_; |
1760 isolates_list_head_ = isolate; | 1745 isolates_list_head_ = isolate; |
1761 } | 1746 } |
1762 | 1747 |
1763 | 1748 |
1764 void Isolate::RemoveIsolateFromList(Isolate* isolate) { | 1749 void Isolate::RemoveIsolateFromList(Isolate* isolate) { |
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1984 serialized_message_, serialized_message_len_); | 1969 serialized_message_, serialized_message_len_); |
1985 } | 1970 } |
1986 | 1971 |
1987 | 1972 |
1988 void IsolateSpawnState::Cleanup() { | 1973 void IsolateSpawnState::Cleanup() { |
1989 SwitchIsolateScope switch_scope(I); | 1974 SwitchIsolateScope switch_scope(I); |
1990 Dart::ShutdownIsolate(); | 1975 Dart::ShutdownIsolate(); |
1991 } | 1976 } |
1992 | 1977 |
1993 } // namespace dart | 1978 } // namespace dart |
OLD | NEW |