summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorJoyee Cheung <joyeec9h3@gmail.com>2019-04-02 06:04:05 +0800
committerJoyee Cheung <joyeec9h3@gmail.com>2019-04-04 11:16:10 +0800
commite1d55a0cbc9cd921f8403a550cbfae8497d70d1d (patch)
tree5cb588cb3323ce97cd5b599f408d558d28390631 /tools
parentf59ec2abee82f22822b7b3231ca2056fc028a279 (diff)
downloadandroid-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 'tools')
-rw-r--r--tools/generate_code_cache.js9
1 files changed, 6 insertions, 3 deletions
diff --git a/tools/generate_code_cache.js b/tools/generate_code_cache.js
index a434f640c2..f324c3d779 100644
--- a/tools/generate_code_cache.js
+++ b/tools/generate_code_cache.js
@@ -7,11 +7,12 @@
// compiled into the binary using the `--code-cache-path` option
// of `configure`.
+const { internalBinding } = require('internal/test/binding');
const {
+ moduleCategories: { canBeRequired },
getCodeCache,
compileFunction,
- cachableBuiltins
-} = require('internal/bootstrap/cache');
+} = internalBinding('native_module');
const {
types: {
@@ -85,7 +86,9 @@ function lexical(a, b) {
return 0;
}
-for (const key of cachableBuiltins.sort(lexical)) {
+// TODO(joyeecheung): support non-modules that require different
+// parameters in the wrapper.
+for (const key of [...canBeRequired].sort(lexical)) {
compileFunction(key); // compile it
const cachedData = getCodeCache(key);
if (!isUint8Array(cachedData)) {