OLD | NEW |
---|---|
1 // Copyright 2016 the V8 project authors. All rights reserved. | 1 // Copyright 2016 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "src/inspector/V8Debugger.h" | 5 #include "src/inspector/V8Debugger.h" |
6 | 6 |
7 #include "src/inspector/DebuggerScript.h" | 7 #include "src/inspector/DebuggerScript.h" |
8 #include "src/inspector/ScriptBreakpoint.h" | 8 #include "src/inspector/ScriptBreakpoint.h" |
9 #include "src/inspector/StringUtil.h" | 9 #include "src/inspector/StringUtil.h" |
10 #include "src/inspector/V8DebuggerAgentImpl.h" | 10 #include "src/inspector/V8DebuggerAgentImpl.h" |
(...skipping 632 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
643 if (!m_maxAsyncCallStackDepth) return; | 643 if (!m_maxAsyncCallStackDepth) return; |
644 | 644 |
645 String16 type = toProtocolStringWithTypeCheck( | 645 String16 type = toProtocolStringWithTypeCheck( |
646 callInternalGetterFunction(eventData, "type")); | 646 callInternalGetterFunction(eventData, "type")); |
647 String16 name = toProtocolStringWithTypeCheck( | 647 String16 name = toProtocolStringWithTypeCheck( |
648 callInternalGetterFunction(eventData, "name")); | 648 callInternalGetterFunction(eventData, "name")); |
649 int id = callInternalGetterFunction(eventData, "id") | 649 int id = callInternalGetterFunction(eventData, "id") |
650 ->ToInteger(context) | 650 ->ToInteger(context) |
651 .ToLocalChecked() | 651 .ToLocalChecked() |
652 ->Value(); | 652 ->Value(); |
653 // The scopes for the ids are defined by the eventData.name namespaces. There | 653 // Async task events from Promises are given misaligned pointers to prevent |
654 // are currently two namespaces: "Object." and "Promise.". | 654 // from overlapping with other Blink task identifiers. There is a single |
655 void* ptr = reinterpret_cast<void*>(id * 4 + (name[0] == 'P' ? 2 : 0) + 1); | 655 // namespace of such ids, managed by src/js/promise.js. |
656 void* ptr = reinterpret_cast<void*>(id * 2 + 1); | |
adamk
2016/09/20 22:20:03
This used to be
id * 4 + 3
now it's
id * 2 + 1
Dan Ehrenberg
2016/09/20 22:21:58
They were all given odd numbers. It used to altern
| |
656 if (type == v8AsyncTaskEventEnqueue) | 657 if (type == v8AsyncTaskEventEnqueue) |
657 asyncTaskScheduled(name, ptr, false); | 658 asyncTaskScheduled(name, ptr, false); |
658 else if (type == v8AsyncTaskEventWillHandle) | 659 else if (type == v8AsyncTaskEventWillHandle) |
659 asyncTaskStarted(ptr); | 660 asyncTaskStarted(ptr); |
660 else if (type == v8AsyncTaskEventDidHandle) | 661 else if (type == v8AsyncTaskEventDidHandle) |
661 asyncTaskFinished(ptr); | 662 asyncTaskFinished(ptr); |
662 else | 663 else |
663 UNREACHABLE(); | 664 UNREACHABLE(); |
664 } | 665 } |
665 | 666 |
(...skipping 309 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
975 | 976 |
976 size_t stackSize = | 977 size_t stackSize = |
977 fullStack ? V8StackTraceImpl::maxCallStackSizeToCapture : 1; | 978 fullStack ? V8StackTraceImpl::maxCallStackSizeToCapture : 1; |
978 if (m_inspector->enabledRuntimeAgentForGroup(contextGroupId)) | 979 if (m_inspector->enabledRuntimeAgentForGroup(contextGroupId)) |
979 stackSize = V8StackTraceImpl::maxCallStackSizeToCapture; | 980 stackSize = V8StackTraceImpl::maxCallStackSizeToCapture; |
980 | 981 |
981 return V8StackTraceImpl::capture(this, contextGroupId, stackSize); | 982 return V8StackTraceImpl::capture(this, contextGroupId, stackSize); |
982 } | 983 } |
983 | 984 |
984 } // namespace v8_inspector | 985 } // namespace v8_inspector |
OLD | NEW |