Skip to content
Permalink
Browse files

src: prefer to get `Environment` from `Context`

We explicitly store the context anyway, and can skip the
extra steps introduced in `Environment::GetCurrent()`.

PR-URL: #26376
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
  • Loading branch information...
addaleax authored and BridgeAR committed Feb 24, 2019
1 parent 716ec00 commit 622048d5392a7350b92919a5b3b2786df3039867
Showing with 2 additions and 3 deletions.
  1. +2 −3 src/node_perf.cc
@@ -333,10 +333,9 @@ inline Local<Value> GetName(Local<Function> fn) {
// execution.
void TimerFunctionCall(const FunctionCallbackInfo<Value>& args) {
Isolate* isolate = args.GetIsolate();
HandleScope scope(isolate);
Environment* env = Environment::GetCurrent(isolate);
Local<Context> context = isolate->GetCurrentContext();
Environment* env = Environment::GetCurrent(context);
CHECK_NOT_NULL(env);
Local<Context> context = env->context();
Local<Function> fn = args.Data().As<Function>();
size_t count = args.Length();
size_t idx;

0 comments on commit 622048d

Please sign in to comment.
You can’t perform that action at this time.