diff --git a/deps/v8/include/v8-inspector.h b/deps/v8/include/v8-inspector.h index 43bf3b4f60b1c8..d0bb9b47fe4d69 100644 --- a/deps/v8/include/v8-inspector.h +++ b/deps/v8/include/v8-inspector.h @@ -211,6 +211,8 @@ class V8_EXPORT V8InspectorClient { // TODO(dgozman): this was added to support service worker shadow page. We // should not connect at all. virtual bool canExecuteScripts(int contextGroupId) { return true; } + + virtual void maxAsyncCallStackDepthChanged(int depth) {} }; class V8_EXPORT V8Inspector { diff --git a/deps/v8/include/v8-version.h b/deps/v8/include/v8-version.h index 459646b5a4844e..a7b8401025d8d3 100644 --- a/deps/v8/include/v8-version.h +++ b/deps/v8/include/v8-version.h @@ -11,7 +11,7 @@ #define V8_MAJOR_VERSION 6 #define V8_MINOR_VERSION 1 #define V8_BUILD_NUMBER 534 -#define V8_PATCH_LEVEL 45 +#define V8_PATCH_LEVEL 46 // Use 1 for candidates and 0 otherwise. // (Boolean macro values are not supported by all preprocessors.) diff --git a/deps/v8/src/inspector/v8-debugger.cc b/deps/v8/src/inspector/v8-debugger.cc index 03bf57cf7d2822..7356cb48d2c434 100644 --- a/deps/v8/src/inspector/v8-debugger.cc +++ b/deps/v8/src/inspector/v8-debugger.cc @@ -965,6 +965,8 @@ void V8Debugger::setAsyncCallStackDepth(V8DebuggerAgentImpl* agent, int depth) { if (m_maxAsyncCallStackDepth == maxAsyncCallStackDepth) return; // TODO(dgozman): ideally, this should be per context group. m_maxAsyncCallStackDepth = maxAsyncCallStackDepth; + m_inspector->client()->maxAsyncCallStackDepthChanged( + m_maxAsyncCallStackDepth); if (!maxAsyncCallStackDepth) allAsyncTasksCanceled(); } diff --git a/deps/v8/test/inspector/debugger/max-async-call-stack-depth-changed-expected.txt b/deps/v8/test/inspector/debugger/max-async-call-stack-depth-changed-expected.txt new file mode 100644 index 00000000000000..0f94b592e02fc3 --- /dev/null +++ b/deps/v8/test/inspector/debugger/max-async-call-stack-depth-changed-expected.txt @@ -0,0 +1,5 @@ +Tests for max async call stack depth changed. +maxAsyncCallStackDepthChanged: 8 +maxAsyncCallStackDepthChanged: 0 +maxAsyncCallStackDepthChanged: 8 +maxAsyncCallStackDepthChanged: 0 diff --git a/deps/v8/test/inspector/debugger/max-async-call-stack-depth-changed.js b/deps/v8/test/inspector/debugger/max-async-call-stack-depth-changed.js new file mode 100644 index 00000000000000..2d5853981087a1 --- /dev/null +++ b/deps/v8/test/inspector/debugger/max-async-call-stack-depth-changed.js @@ -0,0 +1,16 @@ +// Copyright 2017 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +let {session, contextGroup, Protocol} = + InspectorTest.start('Tests for max async call stack depth changed.'); + +(async function test(){ + utils.setLogMaxAsyncCallStackDepthChanged(true); + await Protocol.Debugger.enable(); + await Protocol.Debugger.setAsyncCallStackDepth({maxDepth: 8}); + await Protocol.Debugger.setAsyncCallStackDepth({maxDepth: 0}); + await Protocol.Debugger.setAsyncCallStackDepth({maxDepth: 8}); + await Protocol.Debugger.disable(); + InspectorTest.completeTest(); +})(); diff --git a/deps/v8/test/inspector/inspector-test.cc b/deps/v8/test/inspector/inspector-test.cc index 767168b29769b8..4c133cee1fc36c 100644 --- a/deps/v8/test/inspector/inspector-test.cc +++ b/deps/v8/test/inspector/inspector-test.cc @@ -299,6 +299,10 @@ class UtilsExtension : public IsolateData::SetupGlobalTask { utils->Set(ToV8String(isolate, "setLogConsoleApiMessageCalls"), v8::FunctionTemplate::New( isolate, &UtilsExtension::SetLogConsoleApiMessageCalls)); + utils->Set( + ToV8String(isolate, "setLogMaxAsyncCallStackDepthChanged"), + v8::FunctionTemplate::New( + isolate, &UtilsExtension::SetLogMaxAsyncCallStackDepthChanged)); utils->Set(ToV8String(isolate, "createContextGroup"), v8::FunctionTemplate::New(isolate, &UtilsExtension::CreateContextGroup)); @@ -485,6 +489,17 @@ class UtilsExtension : public IsolateData::SetupGlobalTask { args[0].As()->Value()); } + static void SetLogMaxAsyncCallStackDepthChanged( + const v8::FunctionCallbackInfo& args) { + if (args.Length() != 1 || !args[0]->IsBoolean()) { + fprintf(stderr, + "Internal error: setLogMaxAsyncCallStackDepthChanged(bool)."); + Exit(); + } + backend_runner_->data()->SetLogMaxAsyncCallStackDepthChanged( + args[0].As()->Value()); + } + static void CreateContextGroup( const v8::FunctionCallbackInfo& args) { if (args.Length() != 0) { diff --git a/deps/v8/test/inspector/isolate-data.cc b/deps/v8/test/inspector/isolate-data.cc index bd97a927e89085..2e9a64f66deef4 100644 --- a/deps/v8/test/inspector/isolate-data.cc +++ b/deps/v8/test/inspector/isolate-data.cc @@ -355,6 +355,10 @@ void IsolateData::SetLogConsoleApiMessageCalls(bool log) { log_console_api_message_calls_ = log; } +void IsolateData::SetLogMaxAsyncCallStackDepthChanged(bool log) { + log_max_async_call_stack_depth_changed_ = log; +} + v8::MaybeLocal IsolateData::memoryInfo(v8::Isolate* isolate, v8::Local) { if (memory_info_.IsEmpty()) return v8::MaybeLocal(); @@ -381,3 +385,8 @@ void IsolateData::consoleAPIMessage(int contextGroupId, Print(isolate_, stack->toString()->string()); fprintf(stdout, "\n"); } + +void IsolateData::maxAsyncCallStackDepthChanged(int depth) { + if (!log_max_async_call_stack_depth_changed_) return; + fprintf(stdout, "maxAsyncCallStackDepthChanged: %d\n", depth); +} diff --git a/deps/v8/test/inspector/isolate-data.h b/deps/v8/test/inspector/isolate-data.h index c96a8d1bbd2bf8..af2bf0ef1e2846 100644 --- a/deps/v8/test/inspector/isolate-data.h +++ b/deps/v8/test/inspector/isolate-data.h @@ -64,6 +64,7 @@ class IsolateData : public v8_inspector::V8InspectorClient { void SetCurrentTimeMS(double time); void SetMemoryInfo(v8::Local memory_info); void SetLogConsoleApiMessageCalls(bool log); + void SetLogMaxAsyncCallStackDepthChanged(bool log); void SetMaxAsyncTaskStacksForTest(int limit); void DumpAsyncTaskStacksStateForTest(); void FireContextCreated(v8::Local context, int context_group_id); @@ -105,6 +106,7 @@ class IsolateData : public v8_inspector::V8InspectorClient { const v8_inspector::StringView& url, unsigned lineNumber, unsigned columnNumber, v8_inspector::V8StackTrace*) override; + void maxAsyncCallStackDepthChanged(int depth) override; TaskRunner* task_runner_; SetupGlobalTasks setup_global_tasks_; @@ -122,6 +124,7 @@ class IsolateData : public v8_inspector::V8InspectorClient { bool current_time_set_ = false; double current_time_ = 0.0; bool log_console_api_message_calls_ = false; + bool log_max_async_call_stack_depth_changed_ = false; DISALLOW_COPY_AND_ASSIGN(IsolateData); };