diff options
Diffstat (limited to 'deps/v8/src/d8/async-hooks-wrapper.cc')
-rw-r--r-- | deps/v8/src/d8/async-hooks-wrapper.cc | 31 |
1 files changed, 20 insertions, 11 deletions
diff --git a/deps/v8/src/d8/async-hooks-wrapper.cc b/deps/v8/src/d8/async-hooks-wrapper.cc index dccc5e515b..8076448a0b 100644 --- a/deps/v8/src/d8/async-hooks-wrapper.cc +++ b/deps/v8/src/d8/async-hooks-wrapper.cc @@ -67,8 +67,8 @@ AsyncHooks::AsyncHooks(Isolate* isolate) : isolate_(isolate) { async_hooks_templ.Get(isolate_)->Set( isolate_, "disable", FunctionTemplate::New(isolate_, DisableHook)); - async_id_smb.Reset(isolate_, Private::New(isolate_)); - trigger_id_smb.Reset(isolate_, Private::New(isolate_)); + async_id_symbol.Reset(isolate_, Private::New(isolate_)); + trigger_id_symbol.Reset(isolate_, Private::New(isolate_)); isolate_->SetPromiseHook(ShellPromiseHook); } @@ -166,6 +166,7 @@ Local<Object> AsyncHooks::CreateHook( void AsyncHooks::ShellPromiseHook(PromiseHookType type, Local<Promise> promise, Local<Value> parent) { v8::Isolate* isolate = promise->GetIsolate(); + if (isolate->IsExecutionTerminating()) return; i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate); AsyncHooks* hooks = PerIsolateData::Get(isolate)->GetAsyncHooks(); @@ -188,34 +189,40 @@ void AsyncHooks::ShellPromiseHook(PromiseHookType type, Local<Promise> promise, ++hooks->current_async_id; Local<Integer> async_id = Integer::New(isolate, hooks->current_async_id); CHECK( - !promise->HasPrivate(currentContext, hooks->async_id_smb.Get(isolate)) + !promise + ->HasPrivate(currentContext, hooks->async_id_symbol.Get(isolate)) .ToChecked()); - promise->SetPrivate(currentContext, hooks->async_id_smb.Get(isolate), + promise->SetPrivate(currentContext, hooks->async_id_symbol.Get(isolate), async_id); if (parent->IsPromise()) { Local<Promise> parent_promise = parent.As<Promise>(); Local<Value> parent_async_id = parent_promise - ->GetPrivate(currentContext, hooks->async_id_smb.Get(isolate)) + ->GetPrivate(currentContext, + hooks->async_id_symbol.Get(isolate)) .ToLocalChecked(); - promise->SetPrivate(currentContext, hooks->trigger_id_smb.Get(isolate), + promise->SetPrivate(currentContext, + hooks->trigger_id_symbol.Get(isolate), parent_async_id); } else { CHECK(parent->IsUndefined()); - promise->SetPrivate(currentContext, hooks->trigger_id_smb.Get(isolate), + promise->SetPrivate(currentContext, + hooks->trigger_id_symbol.Get(isolate), Integer::New(isolate, 0)); } } else if (type == PromiseHookType::kBefore) { AsyncContext ctx; ctx.execution_async_id = - promise->GetPrivate(currentContext, hooks->async_id_smb.Get(isolate)) + promise + ->GetPrivate(currentContext, hooks->async_id_symbol.Get(isolate)) .ToLocalChecked() .As<Integer>() ->Value(); ctx.trigger_async_id = promise - ->GetPrivate(currentContext, hooks->trigger_id_smb.Get(isolate)) + ->GetPrivate(currentContext, + hooks->trigger_id_symbol.Get(isolate)) .ToLocalChecked() .As<Integer>() ->Value(); @@ -244,12 +251,13 @@ void AsyncHooks::PromiseHookDispatch(PromiseHookType type, AsyncHooks* hooks) { if (!wrap.IsEnabled()) return; v8::Isolate* v8_isolate = hooks->isolate_; + if (v8_isolate->IsExecutionTerminating()) return; HandleScope handle_scope(v8_isolate); Local<Value> rcv = Undefined(v8_isolate); Local<Context> context = v8_isolate->GetCurrentContext(); Local<Value> async_id = - promise->GetPrivate(context, hooks->async_id_smb.Get(v8_isolate)) + promise->GetPrivate(context, hooks->async_id_symbol.Get(v8_isolate)) .ToLocalChecked(); Local<Value> args[1] = {async_id}; @@ -258,7 +266,8 @@ void AsyncHooks::PromiseHookDispatch(PromiseHookType type, if (!wrap.init_function().IsEmpty()) { Local<Value> initArgs[4] = { async_id, String::NewFromUtf8Literal(v8_isolate, "PROMISE"), - promise->GetPrivate(context, hooks->trigger_id_smb.Get(v8_isolate)) + promise + ->GetPrivate(context, hooks->trigger_id_symbol.Get(v8_isolate)) .ToLocalChecked(), promise}; USE(wrap.init_function()->Call(context, rcv, 4, initArgs)); |