From b8b3e75cb1eec63381fbb85a53f8184886873814 Mon Sep 17 00:00:00 2001 From: Camillo Bruni Date: Tue, 6 Jul 2021 10:25:24 +0200 Subject: [PATCH] [runtime] Add debugger RCS scopes Add and use two new RCS scopes: - RuntimeCallCounterId::kDebugger - RuntimeCallCounterId::kDebuggerCallback Change-Id: Ifd326424248948d0d5c1e0e29cacaecc92046e88 Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3006415 Reviewed-by: Victor Gomes Reviewed-by: Benedikt Meurer Commit-Queue: Camillo Bruni Cr-Commit-Position: refs/heads/master@{#75583} --- src/debug/debug.cc | 112 +++++++++++++++++++++++++++---- src/logging/runtime-call-stats.h | 12 ++-- 2 files changed, 105 insertions(+), 19 deletions(-) diff --git a/src/debug/debug.cc b/src/debug/debug.cc index dc19f1aebd..b3ea85d8ee 100644 --- a/src/debug/debug.cc +++ b/src/debug/debug.cc @@ -30,6 +30,7 @@ #include "src/interpreter/bytecode-array-iterator.h" #include "src/interpreter/interpreter.h" #include "src/logging/counters.h" +#include "src/logging/runtime-call-stats-scope.h" #include "src/objects/api-callbacks-inl.h" #include "src/objects/debug-objects-inl.h" #include "src/objects/js-generator-inl.h" @@ -433,6 +434,7 @@ DebugInfoListNode::~DebugInfoListNode() { } void Debug::Unload() { + RCS_SCOPE(isolate_, RuntimeCallCounterId::kDebugger); ClearAllBreakPoints(); ClearStepping(); RemoveAllCoverageInfos(); @@ -441,6 +443,7 @@ void Debug::Unload() { } void Debug::Break(JavaScriptFrame* frame, Handle break_target) { + RCS_SCOPE(isolate_, RuntimeCallCounterId::kDebugger); // Just continue if breaks are disabled or debugger cannot be loaded. if (break_disabled()) return; @@ -554,6 +557,7 @@ void Debug::Break(JavaScriptFrame* frame, Handle break_target) { MaybeHandle Debug::CheckBreakPoints(Handle debug_info, BreakLocation* location, bool* has_break_points) { + RCS_SCOPE(isolate_, RuntimeCallCounterId::kDebugger); bool has_break_points_to_check = break_points_active_ && location->HasBreakPoint(isolate_, debug_info); if (has_break_points) *has_break_points = has_break_points_to_check; @@ -563,6 +567,7 @@ MaybeHandle Debug::CheckBreakPoints(Handle debug_info, } bool Debug::IsMutedAtCurrentLocation(JavaScriptFrame* frame) { + RCS_SCOPE(isolate_, RuntimeCallCounterId::kDebugger); HandleScope scope(isolate_); // A break location is considered muted if break locations on the current // statement have at least one break point, and all of these break points @@ -591,6 +596,7 @@ bool Debug::IsMutedAtCurrentLocation(JavaScriptFrame* frame) { // Check whether a single break point object is triggered. bool Debug::CheckBreakPoint(Handle break_point, bool is_break_at_entry) { + RCS_SCOPE(isolate_, RuntimeCallCounterId::kDebugger); HandleScope scope(isolate_); if (!break_point->condition().length()) return true; @@ -622,6 +628,7 @@ bool Debug::CheckBreakPoint(Handle break_point, bool Debug::SetBreakpoint(Handle shared, Handle break_point, int* source_position) { + RCS_SCOPE(isolate_, RuntimeCallCounterId::kDebugger); HandleScope scope(isolate_); // Make sure the function is compiled and has set up the debug info. @@ -648,6 +655,7 @@ bool Debug::SetBreakpoint(Handle shared, bool Debug::SetBreakPointForScript(Handle