Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build: add --without-node-code-cache configure option #30647

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
17 changes: 13 additions & 4 deletions configure.py
Expand Up @@ -455,6 +455,11 @@
dest='without_node_snapshot',
help='Turn off V8 snapshot integration. Currently experimental.')

parser.add_option('--without-node-code-cache',
action='store_true',
dest='without_node_code_cache',
help='Turn off V8 Code cache integration.')

intl_optgroup.add_option('--download',
action='store',
dest='download_list',
Expand Down Expand Up @@ -976,10 +981,16 @@ def configure_node(o):
o['variables']['want_separate_host_toolset'] = int(cross_compiling)

if not options.without_node_snapshot:
o['variables']['node_use_node_snapshot'] = b(not cross_compiling)
o['variables']['node_use_node_snapshot'] = b(not cross_compiling and not options.shared)
joyeecheung marked this conversation as resolved.
Show resolved Hide resolved
else:
o['variables']['node_use_node_snapshot'] = 'false'

if not options.without_node_code_cache:
# TODO(refack): fix this when implementing embedded code-cache when cross-compiling.
o['variables']['node_use_node_code_cache'] = b(not cross_compiling and not options.shared)
else:
o['variables']['node_use_node_code_cache'] = 'false'

if target_arch == 'arm':
configure_arm(o)
elif target_arch in ('mips', 'mipsel', 'mips64el'):
Expand Down Expand Up @@ -1100,9 +1111,7 @@ def configure_node(o):
o['variables']['debug_nghttp2'] = 'false'

o['variables']['node_no_browser_globals'] = b(options.no_browser_globals)
# TODO(refack): fix this when implementing embedded code-cache when cross-compiling.
if o['variables']['want_separate_host_toolset'] == 0:
o['variables']['node_code_cache'] = 'yes' # For testing

o['variables']['node_shared'] = b(options.shared)
node_module_version = getmoduleversion.get_version()

Expand Down
2 changes: 1 addition & 1 deletion node.gyp
Expand Up @@ -432,7 +432,7 @@
},
},
}],
['want_separate_host_toolset==0', {
['node_use_node_code_cache=="true"', {
'dependencies': [
'mkcodecache',
],
Expand Down
7 changes: 3 additions & 4 deletions test/parallel/test-code-cache.js
Expand Up @@ -33,6 +33,8 @@ const loadedModules = process.moduleLoadList
// are all compiled without cache and we are doing the bookkeeping right.
if (!process.features.cached_builtins) {
console.log('The binary is not configured with code cache');
assert(!process.config.variables.node_use_node_code_cache);

if (isMainThread) {
assert.deepStrictEqual(compiledWithCache, new Set());
for (const key of loadedModules) {
Expand All @@ -46,10 +48,7 @@ if (!process.features.cached_builtins) {
assert.notDeepStrictEqual(compiledWithCache, new Set());
}
} else { // Native compiled
assert.strictEqual(
process.config.variables.node_code_cache,
'yes'
);
assert(process.config.variables.node_use_node_code_cache);

if (!isMainThread) {
for (const key of [ 'internal/bootstrap/pre_execution' ]) {
Expand Down