Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(273)

Side by Side Diff: src/debug/debug.h

Issue 1847373002: [debugger] fix step-next for tail calls. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: fix reloc info Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/assembler.cc ('k') | src/debug/debug.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef V8_DEBUG_DEBUG_H_ 5 #ifndef V8_DEBUG_DEBUG_H_
6 #define V8_DEBUG_DEBUG_H_ 6 #define V8_DEBUG_DEBUG_H_
7 7
8 #include "src/allocation.h" 8 #include "src/allocation.h"
9 #include "src/arguments.h" 9 #include "src/arguments.h"
10 #include "src/assembler.h" 10 #include "src/assembler.h"
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
74 int statement_position, 74 int statement_position,
75 List<BreakLocation>* result_out); 75 List<BreakLocation>* result_out);
76 76
77 static BreakLocation FromPosition(Handle<DebugInfo> debug_info, int position, 77 static BreakLocation FromPosition(Handle<DebugInfo> debug_info, int position,
78 BreakPositionAlignment alignment); 78 BreakPositionAlignment alignment);
79 79
80 bool IsDebugBreak() const; 80 bool IsDebugBreak() const;
81 81
82 inline bool IsReturn() const { return type_ == DEBUG_BREAK_SLOT_AT_RETURN; } 82 inline bool IsReturn() const { return type_ == DEBUG_BREAK_SLOT_AT_RETURN; }
83 inline bool IsCall() const { return type_ == DEBUG_BREAK_SLOT_AT_CALL; } 83 inline bool IsCall() const { return type_ == DEBUG_BREAK_SLOT_AT_CALL; }
84 inline bool IsTailCall() const {
85 return type_ == DEBUG_BREAK_SLOT_AT_TAIL_CALL;
86 }
84 inline bool IsDebugBreakSlot() const { return type_ >= DEBUG_BREAK_SLOT; } 87 inline bool IsDebugBreakSlot() const { return type_ >= DEBUG_BREAK_SLOT; }
85 inline bool IsDebuggerStatement() const { 88 inline bool IsDebuggerStatement() const {
86 return type_ == DEBUGGER_STATEMENT; 89 return type_ == DEBUGGER_STATEMENT;
87 } 90 }
88 inline bool HasBreakPoint() const { 91 inline bool HasBreakPoint() const {
89 return debug_info_->HasBreakPoint(code_offset_); 92 return debug_info_->HasBreakPoint(code_offset_);
90 } 93 }
91 94
92 Handle<Object> BreakPointObjects() const; 95 Handle<Object> BreakPointObjects() const;
93 96
(...skipping 12 matching lines...) Expand all
106 inline AbstractCode* abstract_code() const { 109 inline AbstractCode* abstract_code() const {
107 return debug_info_->abstract_code(); 110 return debug_info_->abstract_code();
108 } 111 }
109 112
110 protected: 113 protected:
111 enum DebugBreakType { 114 enum DebugBreakType {
112 NOT_DEBUG_BREAK, 115 NOT_DEBUG_BREAK,
113 DEBUGGER_STATEMENT, 116 DEBUGGER_STATEMENT,
114 DEBUG_BREAK_SLOT, 117 DEBUG_BREAK_SLOT,
115 DEBUG_BREAK_SLOT_AT_CALL, 118 DEBUG_BREAK_SLOT_AT_CALL,
116 DEBUG_BREAK_SLOT_AT_RETURN 119 DEBUG_BREAK_SLOT_AT_RETURN,
120 DEBUG_BREAK_SLOT_AT_TAIL_CALL,
117 }; 121 };
118 122
119 BreakLocation(Handle<DebugInfo> debug_info, DebugBreakType type, 123 BreakLocation(Handle<DebugInfo> debug_info, DebugBreakType type,
120 int code_offset, int position, int statement_position); 124 int code_offset, int position, int statement_position);
121 125
122 class Iterator { 126 class Iterator {
123 public: 127 public:
124 virtual ~Iterator() {} 128 virtual ~Iterator() {}
125 129
126 virtual BreakLocation GetBreakLocation() = 0; 130 virtual BreakLocation GetBreakLocation() = 0;
127 virtual bool Done() const = 0; 131 virtual bool Done() const = 0;
128 virtual void Next() = 0; 132 virtual void Next() = 0;
129 133
130 void SkipTo(int count) { 134 void SkipTo(int count) {
131 while (count-- > 0) Next(); 135 while (count-- > 0) Next();
132 } 136 }
133 137
134 virtual int code_offset() = 0; 138 virtual int code_offset() = 0;
135 int break_index() const { return break_index_; } 139 int break_index() const { return break_index_; }
136 inline int position() const { return position_; } 140 inline int position() const { return position_; }
137 inline int statement_position() const { return statement_position_; } 141 inline int statement_position() const { return statement_position_; }
138 142
139 protected: 143 protected:
140 explicit Iterator(Handle<DebugInfo> debug_info); 144 explicit Iterator(Handle<DebugInfo> debug_info);
141 int ReturnPosition(); 145 int ReturnPosition();
142 146
147 Isolate* isolate() { return debug_info_->GetIsolate(); }
148
143 Handle<DebugInfo> debug_info_; 149 Handle<DebugInfo> debug_info_;
144 int break_index_; 150 int break_index_;
145 int position_; 151 int position_;
146 int statement_position_; 152 int statement_position_;
147 153
148 private: 154 private:
149 DisallowHeapAllocation no_gc_; 155 DisallowHeapAllocation no_gc_;
150 DISALLOW_COPY_AND_ASSIGN(Iterator); 156 DISALLOW_COPY_AND_ASSIGN(Iterator);
151 }; 157 };
152 158
153 class CodeIterator : public Iterator { 159 class CodeIterator : public Iterator {
154 public: 160 public:
155 CodeIterator(Handle<DebugInfo> debug_info, BreakLocatorType type); 161 CodeIterator(Handle<DebugInfo> debug_info, BreakLocatorType type);
156 ~CodeIterator() override {} 162 ~CodeIterator() override {}
157 163
158 BreakLocation GetBreakLocation() override; 164 BreakLocation GetBreakLocation() override;
159 bool Done() const override { return reloc_iterator_.done(); } 165 bool Done() const override { return reloc_iterator_.done(); }
160 void Next() override; 166 void Next() override;
161 167
162 int code_offset() override { 168 int code_offset() override {
163 return static_cast<int>( 169 return static_cast<int>(
164 rinfo()->pc() - 170 rinfo()->pc() -
165 debug_info_->abstract_code()->GetCode()->instruction_start()); 171 debug_info_->abstract_code()->GetCode()->instruction_start());
166 } 172 }
167 173
168 private: 174 private:
169 static int GetModeMask(BreakLocatorType type); 175 int GetModeMask(BreakLocatorType type);
170 RelocInfo::Mode rmode() { return reloc_iterator_.rinfo()->rmode(); } 176 RelocInfo::Mode rmode() { return reloc_iterator_.rinfo()->rmode(); }
171 RelocInfo* rinfo() { return reloc_iterator_.rinfo(); } 177 RelocInfo* rinfo() { return reloc_iterator_.rinfo(); }
172 178
173 RelocIterator reloc_iterator_; 179 RelocIterator reloc_iterator_;
174 DISALLOW_COPY_AND_ASSIGN(CodeIterator); 180 DISALLOW_COPY_AND_ASSIGN(CodeIterator);
175 }; 181 };
176 182
177 class BytecodeArrayIterator : public Iterator { 183 class BytecodeArrayIterator : public Iterator {
178 public: 184 public:
179 BytecodeArrayIterator(Handle<DebugInfo> debug_info, BreakLocatorType type); 185 BytecodeArrayIterator(Handle<DebugInfo> debug_info, BreakLocatorType type);
(...skipping 617 matching lines...) Expand 10 before | Expand all | Expand 10 after
797 Handle<Code> code); 803 Handle<Code> code);
798 static bool DebugBreakSlotIsPatched(Address pc); 804 static bool DebugBreakSlotIsPatched(Address pc);
799 static void ClearDebugBreakSlot(Isolate* isolate, Address pc); 805 static void ClearDebugBreakSlot(Isolate* isolate, Address pc);
800 }; 806 };
801 807
802 808
803 } // namespace internal 809 } // namespace internal
804 } // namespace v8 810 } // namespace v8
805 811
806 #endif // V8_DEBUG_DEBUG_H_ 812 #endif // V8_DEBUG_DEBUG_H_
OLDNEW
« no previous file with comments | « src/assembler.cc ('k') | src/debug/debug.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698