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 <targos@protonmail.com>
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
  • Loading branch information
joyeecheung authored and targos committed Nov 2, 2018
1 parent 164f244 commit 5ff1e67
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 5ff1e67

Please sign in to comment.