| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 88fb359 commit c087502
8 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -27,7 +27,7 @@ | |||
| 27 | 27 | ||
| 28 | 28 | # Reset this number to 0 on major V8 upgrades. | |
| 29 | 29 | # Increment by one for each non-official patch applied to deps/v8. | |
| 30 | - 'v8_embedder_string': '-node.7', | ||
| 30 | + 'v8_embedder_string': '-node.8', | ||
| 31 | 31 | ||
| 32 | 32 | # Enable disassembler for `--print-code` v8 options | |
| 33 | 33 | 'v8_enable_disassembler': 1, | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -211,6 +211,8 @@ class V8_EXPORT V8InspectorClient { | |||
| 211 | 211 | // TODO(dgozman): this was added to support service worker shadow page. We | |
| 212 | 212 | // should not connect at all. | |
| 213 | 213 | virtual bool canExecuteScripts(int contextGroupId) { return true; } | |
| 214 | + | ||
| 215 | + virtual void maxAsyncCallStackDepthChanged(int depth) {} | ||
| 214 | 216 | }; | |
| 215 | 217 | ||
| 216 | 218 | class V8_EXPORT V8Inspector { | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -726,6 +726,8 @@ void V8Debugger::setAsyncCallStackDepth(V8DebuggerAgentImpl* agent, int depth) { | |||
| 726 | 726 | if (m_maxAsyncCallStackDepth == maxAsyncCallStackDepth) return; | |
| 727 | 727 | // TODO(dgozman): ideally, this should be per context group. | |
| 728 | 728 | m_maxAsyncCallStackDepth = maxAsyncCallStackDepth; | |
| 729 | + m_inspector->client()->maxAsyncCallStackDepthChanged( | ||
| 730 | + m_maxAsyncCallStackDepth); | ||
| 729 | 731 | if (!maxAsyncCallStackDepth) allAsyncTasksCanceled(); | |
| 730 | 732 | } | |
| 731 | 733 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1,5 @@ | |||
| 1 | + Tests for max async call stack depth changed. | ||
| 2 | + maxAsyncCallStackDepthChanged: 8 | ||
| 3 | + maxAsyncCallStackDepthChanged: 0 | ||
| 4 | + maxAsyncCallStackDepthChanged: 8 | ||
| 5 | + maxAsyncCallStackDepthChanged: 0 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1,16 @@ | |||
| 1 | + // Copyright 2017 the V8 project authors. All rights reserved. | ||
| 2 | + // Use of this source code is governed by a BSD-style license that can be | ||
| 3 | + // found in the LICENSE file. | ||
| 4 | + | ||
| 5 | + let {session, contextGroup, Protocol} = | ||
| 6 | + InspectorTest.start('Tests for max async call stack depth changed.'); | ||
| 7 | + | ||
| 8 | + (async function test(){ | ||
| 9 | + utils.setLogMaxAsyncCallStackDepthChanged(true); | ||
| 10 | + await Protocol.Debugger.enable(); | ||
| 11 | + await Protocol.Debugger.setAsyncCallStackDepth({maxDepth: 8}); | ||
| 12 | + await Protocol.Debugger.setAsyncCallStackDepth({maxDepth: 0}); | ||
| 13 | + await Protocol.Debugger.setAsyncCallStackDepth({maxDepth: 8}); | ||
| 14 | + await Protocol.Debugger.disable(); | ||
| 15 | + InspectorTest.completeTest(); | ||
| 16 | + })(); | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -299,6 +299,10 @@ class UtilsExtension : public IsolateData::SetupGlobalTask { | |||
| 299 | 299 | utils->Set(ToV8String(isolate, "setLogConsoleApiMessageCalls"), | |
| 300 | 300 | v8::FunctionTemplate::New( | |
| 301 | 301 | isolate, &UtilsExtension::SetLogConsoleApiMessageCalls)); | |
| 302 | + utils->Set( | ||
| 303 | + ToV8String(isolate, "setLogMaxAsyncCallStackDepthChanged"), | ||
| 304 | + v8::FunctionTemplate::New( | ||
| 305 | + isolate, &UtilsExtension::SetLogMaxAsyncCallStackDepthChanged)); | ||
| 302 | 306 | utils->Set(ToV8String(isolate, "createContextGroup"), | |
| 303 | 307 | v8::FunctionTemplate::New(isolate, | |
| 304 | 308 | &UtilsExtension::CreateContextGroup)); | |
@@ -486,6 +490,17 @@ class UtilsExtension : public IsolateData::SetupGlobalTask { | |||
| 486 | 490 | args[0].As<v8::Boolean>()->Value()); | |
| 487 | 491 | } | |
| 488 | 492 | ||
| 493 | + static void SetLogMaxAsyncCallStackDepthChanged( | ||
| 494 | + const v8::FunctionCallbackInfo<v8::Value>& args) { | ||
| 495 | + if (args.Length() != 1 || !args[0]->IsBoolean()) { | ||
| 496 | + fprintf(stderr, | ||
| 497 | + "Internal error: setLogMaxAsyncCallStackDepthChanged(bool)."); | ||
| 498 | + Exit(); | ||
| 499 | + } | ||
| 500 | + backend_runner_->data()->SetLogMaxAsyncCallStackDepthChanged( | ||
| 501 | + args[0].As<v8::Boolean>()->Value()); | ||
| 502 | + } | ||
| 503 | + | ||
| 489 | 504 | static void CreateContextGroup( | |
| 490 | 505 | const v8::FunctionCallbackInfo<v8::Value>& args) { | |
| 491 | 506 | if (args.Length() != 0) { | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -370,6 +370,10 @@ void IsolateData::SetLogConsoleApiMessageCalls(bool log) { | |||
| 370 | 370 | log_console_api_message_calls_ = log; | |
| 371 | 371 | } | |
| 372 | 372 | ||
| 373 | + void IsolateData::SetLogMaxAsyncCallStackDepthChanged(bool log) { | ||
| 374 | + log_max_async_call_stack_depth_changed_ = log; | ||
| 375 | + } | ||
| 376 | + | ||
| 373 | 377 | v8::MaybeLocal<v8::Value> IsolateData::memoryInfo(v8::Isolate* isolate, | |
| 374 | 378 | v8::Local<v8::Context>) { | |
| 375 | 379 | if (memory_info_.IsEmpty()) return v8::MaybeLocal<v8::Value>(); | |
@@ -396,3 +400,8 @@ void IsolateData::consoleAPIMessage(int contextGroupId, | |||
| 396 | 400 | Print(isolate_, stack->toString()->string()); | |
| 397 | 401 | fprintf(stdout, "\n"); | |
| 398 | 402 | } | |
| 403 | + | ||
| 404 | + void IsolateData::maxAsyncCallStackDepthChanged(int depth) { | ||
| 405 | + if (!log_max_async_call_stack_depth_changed_) return; | ||
| 406 | + fprintf(stdout, "maxAsyncCallStackDepthChanged: %d\n", depth); | ||
| 407 | + } | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -64,6 +64,7 @@ class IsolateData : public v8_inspector::V8InspectorClient { | |||
| 64 | 64 | void SetCurrentTimeMS(double time); | |
| 65 | 65 | void SetMemoryInfo(v8::Local<v8::Value> memory_info); | |
| 66 | 66 | void SetLogConsoleApiMessageCalls(bool log); | |
| 67 | + void SetLogMaxAsyncCallStackDepthChanged(bool log); | ||
| 67 | 68 | void SetMaxAsyncTaskStacksForTest(int limit); | |
| 68 | 69 | void DumpAsyncTaskStacksStateForTest(); | |
| 69 | 70 | void FireContextCreated(v8::Local<v8::Context> context, int context_group_id); | |
@@ -106,6 +107,7 @@ class IsolateData : public v8_inspector::V8InspectorClient { | |||
| 106 | 107 | unsigned lineNumber, unsigned columnNumber, | |
| 107 | 108 | v8_inspector::V8StackTrace*) override; | |
| 108 | 109 | bool isInspectableHeapObject(v8::Local<v8::Object>) override; | |
| 110 | + void maxAsyncCallStackDepthChanged(int depth) override; | ||
| 109 | 111 | ||
| 110 | 112 | TaskRunner* task_runner_; | |
| 111 | 113 | SetupGlobalTasks setup_global_tasks_; | |
@@ -123,6 +125,7 @@ class IsolateData : public v8_inspector::V8InspectorClient { | |||
| 123 | 125 | bool current_time_set_ = false; | |
| 124 | 126 | double current_time_ = 0.0; | |
| 125 | 127 | bool log_console_api_message_calls_ = false; | |
| 128 | + bool log_max_async_call_stack_depth_changed_ = false; | ||
| 126 | 129 | v8::Global<v8::Private> not_inspectable_private_; | |
| 127 | 130 | ||
| 128 | 131 | DISALLOW_COPY_AND_ASSIGN(IsolateData); | |
| Back | FazBrowse Home | New Git URL |
0 commit comments