summaryrefslogtreecommitdiff
path: root/src/node.h
diff options
context:
space:
mode:
authorGus Caplan <me@gus.host>2019-04-15 16:09:51 -0500
committerSam Roberts <vieuxtech@gmail.com>2019-05-16 10:52:53 -0700
commitf2061930c83cb579410a7f26bed726d6568575e3 (patch)
treeddcfcc116344fd03d5d04721df49eacb0059dd13 /src/node.h
parentcca375f4af235ed7e7f763b2e35532ae843a5854 (diff)
downloadandroid-node-v8-f2061930c83cb579410a7f26bed726d6568575e3.tar.gz
android-node-v8-f2061930c83cb579410a7f26bed726d6568575e3.tar.bz2
android-node-v8-f2061930c83cb579410a7f26bed726d6568575e3.zip
src: enable V8's WASM trap handlers
This uses SIGSEGV handlers to catch WASM out of bound (OOB) memory accesses instead of inserting OOB checks inline, resulting in a 25%-30% speed increase. Note that installing a custom SIGSEGV handler will break this, resulting in potentially scary behaviour. Refs: https://github.com/nodejs/node/issues/14927 PR-URL: https://github.com/nodejs/node/pull/27246 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net>
Diffstat (limited to 'src/node.h')
-rw-r--r--src/node.h15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/node.h b/src/node.h
index 5af0655a84..73a3998285 100644
--- a/src/node.h
+++ b/src/node.h
@@ -66,6 +66,10 @@
#include <memory>
+#ifdef __POSIX__
+#include <signal.h>
+#endif // __POSIX__
+
#define NODE_MAKE_VERSION(major, minor, patch) \
((major) * 0x1000 + (minor) * 0x100 + (patch))
@@ -816,6 +820,17 @@ class NODE_EXTERN AsyncResource {
async_context async_context_;
};
+#ifdef __POSIX__
+// Register a signal handler without interrupting
+// any handlers that node itself needs.
+NODE_EXTERN
+void RegisterSignalHandler(int signal,
+ void (*handler)(int signal,
+ siginfo_t* info,
+ void* ucontext),
+ bool reset_handler = false);
+#endif // __POSIX__
+
} // namespace node
#endif // SRC_NODE_H_