0
0
mirror of https://github.com/nodejs/node.git synced 2024-12-01 16:10:02 +01:00
nodejs/lib
Joyee Cheung bd765d61d7
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>
2018-11-15 02:30:40 +08:00
..
internal src: compile native modules and their code cache in C++ 2018-11-15 02:30:40 +08:00
_http_agent.js async_hooks: add missing async_hooks destroys in AsyncReset 2018-10-10 08:45:56 +02:00
_http_client.js async_hooks: add missing async_hooks destroys in AsyncReset 2018-10-10 08:45:56 +02:00
_http_common.js http: reduce duplicated code for cleaning parser 2018-10-12 14:53:36 -07:00
_http_incoming.js
_http_outgoing.js http: remove obsolete function escapeHeaderValue 2018-11-13 09:50:07 +05:30
_http_server.js async_hooks: add missing async_hooks destroys in AsyncReset 2018-10-10 08:45:56 +02:00
_stream_duplex.js
_stream_passthrough.js
_stream_readable.js stream: add auto-destroy mode 2018-10-30 15:17:40 +01:00
_stream_transform.js
_stream_wrap.js
_stream_writable.js stream: make .destroy() interact better with write queue 2018-11-10 21:54:48 +01:00
_tls_common.js tls: get the local certificate after tls handshake 2018-11-13 20:42:57 -08:00
_tls_wrap.js tls: get the local certificate after tls handshake 2018-11-13 20:42:57 -08:00
.eslintrc.yaml bootstrapper: move internalBinding to NativeModule 2018-10-04 11:55:34 +02:00
assert.js assert: remove unused catch bindings 2018-11-06 10:58:42 -05:00
async_hooks.js
buffer.js buffer: move process.binding('buffer') to internalBinding 2018-10-15 19:01:20 +08:00
child_process.js Revert "child_process: change windowsHide default to true" 2018-11-13 14:38:23 -08:00
cluster.js
console.js console: console.timeLog() using the default label 2018-11-13 10:02:56 +05:30
constants.js src,lib: move natives and constants to internalBinding() 2018-10-21 03:17:12 +02:00
crypto.js src: cache the result of GetOptions() in JS land 2018-11-07 20:40:38 -08:00
dgram.js src,lib: move natives and constants to internalBinding() 2018-10-21 03:17:12 +02:00
dns.js dns: fix inconsistent (hostname vs host) 2018-10-20 21:56:28 -07:00
domain.js async_hooks: remove promise object from resource 2018-10-15 19:40:51 +01:00
events.js events: remove unused catch bindings 2018-11-06 10:58:47 -05:00
fs.js src: prefer param function check over args length 2018-11-07 19:42:06 -08:00
http2.js
http.js
https.js
inspector.js inspector: enable Inspector JS API in workers 2018-09-17 09:49:53 -07:00
module.js
net.js fs,net: standardize pending stream property 2018-11-13 23:02:33 -08:00
os.js os: do not call into JS to push values to an array in GetCPUInfo 2018-11-14 02:59:45 +08:00
path.js lib: remove useless cwd in posix.resolve 2018-10-30 05:23:52 +01:00
perf_hooks.js bootstrapper: move internalBinding to NativeModule 2018-10-04 11:55:34 +02:00
process.js
punycode.js
querystring.js querystring: remove unused catch bindings 2018-11-06 10:59:09 -05:00
readline.js lib: repl multiline history support 2018-11-02 13:56:33 -07:00
repl.js src: cache the result of GetOptions() in JS land 2018-11-07 20:40:38 -08:00
stream.js tools: lint for unused catch bindings 2018-11-06 10:59:27 -05:00
string_decoder.js bootstrapper: move internalBinding to NativeModule 2018-10-04 11:55:34 +02:00
sys.js
timers.js timers: run nextTicks after each immediate and timer 2018-10-17 20:38:07 -07:00
tls.js tls: throw if protocol too long 2018-10-23 21:05:47 -07:00
trace_events.js trace_events: forbid tracing modifications from worker threads 2018-10-24 11:20:35 -03:00
tty.js Revert "tty: make _read throw ERR_TTY_WRITABLE_NOT_READABLE" 2018-10-04 09:20:21 -07:00
url.js icu: make process.binding('icu') internal 2018-10-08 23:42:52 -04:00
util.js util: treat format arguments equally 2018-10-17 19:56:43 +02:00
v8.js buffer: move process.binding('buffer') to internalBinding 2018-10-15 19:01:20 +08:00
vm.js src: cache the result of GetOptions() in JS land 2018-11-07 20:40:38 -08:00
worker_threads.js
zlib.js zlib: do not leak on destroy 2018-10-23 17:59:17 +02:00