diff --git a/src/async_wrap-inl.h b/src/async_wrap-inl.h index f9c709aa21e987..c9f12333243092 100644 --- a/src/async_wrap-inl.h +++ b/src/async_wrap-inl.h @@ -50,7 +50,6 @@ inline AsyncWrap::AsyncScope::AsyncScope(AsyncWrap* wrap) Environment* env = wrap->env(); if (env->async_hooks()->fields()[Environment::AsyncHooks::kBefore] == 0) return; - v8::HandleScope handle_scope(env->isolate()); EmitBefore(env, wrap->get_async_id()); } @@ -58,7 +57,6 @@ inline AsyncWrap::AsyncScope::~AsyncScope() { Environment* env = wrap_->env(); if (env->async_hooks()->fields()[Environment::AsyncHooks::kAfter] == 0) return; - v8::HandleScope handle_scope(env->isolate()); EmitAfter(env, wrap_->get_async_id()); } diff --git a/src/async_wrap.cc b/src/async_wrap.cc index 5e0543a12d960f..06dcbb4fb1d29d 100644 --- a/src/async_wrap.cc +++ b/src/async_wrap.cc @@ -169,6 +169,7 @@ void Emit(Environment* env, double async_id, AsyncHooks::Fields type, if (async_hooks->fields()[type] == 0) return; + v8::HandleScope handle_scope(env->isolate()); Local async_id_value = Number::New(env->isolate(), async_id); FatalTryCatch try_catch(env); USE(fn->Call(env->context(), Undefined(env->isolate()), 1, &async_id_value));