Commit ba2d0019 authored by Simon Zünd's avatar Simon Zünd Committed by Commit Bot

Add trace events for stack trace capturing and symbolization

R=petermarshall@chromium.org, yangguo@chromium.org

Change-Id: I3d1cb354f6aeae10fda56f4c51bcb43c9fa5462c
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2491028Reviewed-by: 's avatarPeter Marshall <petermarshall@chromium.org>
Commit-Queue: Simon Zünd <szuend@chromium.org>
Cr-Commit-Position: refs/heads/master@{#70710}
parent bc0bfbe8
......@@ -1020,6 +1020,9 @@ Handle<Object> CaptureStackTrace(Isolate* isolate, Handle<Object> caller,
CaptureStackTraceOptions options) {
DisallowJavascriptExecution no_js(isolate);
TRACE_EVENT_BEGIN1(TRACE_DISABLED_BY_DEFAULT("v8.stack_trace"),
"CaptureStackTrace", "maxFrameCount", options.limit);
wasm::WasmCodeRefScope code_ref_scope;
FrameArrayBuilder builder(isolate, options.skip_mode, options.limit, caller,
options.filter_mode);
......@@ -1141,7 +1144,10 @@ Handle<Object> CaptureStackTrace(Isolate* isolate, Handle<Object> caller,
}
}
return builder.GetElementsAsStackTraceFrameArray();
Handle<FixedArray> stack_trace = builder.GetElementsAsStackTraceFrameArray();
TRACE_EVENT_END1(TRACE_DISABLED_BY_DEFAULT("v8.stack_trace"),
"CaptureStackTrace", "frameCount", stack_trace->length());
return stack_trace;
}
} // namespace
......
......@@ -9,6 +9,7 @@
#include "../../third_party/inspector_protocol/crdtp/json.h"
#include "src/inspector/v8-debugger.h"
#include "src/inspector/v8-inspector-impl.h"
#include "src/tracing/trace-event.h"
using v8_crdtp::SpanFrom;
using v8_crdtp::json::ConvertCBORToJSON;
......@@ -34,6 +35,10 @@ std::vector<std::shared_ptr<StackFrame>> toFramesVector(
int maxStackSize) {
DCHECK(debugger->isolate()->InContext());
int frameCount = std::min(v8StackTrace->GetFrameCount(), maxStackSize);
TRACE_EVENT1(TRACE_DISABLED_BY_DEFAULT("v8.stack_trace"),
"SymbolizeStackTrace", "frameCount", frameCount);
std::vector<std::shared_ptr<StackFrame>> frames(frameCount);
for (int i = 0; i < frameCount; ++i) {
frames[i] =
......@@ -253,6 +258,10 @@ std::unique_ptr<V8StackTraceImpl> V8StackTraceImpl::create(
std::unique_ptr<V8StackTraceImpl> V8StackTraceImpl::capture(
V8Debugger* debugger, int contextGroupId, int maxStackSize) {
DCHECK(debugger);
TRACE_EVENT1(TRACE_DISABLED_BY_DEFAULT("v8.stack_trace"),
"V8StackTraceImpl::capture", "maxFrameCount", maxStackSize);
v8::Isolate* isolate = debugger->isolate();
v8::HandleScope handleScope(isolate);
v8::Local<v8::StackTrace> v8StackTrace;
......@@ -404,6 +413,9 @@ std::shared_ptr<AsyncStackTrace> AsyncStackTrace::capture(
int maxStackSize) {
DCHECK(debugger);
TRACE_EVENT1(TRACE_DISABLED_BY_DEFAULT("v8.stack_trace"),
"AsyncStackTrace::capture", "maxFrameCount", maxStackSize);
v8::Isolate* isolate = debugger->isolate();
v8::HandleScope handleScope(isolate);
......
......@@ -196,6 +196,9 @@ Handle<StackFrameInfo> StackTraceFrame::GetFrameInfo(
// static
void StackTraceFrame::InitializeFrameInfo(Handle<StackTraceFrame> frame) {
TRACE_EVENT1(TRACE_DISABLED_BY_DEFAULT("v8.stack_trace"),
"SymbolizeStackFrame", "frameIndex", frame->frame_index());
Isolate* isolate = frame->GetIsolate();
Handle<StackFrameInfo> frame_info = isolate->factory()->NewStackFrameInfo(
handle(FrameArray::cast(frame->frame_array()), isolate),
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment