Skip to content

Commit 6545314

Browse files
joyeecheungBridgeAR
authored andcommitted
build: add --without-node-code-cache configure option
So that it's possible to build without code cache (in particular, without building mkcodecache) for testing. PR-URL: #30647 Refs: #28845 Reviewed-By: Ben Noordhuis <[email protected]> Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: David Carlier <[email protected]> Reviewed-By: James M Snell <[email protected]>
1 parent 49e047f commit 6545314

File tree

3 files changed

+16
-8
lines changed

3 files changed

+16
-8
lines changed

configure.py

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -455,6 +455,11 @@
455455
dest='without_node_snapshot',
456456
help='Turn off V8 snapshot integration. Currently experimental.')
457457

458+
parser.add_option('--without-node-code-cache',
459+
action='store_true',
460+
dest='without_node_code_cache',
461+
help='Turn off V8 Code cache integration.')
462+
458463
intl_optgroup.add_option('--download',
459464
action='store',
460465
dest='download_list',
@@ -980,6 +985,12 @@ def configure_node(o):
980985
else:
981986
o['variables']['node_use_node_snapshot'] = 'false'
982987

988+
if not options.without_node_code_cache:
989+
# TODO(refack): fix this when implementing embedded code-cache when cross-compiling.
990+
o['variables']['node_use_node_code_cache'] = b(not cross_compiling)
991+
else:
992+
o['variables']['node_use_node_code_cache'] = 'false'
993+
983994
if target_arch == 'arm':
984995
configure_arm(o)
985996
elif target_arch in ('mips', 'mipsel', 'mips64el'):
@@ -1100,9 +1111,7 @@ def configure_node(o):
11001111
o['variables']['debug_nghttp2'] = 'false'
11011112

11021113
o['variables']['node_no_browser_globals'] = b(options.no_browser_globals)
1103-
# TODO(refack): fix this when implementing embedded code-cache when cross-compiling.
1104-
if o['variables']['want_separate_host_toolset'] == 0:
1105-
o['variables']['node_code_cache'] = 'yes' # For testing
1114+
11061115
o['variables']['node_shared'] = b(options.shared)
11071116
node_module_version = getmoduleversion.get_version()
11081117

node.gyp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -436,7 +436,7 @@
436436
},
437437
},
438438
}],
439-
['want_separate_host_toolset==0', {
439+
['node_use_node_code_cache=="true"', {
440440
'dependencies': [
441441
'mkcodecache',
442442
],

test/parallel/test-code-cache.js

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@ const loadedModules = process.moduleLoadList
3333
// are all compiled without cache and we are doing the bookkeeping right.
3434
if (!process.features.cached_builtins) {
3535
console.log('The binary is not configured with code cache');
36+
assert(!process.config.variables.node_use_node_code_cache);
37+
3638
if (isMainThread) {
3739
assert.deepStrictEqual(compiledWithCache, new Set());
3840
for (const key of loadedModules) {
@@ -46,10 +48,7 @@ if (!process.features.cached_builtins) {
4648
assert.notDeepStrictEqual(compiledWithCache, new Set());
4749
}
4850
} else { // Native compiled
49-
assert.strictEqual(
50-
process.config.variables.node_code_cache,
51-
'yes'
52-
);
51+
assert(process.config.variables.node_use_node_code_cache);
5352

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

0 commit comments

Comments
 (0)