Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nodejs/node.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoyee Cheung <joyeec9h3@gmail.com>2021-11-18 06:56:39 +0300
committerBryan English <bryan@bryanenglish.com>2022-05-30 19:26:49 +0300
commit85d81a764f7ddd60a18ea772bf912950b0818b2f (patch)
tree786c07ce8692d404f57e5057006a96a091fb91a4 /node.gyp
parent82fb037388f510fde52558c8e19746a5ebb63938 (diff)
bootstrap: include code cache in the embedded snapshot
Since V8 code cache encodes indices to the read-only space it is safer to make sure that the code cache is generated in the same heap used to generate the embdded snapshot. This patch merges the code cache builder into the snapshot builder and makes the code cache part of node::SnapshotData that is deserialized into the native module loader during bootstrap. PR-URL: https://github.com/nodejs/node/pull/43023 Fixes: https://github.com/nodejs/node/issues/31074 Refs: https://github.com/nodejs/node/issues/35711 Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Chengzhong Wu <legendecas@gmail.com>
Diffstat (limited to 'node.gyp')
-rw-r--r--node.gyp106
1 files changed, 11 insertions, 95 deletions
diff --git a/node.gyp b/node.gyp
index 86fe9a64379..103178e2ee9 100644
--- a/node.gyp
+++ b/node.gyp
@@ -55,7 +55,6 @@
'deps/undici/undici.js',
],
'node_mksnapshot_exec': '<(PRODUCT_DIR)/<(EXECUTABLE_PREFIX)node_mksnapshot<(EXECUTABLE_SUFFIX)',
- 'mkcodecache_exec': '<(PRODUCT_DIR)/<(EXECUTABLE_PREFIX)mkcodecache<(EXECUTABLE_SUFFIX)',
'conditions': [
['GENERATOR == "ninja"', {
'node_text_start_object_path': 'src/large_pages/node_text_start.node_text_start.o'
@@ -304,32 +303,7 @@
},
},
}],
- ['node_use_node_code_cache=="true"', {
- 'dependencies': [
- 'mkcodecache',
- ],
- 'actions': [
- {
- 'action_name': 'run_mkcodecache',
- 'process_outputs_as_sources': 1,
- 'inputs': [
- '<(mkcodecache_exec)',
- ],
- 'outputs': [
- '<(SHARED_INTERMEDIATE_DIR)/node_code_cache.cc',
- ],
- 'action': [
- '<@(_inputs)',
- '<@(_outputs)',
- ],
- },
- ],
- }, {
- 'sources': [
- 'src/node_code_cache_stub.cc'
- ],
- }],
- ['node_use_node_snapshot=="true"', {
+ ['node_use_node_snapshot=="true"', {
'dependencies': [
'node_mksnapshot',
],
@@ -735,7 +709,6 @@
[ 'node_shared=="true"', {
'sources': [
'src/node_snapshot_stub.cc',
- 'src/node_code_cache_stub.cc',
]
}],
[ 'node_shared=="true" and node_module_version!="" and OS!="win"', {
@@ -745,6 +718,11 @@
'@rpath/lib<(node_core_target_name).<(shlib_suffix)'
},
}],
+ [ 'node_use_node_code_cache=="true"', {
+ 'defines': [
+ 'NODE_USE_NODE_CODE_CACHE=1',
+ ],
+ }],
['node_shared=="true" and OS=="aix"', {
'product_name': 'node_base',
}],
@@ -1145,7 +1123,6 @@
],
'sources': [
'src/node_snapshot_stub.cc',
- 'src/node_code_cache_stub.cc',
'test/fuzzers/fuzz_url.cc',
],
'conditions': [
@@ -1188,7 +1165,6 @@
],
'sources': [
'src/node_snapshot_stub.cc',
- 'src/node_code_cache_stub.cc',
'test/fuzzers/fuzz_env.cc',
],
'conditions': [
@@ -1238,7 +1214,6 @@
'sources': [
'src/node_snapshot_stub.cc',
- 'src/node_code_cache_stub.cc',
'test/cctest/node_test_fixture.cc',
'test/cctest/node_test_fixture.h',
'test/cctest/test_aliased_buffer.cc',
@@ -1331,7 +1306,6 @@
'sources': [
'src/node_snapshot_stub.cc',
- 'src/node_code_cache_stub.cc',
'test/embedding/embedtest.cc',
],
@@ -1375,68 +1349,6 @@
}],
]
}, # overlapped-checker
-
- # TODO(joyeecheung): do not depend on node_lib,
- # instead create a smaller static library node_lib_base that does
- # just enough for node_native_module.cc and the cache builder to
- # compile without compiling the generated code cache C++ file.
- # So generate_code_cache -> mkcodecache -> node_lib_base,
- # node_lib -> node_lib_base & generate_code_cache
- {
- 'target_name': 'mkcodecache',
- 'type': 'executable',
-
- 'dependencies': [
- '<(node_lib_target_name)',
- 'deps/histogram/histogram.gyp:histogram',
- 'deps/uvwasi/uvwasi.gyp:uvwasi',
- ],
-
- 'includes': [
- 'node.gypi'
- ],
-
- 'include_dirs': [
- 'src',
- 'tools/msvs/genfiles',
- 'deps/v8/include',
- 'deps/cares/include',
- 'deps/uv/include',
- 'deps/uvwasi/include',
- ],
-
- 'defines': [
- 'NODE_WANT_INTERNALS=1'
- ],
- 'sources': [
- 'src/node_snapshot_stub.cc',
- 'src/node_code_cache_stub.cc',
- 'tools/code_cache/mkcodecache.cc',
- 'tools/code_cache/cache_builder.cc',
- 'tools/code_cache/cache_builder.h',
- ],
-
- 'conditions': [
- [ 'node_use_openssl=="true"', {
- 'defines': [
- 'HAVE_OPENSSL=1',
- ],
- }],
- ['v8_enable_inspector==1', {
- 'defines': [
- 'HAVE_INSPECTOR=1',
- ],
- }],
- ['OS=="win"', {
- 'libraries': [
- 'dbghelp.lib',
- 'PsApi.lib',
- 'winmm.lib',
- 'Ws2_32.lib',
- ],
- }],
- ],
- }, # mkcodecache
{
'target_name': 'node_mksnapshot',
'type': 'executable',
@@ -1464,7 +1376,6 @@
'sources': [
'src/node_snapshot_stub.cc',
- 'src/node_code_cache_stub.cc',
'tools/snapshot/node_mksnapshot.cc',
],
@@ -1474,6 +1385,11 @@
'HAVE_OPENSSL=1',
],
}],
+ [ 'node_use_node_code_cache=="true"', {
+ 'defines': [
+ 'NODE_USE_NODE_CODE_CACHE=1',
+ ],
+ }],
['v8_enable_inspector==1', {
'defines': [
'HAVE_INSPECTOR=1',