diff options
author | Joyee Cheung <joyeec9h3@gmail.com> | 2019-04-02 06:04:05 +0800 |
---|---|---|
committer | Joyee Cheung <joyeec9h3@gmail.com> | 2019-04-04 11:16:10 +0800 |
commit | e1d55a0cbc9cd921f8403a550cbfae8497d70d1d (patch) | |
tree | 5cb588cb3323ce97cd5b599f408d558d28390631 /lib/internal/bootstrap | |
parent | f59ec2abee82f22822b7b3231ca2056fc028a279 (diff) | |
download | android-node-v8-e1d55a0cbc9cd921f8403a550cbfae8497d70d1d.tar.gz android-node-v8-e1d55a0cbc9cd921f8403a550cbfae8497d70d1d.tar.bz2 android-node-v8-e1d55a0cbc9cd921f8403a550cbfae8497d70d1d.zip |
src: port bootstrap/cache.js to C++
This allows us to query the categories of modules in C++
so we can implement the code cache generator in C++ that
does not depend on a Node.js binary.
PR-URL: https://github.com/nodejs/node/pull/27046
Refs: https://github.com/nodejs/node/issues/21563
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Diffstat (limited to 'lib/internal/bootstrap')
-rw-r--r-- | lib/internal/bootstrap/cache.js | 85 |
1 files changed, 0 insertions, 85 deletions
diff --git a/lib/internal/bootstrap/cache.js b/lib/internal/bootstrap/cache.js deleted file mode 100644 index 0f58929c9c..0000000000 --- a/lib/internal/bootstrap/cache.js +++ /dev/null @@ -1,85 +0,0 @@ -'use strict'; - -// This is only exposed for internal build steps and testing purposes. -// We create new copies of the source and the code cache -// so the resources eventually used to compile builtin modules -// cannot be tampered with even with --expose-internals. - -const { NativeModule } = require('internal/bootstrap/loaders'); -const { - getCodeCache, compileFunction -} = internalBinding('native_module'); -const { hasTracing, hasInspector } = internalBinding('config'); - -// Modules with source code compiled in js2c that -// cannot be compiled with the code cache. -const cannotBeRequired = [ - 'sys', // Deprecated. - 'internal/v8_prof_polyfill', - 'internal/v8_prof_processor', - - 'internal/test/binding', - - 'internal/bootstrap/environment', - 'internal/bootstrap/primordials', - 'internal/bootstrap/loaders', - 'internal/bootstrap/node', - - 'internal/per_context/setup', - 'internal/per_context/domexception', -]; - -// Skip modules that cannot be required when they are not -// built into the binary. -if (!hasInspector) { - cannotBeRequired.push( - 'inspector', - 'internal/util/inspector', - ); -} -if (!hasTracing) { - cannotBeRequired.push('trace_events'); -} -if (!process.versions.openssl) { - cannotBeRequired.push( - 'crypto', - 'https', - 'http2', - 'tls', - '_tls_common', - '_tls_wrap', - 'internal/crypto/certificate', - 'internal/crypto/cipher', - 'internal/crypto/diffiehellman', - 'internal/crypto/hash', - 'internal/crypto/keygen', - 'internal/crypto/keys', - 'internal/crypto/pbkdf2', - 'internal/crypto/random', - 'internal/crypto/scrypt', - 'internal/crypto/sig', - 'internal/crypto/util', - 'internal/http2/core', - 'internal/http2/compat', - 'internal/policy/manifest', - 'internal/process/policy', - 'internal/streams/lazy_transform', - ); -} - -const cachableBuiltins = []; -for (const id of NativeModule.map.keys()) { - if (id.startsWith('internal/deps') || id.startsWith('internal/main')) { - cannotBeRequired.push(id); - } - if (!cannotBeRequired.includes(id)) { - cachableBuiltins.push(id); - } -} - -module.exports = { - cachableBuiltins, - getCodeCache, - compileFunction, - cannotBeRequired -}; |