Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nodejs/node.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoyee Cheung <joyeec9h3@gmail.com>2019-04-04 01:29:02 +0300
committerRefael Ackermann <refack@gmail.com>2019-04-17 01:23:32 +0300
commit4fd71935795fa7c284f5ed621551b65a28b8271c (patch)
tree63a90841b3ac80aab7c28c64d0b6dc46e2f19c82 /src/node_native_module_env.cc
parent1c2616971417bee811ea00da436c87a489f9b1ed (diff)
tools: implement mkcodecache as an executable
This patch implement a mkcodecache executable on top of the `NativeModuleLoader` singleton. This makes it possible to build a Node.js binary with embedded code cache without building itself using the code cache stub - the cache is now initialized by `NativeModuleEnv` instead which can be refactored out of the mkcodecache dependencies. PR-URL: https://github.com/nodejs/node/pull/27161 Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Diffstat (limited to 'src/node_native_module_env.cc')
-rw-r--r--src/node_native_module_env.cc24
1 files changed, 0 insertions, 24 deletions
diff --git a/src/node_native_module_env.cc b/src/node_native_module_env.cc
index fc48436dc14..171c649a19d 100644
--- a/src/node_native_module_env.cc
+++ b/src/node_native_module_env.cc
@@ -4,7 +4,6 @@
namespace node {
namespace native_module {
-using v8::ArrayBuffer;
using v8::Context;
using v8::DEFAULT;
using v8::Function;
@@ -18,11 +17,9 @@ using v8::Name;
using v8::None;
using v8::Object;
using v8::PropertyCallbackInfo;
-using v8::ScriptCompiler;
using v8::Set;
using v8::SideEffectType;
using v8::String;
-using v8::Uint8Array;
using v8::Value;
// TODO(joyeecheung): make these more general and put them into util.h
@@ -154,26 +151,6 @@ MaybeLocal<Function> NativeModuleEnv::LookupAndCompile(
return maybe;
}
-// This is supposed to be run only by the main thread in
-// tools/generate_code_cache.js
-void NativeModuleEnv::GetCodeCache(const FunctionCallbackInfo<Value>& args) {
- Environment* env = Environment::GetCurrent(args);
- Isolate* isolate = env->isolate();
- CHECK(env->is_main_thread());
-
- CHECK(args[0]->IsString());
- node::Utf8Value id_v(isolate, args[0].As<String>());
- const char* id = *id_v;
-
- ScriptCompiler::CachedData* cached_data =
- NativeModuleLoader::GetInstance()->GetCodeCache(id);
- if (cached_data != nullptr) {
- Local<ArrayBuffer> buf = ArrayBuffer::New(isolate, cached_data->length);
- memcpy(buf->GetContents().Data(), cached_data->data, cached_data->length);
- args.GetReturnValue().Set(Uint8Array::New(buf, 0, cached_data->length));
- }
-}
-
// TODO(joyeecheung): It is somewhat confusing that Class::Initialize
// is used to initilaize to the binding, but it is the current convention.
// Rename this across the code base to something that makes more sense.
@@ -216,7 +193,6 @@ void NativeModuleEnv::Initialize(Local<Object> target,
.Check();
env->SetMethod(target, "getCacheUsage", NativeModuleEnv::GetCacheUsage);
- env->SetMethod(target, "getCodeCache", NativeModuleEnv::GetCodeCache);
env->SetMethod(target, "compileFunction", NativeModuleEnv::CompileFunction);
// internalBinding('native_module') should be frozen
target->SetIntegrityLevel(context, IntegrityLevel::kFrozen).FromJust();