Commit ef65e936 authored by Yang Guo's avatar Yang Guo Committed by V8 LUCI CQ

[debug] skip some work when exception events are not enabled

Bug: none
Change-Id: I95060382c0e10a252f1cec7b2d2c4b44f757b5f2
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3003154
Commit-Queue: Yang Guo <yangguo@chromium.org>
Commit-Queue: Benedikt Meurer <bmeurer@chromium.org>
Auto-Submit: Yang Guo <yangguo@chromium.org>
Reviewed-by: 's avatarBenedikt Meurer <bmeurer@chromium.org>
Cr-Commit-Position: refs/heads/master@{#75552}
parent 969e1c5e
...@@ -1967,6 +1967,17 @@ bool Debug::IsFrameBlackboxed(JavaScriptFrame* frame) { ...@@ -1967,6 +1967,17 @@ bool Debug::IsFrameBlackboxed(JavaScriptFrame* frame) {
void Debug::OnException(Handle<Object> exception, Handle<Object> promise, void Debug::OnException(Handle<Object> exception, Handle<Object> promise,
v8::debug::ExceptionType exception_type) { v8::debug::ExceptionType exception_type) {
// Do not trigger exception event on stack overflow. We cannot perform
// anything useful for debugging in that situation.
StackLimitCheck stack_limit_check(isolate_);
if (stack_limit_check.JsHasOverflowed()) return;
// Return if the event has nowhere to go.
if (!debug_delegate_) return;
// Return if we are not interested in exception events.
if (!break_on_exception_ && !break_on_uncaught_exception_) return;
Isolate::CatchType catch_type = isolate_->PredictExceptionCatcher(); Isolate::CatchType catch_type = isolate_->PredictExceptionCatcher();
// Don't notify listener of exceptions that are internal to a desugaring. // Don't notify listener of exceptions that are internal to a desugaring.
...@@ -1989,15 +2000,11 @@ void Debug::OnException(Handle<Object> exception, Handle<Object> promise, ...@@ -1989,15 +2000,11 @@ void Debug::OnException(Handle<Object> exception, Handle<Object> promise,
} }
} }
if (!debug_delegate_) return; // Return if the exception is caught and we only care about uncaught
// exceptions.
// Bail out if exception breaks are not active if (!uncaught && !break_on_exception_) {
if (uncaught) { DCHECK(break_on_uncaught_exception_);
// Uncaught exceptions are reported by either flags. return;
if (!(break_on_uncaught_exception_ || break_on_exception_)) return;
} else {
// Caught exceptions are reported is activated.
if (!break_on_exception_) return;
} }
{ {
...@@ -2010,11 +2017,6 @@ void Debug::OnException(Handle<Object> exception, Handle<Object> promise, ...@@ -2010,11 +2017,6 @@ void Debug::OnException(Handle<Object> exception, Handle<Object> promise,
if (it.done()) return; // Do not trigger an event with an empty stack. if (it.done()) return; // Do not trigger an event with an empty stack.
} }
// Do not trigger exception event on stack overflow. We cannot perform
// anything useful for debugging in that situation.
StackLimitCheck stack_limit_check(isolate_);
if (stack_limit_check.JsHasOverflowed()) return;
DebugScope debug_scope(this); DebugScope debug_scope(this);
HandleScope scope(isolate_); HandleScope scope(isolate_);
DisableBreak no_recursive_break(this); DisableBreak no_recursive_break(this);
......
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