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

Unified 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, 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « runtime/vm/intrinsifier_x64.cc ('k') | runtime/vm/isolate.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/isolate.h
diff --git a/runtime/vm/isolate.h b/runtime/vm/isolate.h
index e9c255b0e5ebf84d67bf71c9d4887d5d4568bae4..e1ee975d95bbc8976d7fb0af6cf056d8d5543d0e 100644
--- a/runtime/vm/isolate.h
+++ b/runtime/vm/isolate.h
@@ -337,42 +337,6 @@ class Isolate : public BaseIsolate {
void set_has_compiled_code(bool value) { has_compiled_code_ = value; }
bool has_compiled_code() const { return has_compiled_code_; }
- // TODO(iposva): Evaluate whether two different isolate flag structures are
- // needed. Currently it serves as a separation between publicly visible flags
- // and VM internal flags.
- class Flags : public ValueObject {
- public:
- // Construct default flags as specified by the options.
- Flags();
-
- bool type_checks() const { return type_checks_; }
- bool asserts() const { return asserts_; }
- bool error_on_bad_type() const { return error_on_bad_type_; }
- bool error_on_bad_override() const { return error_on_bad_override_; }
-
- void set_checked(bool val) {
- type_checks_ = val;
- asserts_ = val;
- }
-
- void CopyFrom(const Flags& orig);
- void CopyFrom(const Dart_IsolateFlags& api_flags);
- void CopyTo(Dart_IsolateFlags* api_flags) const;
-
- private:
- bool type_checks_;
- bool asserts_;
- bool error_on_bad_type_;
- bool error_on_bad_override_;
-
- friend class Isolate;
-
- DISALLOW_ALLOCATION();
- DISALLOW_COPY_AND_ASSIGN(Flags);
- };
-
- const Flags& flags() const { return flags_; }
-
// Lets the embedder know that a service message resulted in a resume request.
void SetResumeRequest() {
resume_request_ = true;
@@ -672,6 +636,23 @@ class Isolate : public BaseIsolate {
bool is_service_isolate() const { return is_service_isolate_; }
+ // Isolate-specific flag handling.
+ static void FlagsInitialize(Dart_IsolateFlags* api_flags);
+ void FlagsCopyTo(Dart_IsolateFlags* api_flags) const;
+ void FlagsCopyFrom(const Dart_IsolateFlags& api_flags);
+
+#if defined(PRODUCT)
+ bool type_checks() const { return FLAG_enable_type_checks; }
+ bool asserts() const { return FLAG_enable_asserts; }
+ bool error_on_bad_type() const { return FLAG_error_on_bad_type; }
+ bool error_on_bad_override() const { return FLAG_error_on_bad_override; }
+#else // defined(PRODUCT)
+ bool type_checks() const { return type_checks_; }
+ bool asserts() const { return asserts_; }
+ bool error_on_bad_type() const { return error_on_bad_type_; }
+ bool error_on_bad_override() const { return error_on_bad_override_; }
+#endif // defined(PRODUCT)
+
static void KillAllIsolates(LibMsgId msg_id);
static void KillIfExists(Isolate* isolate, LibMsgId msg_id);
@@ -769,7 +750,6 @@ class Isolate : public BaseIsolate {
bool resume_request_;
int64_t last_resume_timestamp_;
bool has_compiled_code_; // Can check that no compilation occured.
- Flags flags_;
Random random_;
Simulator* simulator_;
Mutex* mutex_; // protects stack_limit_, saved_stack_limit_, compiler stats.
@@ -791,6 +771,14 @@ class Isolate : public BaseIsolate {
bool is_service_isolate_;
+ // Isolate-specific flags.
+ NOT_IN_PRODUCT(
+ bool type_checks_;
+ bool asserts_;
+ bool error_on_bad_type_;
+ bool error_on_bad_override_;
+ )
+
// Status support.
char* stacktrace_;
intptr_t stack_frame_index_;
@@ -997,7 +985,7 @@ class IsolateSpawnState {
bool is_spawn_uri() const { return library_url_ == NULL; }
bool paused() const { return paused_; }
bool errors_are_fatal() const { return errors_are_fatal_; }
- Isolate::Flags* isolate_flags() { return &isolate_flags_; }
+ Dart_IsolateFlags* isolate_flags() { return &isolate_flags_; }
RawObject* ResolveFunction();
RawInstance* BuildArgs(Thread* thread);
@@ -1028,7 +1016,7 @@ class IsolateSpawnState {
Monitor* spawn_count_monitor_;
intptr_t* spawn_count_;
- Isolate::Flags isolate_flags_;
+ Dart_IsolateFlags isolate_flags_;
bool paused_;
bool errors_are_fatal_;
};
« 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