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

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

Issue 1666323002: Don't allow oob message interrupts while executing constant expressions in the parser. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: resolve merge conflicts Created 4 years, 10 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
« no previous file with comments | « runtime/vm/compiler.cc ('k') | runtime/vm/isolate.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 #ifndef VM_ISOLATE_H_ 5 #ifndef VM_ISOLATE_H_
6 #define VM_ISOLATE_H_ 6 #define 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"
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
74 IsolateVisitor() {} 74 IsolateVisitor() {}
75 virtual ~IsolateVisitor() {} 75 virtual ~IsolateVisitor() {}
76 76
77 virtual void VisitIsolate(Isolate* isolate) = 0; 77 virtual void VisitIsolate(Isolate* isolate) = 0;
78 78
79 private: 79 private:
80 DISALLOW_COPY_AND_ASSIGN(IsolateVisitor); 80 DISALLOW_COPY_AND_ASSIGN(IsolateVisitor);
81 }; 81 };
82 82
83 83
84 // Disallow OOB message handling within this scope.
85 class NoOOBMessageScope : public StackResource {
86 public:
87 explicit NoOOBMessageScope(Thread* thread);
88 ~NoOOBMessageScope();
89 private:
90 DISALLOW_COPY_AND_ASSIGN(NoOOBMessageScope);
91 };
92
93
84 class Isolate : public BaseIsolate { 94 class Isolate : public BaseIsolate {
85 public: 95 public:
86 // Keep both these enums in sync with isolate_patch.dart. 96 // Keep both these enums in sync with isolate_patch.dart.
87 // The different Isolate API message types. 97 // The different Isolate API message types.
88 enum LibMsgId { 98 enum LibMsgId {
89 kPauseMsg = 1, 99 kPauseMsg = 1,
90 kResumeMsg = 2, 100 kResumeMsg = 2,
91 kPingMsg = 3, 101 kPingMsg = 3,
92 kKillMsg = 4, 102 kKillMsg = 4,
93 kAddExitMsg = 5, 103 kAddExitMsg = 5,
(...skipping 564 matching lines...) Expand 10 before | Expand all | Expand 10 after
658 668
659 static void KillAllIsolates(LibMsgId msg_id); 669 static void KillAllIsolates(LibMsgId msg_id);
660 static void KillIfExists(Isolate* isolate, LibMsgId msg_id); 670 static void KillIfExists(Isolate* isolate, LibMsgId msg_id);
661 671
662 static void DisableIsolateCreation(); 672 static void DisableIsolateCreation();
663 static void EnableIsolateCreation(); 673 static void EnableIsolateCreation();
664 674
665 private: 675 private:
666 friend class Dart; // Init, InitOnce, Shutdown. 676 friend class Dart; // Init, InitOnce, Shutdown.
667 friend class IsolateKillerVisitor; // Kill(). 677 friend class IsolateKillerVisitor; // Kill().
678 friend class NoOOBMessageScope;
668 679
669 explicit Isolate(const Dart_IsolateFlags& api_flags); 680 explicit Isolate(const Dart_IsolateFlags& api_flags);
670 681
671 static void InitOnce(); 682 static void InitOnce();
672 static Isolate* Init(const char* name_prefix, 683 static Isolate* Init(const char* name_prefix,
673 const Dart_IsolateFlags& api_flags, 684 const Dart_IsolateFlags& api_flags,
674 bool is_vm_isolate = false); 685 bool is_vm_isolate = false);
675 686
676 // The isolates_list_monitor_ should be held when calling Kill(). 687 // The isolates_list_monitor_ should be held when calling Kill().
677 void KillLocked(LibMsgId msg_id); 688 void KillLocked(LibMsgId msg_id);
678 689
679 void LowLevelShutdown(); 690 void LowLevelShutdown();
680 void Shutdown(); 691 void Shutdown();
681 692
682 void BuildName(const char* name_prefix); 693 void BuildName(const char* name_prefix);
683 694
684 void ProfileIdle(); 695 void ProfileIdle();
685 696
686 // Visit all object pointers. Caller must ensure concurrent sweeper is not 697 // Visit all object pointers. Caller must ensure concurrent sweeper is not
687 // running, and the visitor must not allocate. 698 // running, and the visitor must not allocate.
688 void VisitObjectPointers(ObjectPointerVisitor* visitor, bool validate_frames); 699 void VisitObjectPointers(ObjectPointerVisitor* visitor, bool validate_frames);
689 700
690 void set_user_tag(uword tag) { 701 void set_user_tag(uword tag) {
691 user_tag_ = tag; 702 user_tag_ = tag;
692 } 703 }
693 704
705 void DeferOOBMessageInterrupts();
706 void RestoreOOBMessageInterrupts();
707
694 RawGrowableObjectArray* GetAndClearPendingServiceExtensionCalls(); 708 RawGrowableObjectArray* GetAndClearPendingServiceExtensionCalls();
695 RawGrowableObjectArray* pending_service_extension_calls() const { 709 RawGrowableObjectArray* pending_service_extension_calls() const {
696 return pending_service_extension_calls_; 710 return pending_service_extension_calls_;
697 } 711 }
698 void set_pending_service_extension_calls(const GrowableObjectArray& value); 712 void set_pending_service_extension_calls(const GrowableObjectArray& value);
699 RawGrowableObjectArray* registered_service_extension_handlers() const { 713 RawGrowableObjectArray* registered_service_extension_handlers() const {
700 return registered_service_extension_handlers_; 714 return registered_service_extension_handlers_;
701 } 715 }
702 void set_registered_service_extension_handlers( 716 void set_registered_service_extension_handlers(
703 const GrowableObjectArray& value); 717 const GrowableObjectArray& value);
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
747 ApiState* api_state_; 761 ApiState* api_state_;
748 Debugger* debugger_; 762 Debugger* debugger_;
749 bool resume_request_; 763 bool resume_request_;
750 int64_t last_resume_timestamp_; 764 int64_t last_resume_timestamp_;
751 bool has_compiled_code_; // Can check that no compilation occured. 765 bool has_compiled_code_; // Can check that no compilation occured.
752 Flags flags_; 766 Flags flags_;
753 Random random_; 767 Random random_;
754 Simulator* simulator_; 768 Simulator* simulator_;
755 Mutex* mutex_; // protects stack_limit_, saved_stack_limit_, compiler stats. 769 Mutex* mutex_; // protects stack_limit_, saved_stack_limit_, compiler stats.
756 uword saved_stack_limit_; 770 uword saved_stack_limit_;
771 uword deferred_interrupts_mask_;
772 uword deferred_interrupts_;
757 uword stack_overflow_flags_; 773 uword stack_overflow_flags_;
758 int32_t stack_overflow_count_; 774 int32_t stack_overflow_count_;
759 MessageHandler* message_handler_; 775 MessageHandler* message_handler_;
760 IsolateSpawnState* spawn_state_; 776 IsolateSpawnState* spawn_state_;
761 bool is_runnable_; 777 bool is_runnable_;
762 Dart_GcPrologueCallback gc_prologue_callback_; 778 Dart_GcPrologueCallback gc_prologue_callback_;
763 Dart_GcEpilogueCallback gc_epilogue_callback_; 779 Dart_GcEpilogueCallback gc_epilogue_callback_;
764 intptr_t defer_finalization_count_; 780 intptr_t defer_finalization_count_;
765 DeoptContext* deopt_context_; 781 DeoptContext* deopt_context_;
766 782
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
869 friend class Reusable##name##HandleScope; 885 friend class Reusable##name##HandleScope;
870 REUSABLE_HANDLE_LIST(REUSABLE_FRIEND_DECLARATION) 886 REUSABLE_HANDLE_LIST(REUSABLE_FRIEND_DECLARATION)
871 #undef REUSABLE_FRIEND_DECLARATION 887 #undef REUSABLE_FRIEND_DECLARATION
872 888
873 friend class GCMarker; // VisitObjectPointers 889 friend class GCMarker; // VisitObjectPointers
874 friend class SafepointHandler; 890 friend class SafepointHandler;
875 friend class Scavenger; // VisitObjectPointers 891 friend class Scavenger; // VisitObjectPointers
876 friend class ServiceIsolate; 892 friend class ServiceIsolate;
877 friend class Thread; 893 friend class Thread;
878 friend class Timeline; 894 friend class Timeline;
895 friend class IsolateTestHelper;
879 896
880 DISALLOW_COPY_AND_ASSIGN(Isolate); 897 DISALLOW_COPY_AND_ASSIGN(Isolate);
881 }; 898 };
882 899
883 900
884 // When we need to execute code in an isolate, we use the 901 // When we need to execute code in an isolate, we use the
885 // StartIsolateScope. 902 // StartIsolateScope.
886 class StartIsolateScope { 903 class StartIsolateScope {
887 public: 904 public:
888 explicit StartIsolateScope(Isolate* new_isolate) 905 explicit StartIsolateScope(Isolate* new_isolate)
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
1003 intptr_t* spawn_count_; 1020 intptr_t* spawn_count_;
1004 1021
1005 Isolate::Flags isolate_flags_; 1022 Isolate::Flags isolate_flags_;
1006 bool paused_; 1023 bool paused_;
1007 bool errors_are_fatal_; 1024 bool errors_are_fatal_;
1008 }; 1025 };
1009 1026
1010 } // namespace dart 1027 } // namespace dart
1011 1028
1012 #endif // VM_ISOLATE_H_ 1029 #endif // VM_ISOLATE_H_
OLDNEW
« no previous file with comments | « runtime/vm/compiler.cc ('k') | runtime/vm/isolate.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698