Index: src/debug/debug.h |
diff --git a/src/debug/debug.h b/src/debug/debug.h |
index 29b124f92c19d88b7612e168c2c3b90266dfbb0b..a4dbce484f67f0d9d5f9ab595ddf69a648d52cbb 100644 |
--- a/src/debug/debug.h |
+++ b/src/debug/debug.h |
@@ -82,12 +82,8 @@ class BreakLocation { |
bool IsDebugBreak() const; |
- inline bool IsReturn() const { |
- return RelocInfo::IsDebugBreakSlotAtReturn(rmode_); |
- } |
- inline bool IsCall() const { |
- return RelocInfo::IsDebugBreakSlotAtCall(rmode_); |
- } |
+ inline bool IsReturn() const { return type_ == DEBUG_BREAK_SLOT_AT_RETURN; } |
+ inline bool IsCall() const { return type_ == DEBUG_BREAK_SLOT_AT_CALL; } |
inline bool HasBreakPoint() const { |
return debug_info_->HasBreakPoint(code_offset_); |
} |
@@ -100,61 +96,85 @@ class BreakLocation { |
void SetOneShot(); |
void ClearOneShot(); |
- |
- inline RelocInfo rinfo() const { |
- return RelocInfo(debug_info_->GetIsolate(), pc(), rmode(), data_, code()); |
- } |
- |
inline int position() const { return position_; } |
inline int statement_position() const { return statement_position_; } |
inline int code_offset() const { return code_offset_; } |
+ inline Isolate* isolate() { return debug_info_->GetIsolate(); } |
- inline RelocInfo::Mode rmode() const { return rmode_; } |
- |
- inline Code* code() const { return debug_info_->code(); } |
+ inline AbstractCode* abstract_code() const { |
+ return debug_info_->abstract_code(); |
+ } |
private: |
- BreakLocation(Handle<DebugInfo> debug_info, RelocInfo* rinfo, int position, |
- int statement_position); |
+ enum DebugBreakType { |
+ NOT_DEBUG_BREAK, |
+ DEBUGGER_STATEMENT, |
+ DEBUG_BREAK_SLOT, |
+ DEBUG_BREAK_SLOT_AT_CALL, |
+ DEBUG_BREAK_SLOT_AT_RETURN |
+ }; |
+ |
+ BreakLocation(Handle<DebugInfo> debug_info, DebugBreakType type, |
+ int code_offset, int position, int statement_position); |
class Iterator { |
public: |
- Iterator(Handle<DebugInfo> debug_info, BreakLocatorType type); |
- |
- BreakLocation GetBreakLocation() { |
- return BreakLocation(debug_info_, rinfo(), position(), |
- statement_position()); |
- } |
+ virtual ~Iterator() {} |
- inline bool Done() const { return reloc_iterator_.done(); } |
- void Next(); |
+ virtual BreakLocation GetBreakLocation() = 0; |
+ virtual bool Done() const = 0; |
+ virtual void Next() = 0; |
void SkipTo(int count) { |
while (count-- > 0) Next(); |
} |
- inline RelocInfo::Mode rmode() { return reloc_iterator_.rinfo()->rmode(); } |
- inline RelocInfo* rinfo() { return reloc_iterator_.rinfo(); } |
- inline Address pc() { return rinfo()->pc(); } |
+ virtual int code_offset() = 0; |
int break_index() const { return break_index_; } |
inline int position() const { return position_; } |
inline int statement_position() const { return statement_position_; } |
- private: |
- static int GetModeMask(BreakLocatorType type); |
+ protected: |
+ Iterator(Handle<DebugInfo> debug_info, BreakLocatorType type); |
Handle<DebugInfo> debug_info_; |
- RelocIterator reloc_iterator_; |
int break_index_; |
int position_; |
int statement_position_; |
+ private: |
DisallowHeapAllocation no_gc_; |
- |
DISALLOW_COPY_AND_ASSIGN(Iterator); |
}; |
+ class CodeIterator : public Iterator { |
+ public: |
+ CodeIterator(Handle<DebugInfo> debug_info, BreakLocatorType type); |
+ ~CodeIterator() override{}; |
+ |
+ BreakLocation GetBreakLocation() override; |
+ bool Done() const override { return reloc_iterator_.done(); } |
+ void Next() override; |
+ |
+ int code_offset() override { |
+ return static_cast<int>( |
+ rinfo()->pc() - |
+ debug_info_->abstract_code()->GetCode()->instruction_start()); |
+ } |
+ |
+ private: |
+ static int GetModeMask(BreakLocatorType type); |
+ RelocInfo::Mode rmode() { return reloc_iterator_.rinfo()->rmode(); } |
+ RelocInfo* rinfo() { return reloc_iterator_.rinfo(); } |
+ |
+ RelocIterator reloc_iterator_; |
+ DISALLOW_COPY_AND_ASSIGN(CodeIterator); |
+ }; |
+ |
+ static Iterator* GetIterator(Handle<DebugInfo> debug_info, |
+ BreakLocatorType type = ALL_BREAK_LOCATIONS); |
+ |
friend class Debug; |
static int BreakIndexFromCodeOffset(Handle<DebugInfo> debug_info, int offset); |
@@ -163,18 +183,13 @@ class BreakLocation { |
void ClearDebugBreak(); |
inline bool IsDebuggerStatement() const { |
- return RelocInfo::IsDebuggerStatement(rmode_); |
+ return type_ == DEBUGGER_STATEMENT; |
} |
- inline bool IsDebugBreakSlot() const { |
- return RelocInfo::IsDebugBreakSlot(rmode_); |
- } |
- |
- inline Address pc() const { return code()->entry() + code_offset_; } |
+ inline bool IsDebugBreakSlot() const { return type_ >= DEBUG_BREAK_SLOT; } |
Handle<DebugInfo> debug_info_; |
int code_offset_; |
- RelocInfo::Mode rmode_; |
- intptr_t data_; |
+ DebugBreakType type_; |
int position_; |
int statement_position_; |
}; |
@@ -750,6 +765,7 @@ class DebugCodegen : public AllStatic { |
static void PatchDebugBreakSlot(Isolate* isolate, Address pc, |
Handle<Code> code); |
+ static bool DebugBreakSlotIsPatched(Address pc); |
static void ClearDebugBreakSlot(Isolate* isolate, Address pc); |
}; |