diff options
author | Joyee Cheung <joyeec9h3@gmail.com> | 2020-06-22 22:31:52 +0300 |
---|---|---|
committer | Joyee Cheung <joyeec9h3@gmail.com> | 2020-07-18 06:23:18 +0300 |
commit | f8bde7ce06ee18e949dffddcbdb7f572f942ee70 (patch) | |
tree | c217764e568c7ec11d760a02793e9e6abc31a1ef /src/node_process_methods.cc | |
parent | c943cb4809d382d1816a5f435c0eacc14e750ab2 (diff) |
bootstrap: build fast APIs in pre-execution
Fast APIs need to work with ArrayBuffers which we need
to rebuild connections to after deserializing them
from the snapshot. For now, postpone their creation
until pre-execution to simplify the process.
PR-URL: https://github.com/nodejs/node/pull/32984
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com>
Diffstat (limited to 'src/node_process_methods.cc')
-rw-r--r-- | src/node_process_methods.cc | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/src/node_process_methods.cc b/src/node_process_methods.cc index aa186185988..e714cdd30f9 100644 --- a/src/node_process_methods.cc +++ b/src/node_process_methods.cc @@ -504,6 +504,16 @@ class FastHrtime : public BaseObject { std::shared_ptr<BackingStore> backing_store_; }; +static void GetFastAPIs(const FunctionCallbackInfo<Value>& args) { + Environment* env = Environment::GetCurrent(args); + Local<Object> ret = Object::New(env->isolate()); + ret->Set(env->context(), + FIXED_ONE_BYTE_STRING(env->isolate(), "hrtime"), + FastHrtime::New(env)) + .ToChecked(); + args.GetReturnValue().Set(ret); +} + static void InitializeProcessMethods(Local<Object> target, Local<Value> unused, Local<Context> context, @@ -534,12 +544,7 @@ static void InitializeProcessMethods(Local<Object> target, env->SetMethod(target, "reallyExit", ReallyExit); env->SetMethodNoSideEffect(target, "uptime", Uptime); env->SetMethod(target, "patchProcessObject", PatchProcessObject); - - target - ->Set(env->context(), - FIXED_ONE_BYTE_STRING(env->isolate(), "hrtime"), - FastHrtime::New(env)) - .ToChecked(); + env->SetMethod(target, "getFastAPIs", GetFastAPIs); } } // namespace node |