Skip to content

Commit

Permalink
lib: fix nits in lib/internal/bootstrap/cache.js
Browse files Browse the repository at this point in the history
* Unwrap short lines.
* Unify comments.
* Decrease function calls.

PR-URL: #24581
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
  • Loading branch information
vsemozhetbyt authored and targos committed Nov 27, 2018
1 parent e7b5187 commit 838eecc
Showing 1 changed file with 31 additions and 33 deletions.
64 changes: 31 additions & 33 deletions lib/internal/bootstrap/cache.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,10 @@
// 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
// cannot be tampered with even with --expose-internals.

const {
NativeModule
} = require('internal/bootstrap/loaders');
const {
getSource,
compileCodeCache
} = internalBinding('native_module');
const { NativeModule } = require('internal/bootstrap/loaders');
const { getSource, compileCodeCache } = internalBinding('native_module');
const { hasTracing } = process.binding('config');

const source = getSource();
Expand All @@ -20,52 +15,55 @@ const depsModule = Object.keys(source).filter(
);

// Modules with source code compiled in js2c that
// cannot be compiled with the code cache
// cannot be compiled with the code cache.
const cannotUseCache = [
'config',
'sys', // deprecated
'sys', // Deprecated.
'internal/v8_prof_polyfill',
'internal/v8_prof_processor',

'internal/per_context',

'internal/test/binding',
// TODO(joyeecheung): update the C++ side so that
// the code cache is also used when compiling these
// two files.
// the code cache is also used when compiling these two files.
'internal/bootstrap/loaders',
'internal/bootstrap/node'
].concat(depsModule);

// Skip modules that cannot be required when they are not
// built into the binary.
if (process.config.variables.v8_enable_inspector !== 1) {
cannotUseCache.push('inspector');
cannotUseCache.push('internal/util/inspector');
cannotUseCache.push(
'inspector',
'internal/util/inspector',
);
}
if (!hasTracing) {
cannotUseCache.push('trace_events');
}
if (!process.versions.openssl) {
cannotUseCache.push('crypto');
cannotUseCache.push('https');
cannotUseCache.push('http2');
cannotUseCache.push('tls');
cannotUseCache.push('_tls_common');
cannotUseCache.push('_tls_wrap');
cannotUseCache.push('internal/crypto/certificate');
cannotUseCache.push('internal/crypto/cipher');
cannotUseCache.push('internal/crypto/diffiehellman');
cannotUseCache.push('internal/crypto/hash');
cannotUseCache.push('internal/crypto/keygen');
cannotUseCache.push('internal/crypto/pbkdf2');
cannotUseCache.push('internal/crypto/random');
cannotUseCache.push('internal/crypto/scrypt');
cannotUseCache.push('internal/crypto/sig');
cannotUseCache.push('internal/crypto/util');
cannotUseCache.push('internal/http2/core');
cannotUseCache.push('internal/http2/compat');
cannotUseCache.push('internal/streams/lazy_transform');
cannotUseCache.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/pbkdf2',
'internal/crypto/random',
'internal/crypto/scrypt',
'internal/crypto/sig',
'internal/crypto/util',
'internal/http2/core',
'internal/http2/compat',
'internal/streams/lazy_transform',
);
}

module.exports = {
Expand Down

0 comments on commit 838eecc

Please sign in to comment.