From b86579fb41bb4e5982cc295df1b7d0410fc74ca8 Mon Sep 17 00:00:00 2001 From: Daniel Bevenius Date: Thu, 6 Sep 2018 10:39:38 +0200 Subject: [PATCH 1/2] src: remove abort_on_uncaught_exception node.cc This commit removes the static variable abort_on_uncaught_exception and adds it to the environment options. --- src/env-inl.h | 4 ++-- src/node.cc | 7 +------ src/node_options.h | 1 + 3 files changed, 4 insertions(+), 8 deletions(-) diff --git a/src/env-inl.h b/src/env-inl.h index 28c30e035438c5..2e0c4c5d1c6840 100644 --- a/src/env-inl.h +++ b/src/env-inl.h @@ -420,11 +420,11 @@ inline void Environment::set_trace_sync_io(bool value) { } inline bool Environment::abort_on_uncaught_exception() const { - return abort_on_uncaught_exception_; + return options_->abort_on_uncaught_exception; } inline void Environment::set_abort_on_uncaught_exception(bool value) { - abort_on_uncaught_exception_ = value; + options_->abort_on_uncaught_exception = value; } inline AliasedBuffer& diff --git a/src/node.cc b/src/node.cc index d1ce0ce1af3870..45e7eff06b81bf 100644 --- a/src/node.cc +++ b/src/node.cc @@ -183,9 +183,6 @@ static node_module* modlist_internal; static node_module* modlist_linked; static node_module* modlist_addon; -// TODO(addaleax): This should not be global. -static bool abort_on_uncaught_exception = false; - // Bit flag used to track security reverts (see node_revert.h) unsigned int reverted = 0; @@ -2670,7 +2667,7 @@ void ProcessArgv(std::vector* args, "--abort-on-uncaught-exception") != v8_args.end() || std::find(v8_args.begin(), v8_args.end(), "--abort_on_uncaught_exception") != v8_args.end()) { - abort_on_uncaught_exception = true; + per_process_opts->per_isolate->per_env->abort_on_uncaught_exception = true; } // TODO(bnoordhuis) Intercept --prof arguments and start the CPU profiler @@ -3036,8 +3033,6 @@ inline int Start(Isolate* isolate, IsolateData* isolate_data, return 12; // Signal internal error. } - env.set_abort_on_uncaught_exception(abort_on_uncaught_exception); - // TODO(addaleax): Maybe access this option directly instead of setting // a boolean member of Environment. Ditto below for trace_sync_io. if (env.options()->no_force_async_hooks_checks) { diff --git a/src/node_options.h b/src/node_options.h index 7891d550ae3dad..71615cf0839aa4 100644 --- a/src/node_options.h +++ b/src/node_options.h @@ -60,6 +60,7 @@ class DebugOptions { class EnvironmentOptions { public: std::shared_ptr debug_options { new DebugOptions() }; + bool abort_on_uncaught_exception = false; bool experimental_modules = false; bool experimental_repl_await = false; bool experimental_vm_modules = false; From f4445d22ccebdb77436aa5791c2798fed5c86a20 Mon Sep 17 00:00:00 2001 From: Daniel Bevenius Date: Thu, 6 Sep 2018 11:07:41 +0200 Subject: [PATCH 2/2] squash: use env_opts --- src/node.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/node.cc b/src/node.cc index 45e7eff06b81bf..d6593b2b8ee503 100644 --- a/src/node.cc +++ b/src/node.cc @@ -2667,7 +2667,7 @@ void ProcessArgv(std::vector* args, "--abort-on-uncaught-exception") != v8_args.end() || std::find(v8_args.begin(), v8_args.end(), "--abort_on_uncaught_exception") != v8_args.end()) { - per_process_opts->per_isolate->per_env->abort_on_uncaught_exception = true; + env_opts->abort_on_uncaught_exception = true; } // TODO(bnoordhuis) Intercept --prof arguments and start the CPU profiler