From c08750275882f1472f7ff2a98916f857a0857dc6 Mon Sep 17 00:00:00 2001 From: Ali Ijaz Sheikh Date: Wed, 18 Oct 2017 15:19:43 -0700 Subject: deps: V8: backport b1cd96e from upstream Original commit message: [inspector] added V8InspectorClient::maxAsyncCallStackDepthChanged R=dgozman@chromium.org Bug: none Cq-Include-Trybots: master.tryserver.blink:linux_trusty_blink_rel;master.tryserver.chromium.linux:linux_chromium_rel_ng Change-Id: I0fa10978266feb3c3907ce1f3386ae7a34a33582 Reviewed-on: https://chromium-review.googlesource.com/726490 Reviewed-by: Dmitry Gozman Commit-Queue: Aleksey Kozyatinskiy Cr-Commit-Position: refs/heads/master@{#48705} PR-URL: https://github.com/nodejs/node/pull/16308 Refs: https://github.com/v8/v8/commit/b1cd96ec4b836348bcffba357cd29076ab3ae48b Reviewed-By: Eugene Ostroukhov Reviewed-By: Refael Ackermann Reviewed-By: James M Snell Reviewed-By: Ben Noordhuis Reviewed-By: Timothy Gu --- .../max-async-call-stack-depth-changed-expected.txt | 5 +++++ .../debugger/max-async-call-stack-depth-changed.js | 16 ++++++++++++++++ deps/v8/test/inspector/inspector-test.cc | 15 +++++++++++++++ deps/v8/test/inspector/isolate-data.cc | 9 +++++++++ deps/v8/test/inspector/isolate-data.h | 3 +++ 5 files changed, 48 insertions(+) create mode 100644 deps/v8/test/inspector/debugger/max-async-call-stack-depth-changed-expected.txt create mode 100644 deps/v8/test/inspector/debugger/max-async-call-stack-depth-changed.js (limited to 'deps/v8/test/inspector') 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 0000000000..0f94b592e0 --- /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 0000000000..2d58539810 --- /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 dcaf5823ef..de89271fbf 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)); @@ -486,6 +490,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 82a5cc0483..4c1d81670f 100644 --- a/deps/v8/test/inspector/isolate-data.cc +++ b/deps/v8/test/inspector/isolate-data.cc @@ -370,6 +370,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(); @@ -396,3 +400,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 b8f3b9e76c..455b44b49b 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); @@ -106,6 +107,7 @@ class IsolateData : public v8_inspector::V8InspectorClient { unsigned lineNumber, unsigned columnNumber, v8_inspector::V8StackTrace*) override; bool isInspectableHeapObject(v8::Local) override; + void maxAsyncCallStackDepthChanged(int depth) override; TaskRunner* task_runner_; SetupGlobalTasks setup_global_tasks_; @@ -123,6 +125,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; v8::Global not_inspectable_private_; DISALLOW_COPY_AND_ASSIGN(IsolateData); -- cgit v1.2.3