From 5a4f8a08e8cbd9334a2bc88f3bb20c6b5bf729db Mon Sep 17 00:00:00 2001 From: Benedikt Meurer Date: Wed, 14 Jul 2021 14:21:31 +0200 Subject: [PATCH] [cleanup] Fix DebugBreakType enum. The order of the enum values is important for the BreakLocation predicates. This wasn't an issue so far, since the DEBUG_BREAK_AT_ENTRY case is anyways treated separately, but for the future I've added a comment and fixed the order. Drive-by-fix: Remove the useless `inline` markers on the predicates. Bug: chromium:1162229, chromium:700516 Change-Id: I05653ac9b5ea225e30c5c2beeff809b8848c2ec7 Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3026712 Auto-Submit: Benedikt Meurer Commit-Queue: Yang Guo Reviewed-by: Yang Guo Cr-Commit-Position: refs/heads/master@{#75736} --- src/debug/debug.h | 29 ++++++++++++----------------- 1 file changed, 12 insertions(+), 17 deletions(-) diff --git a/src/debug/debug.h b/src/debug/debug.h index 31d603e0dd..42c89c2c98 100644 --- a/src/debug/debug.h +++ b/src/debug/debug.h @@ -42,14 +42,16 @@ enum StepAction : int8_t { // Type of exception break. NOTE: These values are in macros.py as well. enum ExceptionBreakType { BreakException = 0, BreakUncaughtException = 1 }; +// Type of debug break. NOTE: The order matters for the predicates +// below inside BreakLocation, so be careful when adding / removing. enum DebugBreakType { NOT_DEBUG_BREAK, DEBUGGER_STATEMENT, + DEBUG_BREAK_AT_ENTRY, DEBUG_BREAK_SLOT, DEBUG_BREAK_SLOT_AT_CALL, DEBUG_BREAK_SLOT_AT_RETURN, DEBUG_BREAK_SLOT_AT_SUSPEND, - DEBUG_BREAK_AT_ENTRY, }; enum IgnoreBreakMode { @@ -67,25 +69,18 @@ class BreakLocation { JavaScriptFrame* frame, std::vector* result_out); - inline bool IsSuspend() const { return type_ == DEBUG_BREAK_SLOT_AT_SUSPEND; } - inline bool IsReturn() const { return type_ == DEBUG_BREAK_SLOT_AT_RETURN; } - inline bool IsReturnOrSuspend() const { - return type_ >= DEBUG_BREAK_SLOT_AT_RETURN; - } - inline bool IsCall() const { return type_ == DEBUG_BREAK_SLOT_AT_CALL; } - inline bool IsDebugBreakSlot() const { return type_ >= DEBUG_BREAK_SLOT; } - inline bool IsDebuggerStatement() const { - return type_ == DEBUGGER_STATEMENT; - } - inline bool IsDebugBreakAtEntry() const { - bool result = type_ == DEBUG_BREAK_AT_ENTRY; - return result; - } + bool IsSuspend() const { return type_ == DEBUG_BREAK_SLOT_AT_SUSPEND; } + bool IsReturn() const { return type_ == DEBUG_BREAK_SLOT_AT_RETURN; } + bool IsReturnOrSuspend() const { return type_ >= DEBUG_BREAK_SLOT_AT_RETURN; } + bool IsCall() const { return type_ == DEBUG_BREAK_SLOT_AT_CALL; } + bool IsDebugBreakSlot() const { return type_ >= DEBUG_BREAK_SLOT; } + bool IsDebuggerStatement() const { return type_ == DEBUGGER_STATEMENT; } + bool IsDebugBreakAtEntry() const { return type_ == DEBUG_BREAK_AT_ENTRY; } bool HasBreakPoint(Isolate* isolate, Handle debug_info) const; - inline int generator_suspend_id() { return generator_suspend_id_; } - inline int position() const { return position_; } + int generator_suspend_id() { return generator_suspend_id_; } + int position() const { return position_; } debug::BreakLocationType type() const;