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

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

Issue 1737693003: - Remove Isolate::Flags structure and store flags directly in isolate. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Address review comments. Created 4 years, 9 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/intrinsifier_x64.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 319 matching lines...) Expand 10 before | Expand all | Expand 10 after
330 330
331 void set_single_step(bool value) { single_step_ = value; } 331 void set_single_step(bool value) { single_step_ = value; }
332 bool single_step() const { return single_step_; } 332 bool single_step() const { return single_step_; }
333 static intptr_t single_step_offset() { 333 static intptr_t single_step_offset() {
334 return OFFSET_OF(Isolate, single_step_); 334 return OFFSET_OF(Isolate, single_step_);
335 } 335 }
336 336
337 void set_has_compiled_code(bool value) { has_compiled_code_ = value; } 337 void set_has_compiled_code(bool value) { has_compiled_code_ = value; }
338 bool has_compiled_code() const { return has_compiled_code_; } 338 bool has_compiled_code() const { return has_compiled_code_; }
339 339
340 // TODO(iposva): Evaluate whether two different isolate flag structures are
341 // needed. Currently it serves as a separation between publicly visible flags
342 // and VM internal flags.
343 class Flags : public ValueObject {
344 public:
345 // Construct default flags as specified by the options.
346 Flags();
347
348 bool type_checks() const { return type_checks_; }
349 bool asserts() const { return asserts_; }
350 bool error_on_bad_type() const { return error_on_bad_type_; }
351 bool error_on_bad_override() const { return error_on_bad_override_; }
352
353 void set_checked(bool val) {
354 type_checks_ = val;
355 asserts_ = val;
356 }
357
358 void CopyFrom(const Flags& orig);
359 void CopyFrom(const Dart_IsolateFlags& api_flags);
360 void CopyTo(Dart_IsolateFlags* api_flags) const;
361
362 private:
363 bool type_checks_;
364 bool asserts_;
365 bool error_on_bad_type_;
366 bool error_on_bad_override_;
367
368 friend class Isolate;
369
370 DISALLOW_ALLOCATION();
371 DISALLOW_COPY_AND_ASSIGN(Flags);
372 };
373
374 const Flags& flags() const { return flags_; }
375
376 // Lets the embedder know that a service message resulted in a resume request. 340 // Lets the embedder know that a service message resulted in a resume request.
377 void SetResumeRequest() { 341 void SetResumeRequest() {
378 resume_request_ = true; 342 resume_request_ = true;
379 set_last_resume_timestamp(); 343 set_last_resume_timestamp();
380 } 344 }
381 345
382 void set_last_resume_timestamp() { 346 void set_last_resume_timestamp() {
383 last_resume_timestamp_ = OS::GetCurrentTimeMillis(); 347 last_resume_timestamp_ = OS::GetCurrentTimeMillis();
384 } 348 }
385 349
(...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after
665 void PauseEventHandler(); 629 void PauseEventHandler();
666 630
667 void AddClosureFunction(const Function& function) const; 631 void AddClosureFunction(const Function& function) const;
668 RawFunction* LookupClosureFunction(const Function& parent, 632 RawFunction* LookupClosureFunction(const Function& parent,
669 TokenPosition token_pos) const; 633 TokenPosition token_pos) const;
670 intptr_t FindClosureIndex(const Function& needle) const; 634 intptr_t FindClosureIndex(const Function& needle) const;
671 RawFunction* ClosureFunctionFromIndex(intptr_t idx) const; 635 RawFunction* ClosureFunctionFromIndex(intptr_t idx) const;
672 636
673 bool is_service_isolate() const { return is_service_isolate_; } 637 bool is_service_isolate() const { return is_service_isolate_; }
674 638
639 // Isolate-specific flag handling.
640 static void FlagsInitialize(Dart_IsolateFlags* api_flags);
641 void FlagsCopyTo(Dart_IsolateFlags* api_flags) const;
642 void FlagsCopyFrom(const Dart_IsolateFlags& api_flags);
643
644 #if defined(PRODUCT)
645 bool type_checks() const { return FLAG_enable_type_checks; }
646 bool asserts() const { return FLAG_enable_asserts; }
647 bool error_on_bad_type() const { return FLAG_error_on_bad_type; }
648 bool error_on_bad_override() const { return FLAG_error_on_bad_override; }
649 #else // defined(PRODUCT)
650 bool type_checks() const { return type_checks_; }
651 bool asserts() const { return asserts_; }
652 bool error_on_bad_type() const { return error_on_bad_type_; }
653 bool error_on_bad_override() const { return error_on_bad_override_; }
654 #endif // defined(PRODUCT)
655
675 static void KillAllIsolates(LibMsgId msg_id); 656 static void KillAllIsolates(LibMsgId msg_id);
676 static void KillIfExists(Isolate* isolate, LibMsgId msg_id); 657 static void KillIfExists(Isolate* isolate, LibMsgId msg_id);
677 658
678 static void DisableIsolateCreation(); 659 static void DisableIsolateCreation();
679 static void EnableIsolateCreation(); 660 static void EnableIsolateCreation();
680 661
681 private: 662 private:
682 friend class Dart; // Init, InitOnce, Shutdown. 663 friend class Dart; // Init, InitOnce, Shutdown.
683 friend class IsolateKillerVisitor; // Kill(). 664 friend class IsolateKillerVisitor; // Kill().
684 friend class NoOOBMessageScope; 665 friend class NoOOBMessageScope;
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
762 ObjectStore* object_store_; 743 ObjectStore* object_store_;
763 uword top_exit_frame_info_; 744 uword top_exit_frame_info_;
764 void* init_callback_data_; 745 void* init_callback_data_;
765 Dart_EnvironmentCallback environment_callback_; 746 Dart_EnvironmentCallback environment_callback_;
766 Dart_LibraryTagHandler library_tag_handler_; 747 Dart_LibraryTagHandler library_tag_handler_;
767 ApiState* api_state_; 748 ApiState* api_state_;
768 Debugger* debugger_; 749 Debugger* debugger_;
769 bool resume_request_; 750 bool resume_request_;
770 int64_t last_resume_timestamp_; 751 int64_t last_resume_timestamp_;
771 bool has_compiled_code_; // Can check that no compilation occured. 752 bool has_compiled_code_; // Can check that no compilation occured.
772 Flags flags_;
773 Random random_; 753 Random random_;
774 Simulator* simulator_; 754 Simulator* simulator_;
775 Mutex* mutex_; // protects stack_limit_, saved_stack_limit_, compiler stats. 755 Mutex* mutex_; // protects stack_limit_, saved_stack_limit_, compiler stats.
776 Mutex* symbols_mutex_; // Protects concurrent access to teh symbol table. 756 Mutex* symbols_mutex_; // Protects concurrent access to teh symbol table.
777 uword saved_stack_limit_; 757 uword saved_stack_limit_;
778 uword deferred_interrupts_mask_; 758 uword deferred_interrupts_mask_;
779 uword deferred_interrupts_; 759 uword deferred_interrupts_;
780 uword stack_overflow_flags_; 760 uword stack_overflow_flags_;
781 int32_t stack_overflow_count_; 761 int32_t stack_overflow_count_;
782 MessageHandler* message_handler_; 762 MessageHandler* message_handler_;
783 IsolateSpawnState* spawn_state_; 763 IsolateSpawnState* spawn_state_;
784 bool is_runnable_; 764 bool is_runnable_;
785 Dart_GcPrologueCallback gc_prologue_callback_; 765 Dart_GcPrologueCallback gc_prologue_callback_;
786 Dart_GcEpilogueCallback gc_epilogue_callback_; 766 Dart_GcEpilogueCallback gc_epilogue_callback_;
787 intptr_t defer_finalization_count_; 767 intptr_t defer_finalization_count_;
788 DeoptContext* deopt_context_; 768 DeoptContext* deopt_context_;
789 769
790 CompilerStats* compiler_stats_; 770 CompilerStats* compiler_stats_;
791 771
792 bool is_service_isolate_; 772 bool is_service_isolate_;
793 773
774 // Isolate-specific flags.
775 NOT_IN_PRODUCT(
776 bool type_checks_;
777 bool asserts_;
778 bool error_on_bad_type_;
779 bool error_on_bad_override_;
780 )
781
794 // Status support. 782 // Status support.
795 char* stacktrace_; 783 char* stacktrace_;
796 intptr_t stack_frame_index_; 784 intptr_t stack_frame_index_;
797 785
798 // Timestamps of last operation via service. 786 // Timestamps of last operation via service.
799 int64_t last_allocationprofile_accumulator_reset_timestamp_; 787 int64_t last_allocationprofile_accumulator_reset_timestamp_;
800 int64_t last_allocationprofile_gc_timestamp_; 788 int64_t last_allocationprofile_gc_timestamp_;
801 789
802 // Ring buffer of objects assigned an id. 790 // Ring buffer of objects assigned an id.
803 ObjectIdRing* object_id_ring_; 791 ObjectIdRing* object_id_ring_;
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after
990 Dart_Port on_error_port() const { return on_error_port_; } 978 Dart_Port on_error_port() const { return on_error_port_; }
991 const char* script_url() const { return script_url_; } 979 const char* script_url() const { return script_url_; }
992 const char* package_root() const { return package_root_; } 980 const char* package_root() const { return package_root_; }
993 const char* package_config() const { return package_config_; } 981 const char* package_config() const { return package_config_; }
994 const char* library_url() const { return library_url_; } 982 const char* library_url() const { return library_url_; }
995 const char* class_name() const { return class_name_; } 983 const char* class_name() const { return class_name_; }
996 const char* function_name() const { return function_name_; } 984 const char* function_name() const { return function_name_; }
997 bool is_spawn_uri() const { return library_url_ == NULL; } 985 bool is_spawn_uri() const { return library_url_ == NULL; }
998 bool paused() const { return paused_; } 986 bool paused() const { return paused_; }
999 bool errors_are_fatal() const { return errors_are_fatal_; } 987 bool errors_are_fatal() const { return errors_are_fatal_; }
1000 Isolate::Flags* isolate_flags() { return &isolate_flags_; } 988 Dart_IsolateFlags* isolate_flags() { return &isolate_flags_; }
1001 989
1002 RawObject* ResolveFunction(); 990 RawObject* ResolveFunction();
1003 RawInstance* BuildArgs(Thread* thread); 991 RawInstance* BuildArgs(Thread* thread);
1004 RawInstance* BuildMessage(Thread* thread); 992 RawInstance* BuildMessage(Thread* thread);
1005 993
1006 void DecrementSpawnCount(); 994 void DecrementSpawnCount();
1007 995
1008 private: 996 private:
1009 Isolate* isolate_; 997 Isolate* isolate_;
1010 Dart_Port parent_port_; 998 Dart_Port parent_port_;
(...skipping 10 matching lines...) Expand all
1021 uint8_t* serialized_args_; 1009 uint8_t* serialized_args_;
1022 intptr_t serialized_args_len_; 1010 intptr_t serialized_args_len_;
1023 uint8_t* serialized_message_; 1011 uint8_t* serialized_message_;
1024 intptr_t serialized_message_len_; 1012 intptr_t serialized_message_len_;
1025 1013
1026 // This counter tracks the number of outstanding calls to spawn by the parent 1014 // This counter tracks the number of outstanding calls to spawn by the parent
1027 // isolate. 1015 // isolate.
1028 Monitor* spawn_count_monitor_; 1016 Monitor* spawn_count_monitor_;
1029 intptr_t* spawn_count_; 1017 intptr_t* spawn_count_;
1030 1018
1031 Isolate::Flags isolate_flags_; 1019 Dart_IsolateFlags isolate_flags_;
1032 bool paused_; 1020 bool paused_;
1033 bool errors_are_fatal_; 1021 bool errors_are_fatal_;
1034 }; 1022 };
1035 1023
1036 } // namespace dart 1024 } // namespace dart
1037 1025
1038 #endif // VM_ISOLATE_H_ 1026 #endif // VM_ISOLATE_H_
OLDNEW
« no previous file with comments | « runtime/vm/intrinsifier_x64.cc ('k') | runtime/vm/isolate.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698