diff options
author | Joyee Cheung <joyeec9h3@gmail.com> | 2019-04-25 03:03:48 +0800 |
---|---|---|
committer | Joyee Cheung <joyeec9h3@gmail.com> | 2019-04-28 15:36:28 +0800 |
commit | 757f3f8b2cf9854292caaa143a1b0a7fbac5e0ea (patch) | |
tree | 09c9a3a888fc9477d91e75cd9972cd9e6d0cdfd3 /src/node.cc | |
parent | c5817abff5033da7c09302256a331e64473422a8 (diff) | |
download | android-node-v8-757f3f8b2cf9854292caaa143a1b0a7fbac5e0ea.tar.gz android-node-v8-757f3f8b2cf9854292caaa143a1b0a7fbac5e0ea.tar.bz2 android-node-v8-757f3f8b2cf9854292caaa143a1b0a7fbac5e0ea.zip |
process: reduce the number of internal frames in async stack trace
Previously, we call the JS land `runNextTicks` implementation
immediately from JS land after evaluating the main module or the
input, so these synchronous JS call frames would show up in the stack
trace of the async errors, which can be confusing. This patch moves
those calls into C++ so that more of these internal scheduler
implementation details can be hidden and the users can see a cleaner
a cleaner async JS stack trace.
PR-URL: https://github.com/nodejs/node/pull/27392
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Gus Caplan <me@gus.host>
Reviewed-By: Minwoo Jung <minwoo@nodesource.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Diffstat (limited to 'src/node.cc')
-rw-r--r-- | src/node.cc | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/node.cc b/src/node.cc index 10ef0d5bc7..636a92eab3 100644 --- a/src/node.cc +++ b/src/node.cc @@ -379,9 +379,13 @@ MaybeLocal<Value> StartExecution(Environment* env, const char* main_script_id) { ->GetFunction(env->context()) .ToLocalChecked()}; - MaybeLocal<Value> result = - ExecuteBootstrapper(env, main_script_id, ¶meters, &arguments); - return scope.EscapeMaybe(result); + Local<Value> result; + if (!ExecuteBootstrapper(env, main_script_id, ¶meters, &arguments) + .ToLocal(&result) || + !task_queue::RunNextTicksNative(env)) { + return MaybeLocal<Value>(); + } + return scope.Escape(result); } MaybeLocal<Value> StartMainThreadExecution(Environment* env) { |