summaryrefslogtreecommitdiff
path: root/node.gyp
diff options
context:
space:
mode:
authorJoyee Cheung <joyeec9h3@gmail.com>2018-11-03 14:26:32 +0800
committerJoyee Cheung <joyeec9h3@gmail.com>2018-11-15 02:30:40 +0800
commitbd765d61d7425d82e80bdf2f4f27c0424221837b (patch)
tree869a635d6609a9e5aa806be7b42c3d870c57a384 /node.gyp
parent3856d8a14c0d96eb95303ed391ed719b10ee7bdb (diff)
downloadandroid-node-v8-bd765d61d7425d82e80bdf2f4f27c0424221837b.tar.gz
android-node-v8-bd765d61d7425d82e80bdf2f4f27c0424221837b.tar.bz2
android-node-v8-bd765d61d7425d82e80bdf2f4f27c0424221837b.zip
src: compile native modules and their code cache in C++
This patch refactors out a part of NativeModule.prototype.compile (in JS land) into a C++ NativeModule class, this enables a couple of possibilities: 1. By moving the code to the C++ land, we have more opportunity to specialize the compilation process of the native modules (e.g. compilation options, code cache) that is orthogonal to how user land modules are compiled 2. We can reuse the code to compile bootstrappers and context fixers and enable them to be compiled with the code cache later, since they are not loaded by NativeModule in the JS land their caching must be done in C++. 3. Since there is no need to pass the static data to JS for compilation anymore, this enables us to use (std::map<std::string, const char*>) in the generated node_code_cache.cc and node_javascript.cc later, and scope every actual access to the source of native modules to a std::map lookup instead of a lookup on a v8::Object in dictionary mode. This patch also refactor the code cache generator and tests a bit and trace the `withCodeCache` and `withoutCodeCache` in a Set instead of an Array, and makes sure that all the cachable builtins are tested. PR-URL: https://github.com/nodejs/node/pull/24221 Reviewed-By: Refael Ackermann <refack@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net>
Diffstat (limited to 'node.gyp')
-rw-r--r--node.gyp2
1 files changed, 2 insertions, 0 deletions
diff --git a/node.gyp b/node.gyp
index 83bd412dea..5b68281de4 100644
--- a/node.gyp
+++ b/node.gyp
@@ -416,6 +416,8 @@
'src/node_javascript.h',
'src/node_messaging.h',
'src/node_mutex.h',
+ 'src/node_native_module.h',
+ 'src/node_native_module.cc',
'src/node_options.h',
'src/node_options-inl.h',
'src/node_perf.h',