Skip to content

Commit

Permalink
lib: fix code cache generation
Browse files Browse the repository at this point in the history
e7f710c broke the code cache generation since internalBinding
is now passed in through the wrapper and cannot be redeclared.
This patch fixes that.

Refs: #21563
PR-URL: #23855
Reviewed-By: Michaël Zasso <[email protected]>
Reviewed-By: Refael Ackermann <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: James M Snell <[email protected]>
  • Loading branch information
joyeecheung committed Oct 30, 2018
1 parent b255cd4 commit 9c0c3f1
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion lib/internal/bootstrap/cache.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,9 @@
// cannot be tampered with even with --expose-internals

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

function getCodeCache(id) {
const cached = NativeModule.getCached(id);
Expand Down Expand Up @@ -42,6 +43,16 @@ const cannotUseCache = [
'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');
}
if (!hasTracing) {
cannotUseCache.push('trace_events');
}

module.exports = {
cachableBuiltins: Object.keys(NativeModule._source).filter(
(key) => !cannotUseCache.includes(key)
Expand Down

0 comments on commit 9c0c3f1

Please sign in to comment.