| 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 #ifndef RUNTIME_VM_ISOLATE_H_ | 5 #ifndef RUNTIME_VM_ISOLATE_H_ |
| 6 #define RUNTIME_VM_ISOLATE_H_ | 6 #define RUNTIME_VM_ISOLATE_H_ |
| 7 | 7 |
| 8 #include "include/dart_api.h" | 8 #include "include/dart_api.h" |
| 9 #include "platform/assert.h" | 9 #include "platform/assert.h" |
| 10 #include "vm/atomic.h" | 10 #include "vm/atomic.h" |
| 11 #include "vm/base_isolate.h" | 11 #include "vm/base_isolate.h" |
| 12 #include "vm/class_table.h" | 12 #include "vm/class_table.h" |
| 13 #include "vm/exceptions.h" |
| 14 #include "vm/fixed_cache.h" |
| 13 #include "vm/handles.h" | 15 #include "vm/handles.h" |
| 14 #include "vm/megamorphic_cache_table.h" | 16 #include "vm/megamorphic_cache_table.h" |
| 15 #include "vm/metrics.h" | 17 #include "vm/metrics.h" |
| 16 #include "vm/random.h" | 18 #include "vm/random.h" |
| 17 #include "vm/tags.h" | 19 #include "vm/tags.h" |
| 18 #include "vm/thread.h" | 20 #include "vm/thread.h" |
| 19 #include "vm/os_thread.h" | 21 #include "vm/os_thread.h" |
| 20 #include "vm/timer.h" | 22 #include "vm/timer.h" |
| 21 #include "vm/token_position.h" | 23 #include "vm/token_position.h" |
| 22 #include "vm/growable_array.h" | 24 #include "vm/growable_array.h" |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 117 public: | 119 public: |
| 118 NoReloadScope(Isolate* isolate, Thread* thread); | 120 NoReloadScope(Isolate* isolate, Thread* thread); |
| 119 ~NoReloadScope(); | 121 ~NoReloadScope(); |
| 120 | 122 |
| 121 private: | 123 private: |
| 122 Isolate* isolate_; | 124 Isolate* isolate_; |
| 123 DISALLOW_COPY_AND_ASSIGN(NoReloadScope); | 125 DISALLOW_COPY_AND_ASSIGN(NoReloadScope); |
| 124 }; | 126 }; |
| 125 | 127 |
| 126 | 128 |
| 129 // Fixed cache for exception handler lookup. |
| 130 typedef FixedCache<intptr_t, HandlerInfo, 16> HandlerInfoCache; |
| 131 |
| 132 |
| 127 class Isolate : public BaseIsolate { | 133 class Isolate : public BaseIsolate { |
| 128 public: | 134 public: |
| 129 // Keep both these enums in sync with isolate_patch.dart. | 135 // Keep both these enums in sync with isolate_patch.dart. |
| 130 // The different Isolate API message types. | 136 // The different Isolate API message types. |
| 131 enum LibMsgId { | 137 enum LibMsgId { |
| 132 kPauseMsg = 1, | 138 kPauseMsg = 1, |
| 133 kResumeMsg = 2, | 139 kResumeMsg = 2, |
| 134 kPingMsg = 3, | 140 kPingMsg = 3, |
| 135 kKillMsg = 4, | 141 kKillMsg = 4, |
| 136 kAddExitMsg = 5, | 142 kAddExitMsg = 5, |
| (...skipping 498 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 635 static void DisableIsolateCreation(); | 641 static void DisableIsolateCreation(); |
| 636 static void EnableIsolateCreation(); | 642 static void EnableIsolateCreation(); |
| 637 static bool IsolateCreationEnabled(); | 643 static bool IsolateCreationEnabled(); |
| 638 | 644 |
| 639 void StopBackgroundCompiler(); | 645 void StopBackgroundCompiler(); |
| 640 | 646 |
| 641 intptr_t reload_every_n_stack_overflow_checks() const { | 647 intptr_t reload_every_n_stack_overflow_checks() const { |
| 642 return reload_every_n_stack_overflow_checks_; | 648 return reload_every_n_stack_overflow_checks_; |
| 643 } | 649 } |
| 644 | 650 |
| 651 HandlerInfoCache* handler_info_cache() { return &handler_info_cache_; } |
| 652 |
| 645 void MaybeIncreaseReloadEveryNStackOverflowChecks(); | 653 void MaybeIncreaseReloadEveryNStackOverflowChecks(); |
| 646 | 654 |
| 647 private: | 655 private: |
| 648 friend class Dart; // Init, InitOnce, Shutdown. | 656 friend class Dart; // Init, InitOnce, Shutdown. |
| 649 friend class IsolateKillerVisitor; // Kill(). | 657 friend class IsolateKillerVisitor; // Kill(). |
| 650 | 658 |
| 651 explicit Isolate(const Dart_IsolateFlags& api_flags); | 659 explicit Isolate(const Dart_IsolateFlags& api_flags); |
| 652 | 660 |
| 653 static void InitOnce(); | 661 static void InitOnce(); |
| 654 static Isolate* Init(const char* name_prefix, | 662 static Isolate* Init(const char* name_prefix, |
| (...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 829 // Has a reload ever been attempted? | 837 // Has a reload ever been attempted? |
| 830 bool has_attempted_reload_; | 838 bool has_attempted_reload_; |
| 831 intptr_t no_reload_scope_depth_; // we can only reload when this is 0. | 839 intptr_t no_reload_scope_depth_; // we can only reload when this is 0. |
| 832 // Per-isolate copy of FLAG_reload_every. | 840 // Per-isolate copy of FLAG_reload_every. |
| 833 intptr_t reload_every_n_stack_overflow_checks_; | 841 intptr_t reload_every_n_stack_overflow_checks_; |
| 834 IsolateReloadContext* reload_context_; | 842 IsolateReloadContext* reload_context_; |
| 835 int64_t last_reload_timestamp_; | 843 int64_t last_reload_timestamp_; |
| 836 // Should we pause in the debug message loop after this request? | 844 // Should we pause in the debug message loop after this request? |
| 837 bool should_pause_post_service_request_; | 845 bool should_pause_post_service_request_; |
| 838 | 846 |
| 847 HandlerInfoCache handler_info_cache_; |
| 848 |
| 839 static Dart_IsolateCreateCallback create_callback_; | 849 static Dart_IsolateCreateCallback create_callback_; |
| 840 static Dart_IsolateShutdownCallback shutdown_callback_; | 850 static Dart_IsolateShutdownCallback shutdown_callback_; |
| 841 | 851 |
| 842 static void WakePauseEventHandler(Dart_Isolate isolate); | 852 static void WakePauseEventHandler(Dart_Isolate isolate); |
| 843 | 853 |
| 844 // Manage list of existing isolates. | 854 // Manage list of existing isolates. |
| 845 static bool AddIsolateToList(Isolate* isolate); | 855 static bool AddIsolateToList(Isolate* isolate); |
| 846 static void RemoveIsolateFromList(Isolate* isolate); | 856 static void RemoveIsolateFromList(Isolate* isolate); |
| 847 | 857 |
| 848 // This monitor protects isolates_list_head_, and creation_enabled_. | 858 // This monitor protects isolates_list_head_, and creation_enabled_. |
| (...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 992 intptr_t* spawn_count_; | 1002 intptr_t* spawn_count_; |
| 993 | 1003 |
| 994 Dart_IsolateFlags isolate_flags_; | 1004 Dart_IsolateFlags isolate_flags_; |
| 995 bool paused_; | 1005 bool paused_; |
| 996 bool errors_are_fatal_; | 1006 bool errors_are_fatal_; |
| 997 }; | 1007 }; |
| 998 | 1008 |
| 999 } // namespace dart | 1009 } // namespace dart |
| 1000 | 1010 |
| 1001 #endif // RUNTIME_VM_ISOLATE_H_ | 1011 #endif // RUNTIME_VM_ISOLATE_H_ |
| OLD | NEW |