summaryrefslogtreecommitdiff
path: root/tools/generate_code_cache.js
diff options
context:
space:
mode:
authorJoyee Cheung <joyeec9h3@gmail.com>2018-12-03 08:23:34 +0800
committerJoyee Cheung <joyeec9h3@gmail.com>2018-12-18 18:02:08 +0800
commitceb66352236240498a9263500c7bde74e58c71fa (patch)
tree8f3c1e50ef535cba057f0916e6925c5dab2a6d23 /tools/generate_code_cache.js
parent8828426af45adc29847d0d20717c8fa3eb9bb523 (diff)
downloadandroid-node-v8-ceb66352236240498a9263500c7bde74e58c71fa.tar.gz
android-node-v8-ceb66352236240498a9263500c7bde74e58c71fa.tar.bz2
android-node-v8-ceb66352236240498a9263500c7bde74e58c71fa.zip
src: remove code cache integrity check
In preparation of sharing code cache among different threads - we simply rely on v8 to reject invalid cache, since there isn't any serious consequence when the cache is invalid anyway. PR-URL: https://github.com/nodejs/node/pull/24950 Reviewed-By: Anna Henningsen <anna@addaleax.net>
Diffstat (limited to 'tools/generate_code_cache.js')
-rw-r--r--tools/generate_code_cache.js27
1 files changed, 3 insertions, 24 deletions
diff --git a/tools/generate_code_cache.js b/tools/generate_code_cache.js
index b185f6246d..3e21743f2c 100644
--- a/tools/generate_code_cache.js
+++ b/tools/generate_code_cache.js
@@ -8,7 +8,6 @@
// of `configure`.
const {
- getSource,
getCodeCache,
cachableBuiltins
} = require('internal/bootstrap/cache');
@@ -19,13 +18,6 @@ const {
}
} = require('util');
-function hash(str) {
- if (process.versions.openssl) {
- return require('crypto').createHash('sha256').update(str).digest('hex');
- }
- return '';
-}
-
const fs = require('fs');
const resultPath = process.argv[2];
@@ -65,26 +57,18 @@ function getInitalizer(key, cache) {
const defName = `${key.replace(/\//g, '_').replace(/-/g, '_')}_raw`;
const definition = `static const uint8_t ${defName}[] = {\n` +
`${cache.join(',')}\n};`;
- const source = getSource(key);
- const sourceHash = hash(source);
const initializer =
'code_cache_.emplace(\n' +
` "${key}",\n` +
` UnionBytes(${defName}, arraysize(${defName}))\n` +
');';
- const hashIntializer =
- 'code_cache_hash_.emplace(\n' +
- ` "${key}",\n` +
- ` "${sourceHash}"\n` +
- ');';
return {
- definition, initializer, hashIntializer, sourceHash
+ definition, initializer
};
}
const cacheDefinitions = [];
const cacheInitializers = [];
-const cacheHashInitializers = [];
let totalCacheSize = 0;
function lexical(a, b) {
@@ -107,13 +91,12 @@ for (const key of cachableBuiltins.sort(lexical)) {
const size = cachedData.byteLength;
totalCacheSize += size;
const {
- definition, initializer, hashIntializer, sourceHash
+ definition, initializer,
} = getInitalizer(key, cachedData);
cacheDefinitions.push(definition);
cacheInitializers.push(initializer);
- cacheHashInitializers.push(hashIntializer);
console.log(`Generated cache for '${key}', size = ${formatSize(size)}` +
- `, hash = ${sourceHash}, total = ${formatSize(totalCacheSize)}`);
+ `, total = ${formatSize(totalCacheSize)}`);
}
const result = `#include "node_native_module.h"
@@ -131,10 +114,6 @@ void NativeModuleLoader::LoadCodeCache() {
${cacheInitializers.join('\n ')}
}
-void NativeModuleLoader::LoadCodeCacheHash() {
- ${cacheHashInitializers.join('\n ')}
-}
-
} // namespace native_module
} // namespace node
`;