OLD | NEW |
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 #include "v8.h" | 5 #include "v8.h" |
6 | 6 |
7 #if V8_TARGET_ARCH_X64 | 7 #if V8_TARGET_ARCH_X64 |
8 | 8 |
9 #include "assembler.h" | 9 #include "assembler.h" |
10 #include "codegen.h" | 10 #include "codegen.h" |
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
145 // Now that the break point has been handled, resume normal execution by | 145 // Now that the break point has been handled, resume normal execution by |
146 // jumping to the target address intended by the caller and that was | 146 // jumping to the target address intended by the caller and that was |
147 // overwritten by the address of DebugBreakXXX. | 147 // overwritten by the address of DebugBreakXXX. |
148 ExternalReference after_break_target = | 148 ExternalReference after_break_target = |
149 ExternalReference::debug_after_break_target_address(masm->isolate()); | 149 ExternalReference::debug_after_break_target_address(masm->isolate()); |
150 __ Move(kScratchRegister, after_break_target); | 150 __ Move(kScratchRegister, after_break_target); |
151 __ Jump(Operand(kScratchRegister, 0)); | 151 __ Jump(Operand(kScratchRegister, 0)); |
152 } | 152 } |
153 | 153 |
154 | 154 |
155 void Debug::GenerateCallICStubDebugBreak(MacroAssembler* masm) { | 155 void DebugCodegen::GenerateCallICStubDebugBreak(MacroAssembler* masm) { |
156 // Register state for CallICStub | 156 // Register state for CallICStub |
157 // ----------- S t a t e ------------- | 157 // ----------- S t a t e ------------- |
158 // -- rdx : type feedback slot (smi) | 158 // -- rdx : type feedback slot (smi) |
159 // -- rdi : function | 159 // -- rdi : function |
160 // ----------------------------------- | 160 // ----------------------------------- |
161 Generate_DebugBreakCallHelper(masm, rdx.bit() | rdi.bit(), 0, false); | 161 Generate_DebugBreakCallHelper(masm, rdx.bit() | rdi.bit(), 0, false); |
162 } | 162 } |
163 | 163 |
164 | 164 |
165 void Debug::GenerateLoadICDebugBreak(MacroAssembler* masm) { | 165 void DebugCodegen::GenerateLoadICDebugBreak(MacroAssembler* masm) { |
166 // Register state for IC load call (from ic-x64.cc). | 166 // Register state for IC load call (from ic-x64.cc). |
167 // ----------- S t a t e ------------- | 167 // ----------- S t a t e ------------- |
168 // -- rax : receiver | 168 // -- rax : receiver |
169 // -- rcx : name | 169 // -- rcx : name |
170 // ----------------------------------- | 170 // ----------------------------------- |
171 Generate_DebugBreakCallHelper(masm, rax.bit() | rcx.bit(), 0, false); | 171 Generate_DebugBreakCallHelper(masm, rax.bit() | rcx.bit(), 0, false); |
172 } | 172 } |
173 | 173 |
174 | 174 |
175 void Debug::GenerateStoreICDebugBreak(MacroAssembler* masm) { | 175 void DebugCodegen::GenerateStoreICDebugBreak(MacroAssembler* masm) { |
176 // Register state for IC store call (from ic-x64.cc). | 176 // Register state for IC store call (from ic-x64.cc). |
177 // ----------- S t a t e ------------- | 177 // ----------- S t a t e ------------- |
178 // -- rax : value | 178 // -- rax : value |
179 // -- rcx : name | 179 // -- rcx : name |
180 // -- rdx : receiver | 180 // -- rdx : receiver |
181 // ----------------------------------- | 181 // ----------------------------------- |
182 Generate_DebugBreakCallHelper( | 182 Generate_DebugBreakCallHelper( |
183 masm, rax.bit() | rcx.bit() | rdx.bit(), 0, false); | 183 masm, rax.bit() | rcx.bit() | rdx.bit(), 0, false); |
184 } | 184 } |
185 | 185 |
186 | 186 |
187 void Debug::GenerateKeyedLoadICDebugBreak(MacroAssembler* masm) { | 187 void DebugCodegen::GenerateKeyedLoadICDebugBreak(MacroAssembler* masm) { |
188 // Register state for keyed IC load call (from ic-x64.cc). | 188 // Register state for keyed IC load call (from ic-x64.cc). |
189 // ----------- S t a t e ------------- | 189 // ----------- S t a t e ------------- |
190 // -- rax : key | 190 // -- rax : key |
191 // -- rdx : receiver | 191 // -- rdx : receiver |
192 // ----------------------------------- | 192 // ----------------------------------- |
193 Generate_DebugBreakCallHelper(masm, rax.bit() | rdx.bit(), 0, false); | 193 Generate_DebugBreakCallHelper(masm, rax.bit() | rdx.bit(), 0, false); |
194 } | 194 } |
195 | 195 |
196 | 196 |
197 void Debug::GenerateKeyedStoreICDebugBreak(MacroAssembler* masm) { | 197 void DebugCodegen::GenerateKeyedStoreICDebugBreak(MacroAssembler* masm) { |
198 // Register state for keyed IC load call (from ic-x64.cc). | 198 // Register state for keyed IC load call (from ic-x64.cc). |
199 // ----------- S t a t e ------------- | 199 // ----------- S t a t e ------------- |
200 // -- rax : value | 200 // -- rax : value |
201 // -- rcx : key | 201 // -- rcx : key |
202 // -- rdx : receiver | 202 // -- rdx : receiver |
203 // ----------------------------------- | 203 // ----------------------------------- |
204 Generate_DebugBreakCallHelper( | 204 Generate_DebugBreakCallHelper( |
205 masm, rax.bit() | rcx.bit() | rdx.bit(), 0, false); | 205 masm, rax.bit() | rcx.bit() | rdx.bit(), 0, false); |
206 } | 206 } |
207 | 207 |
208 | 208 |
209 void Debug::GenerateCompareNilICDebugBreak(MacroAssembler* masm) { | 209 void DebugCodegen::GenerateCompareNilICDebugBreak(MacroAssembler* masm) { |
210 // Register state for CompareNil IC | 210 // Register state for CompareNil IC |
211 // ----------- S t a t e ------------- | 211 // ----------- S t a t e ------------- |
212 // -- rax : value | 212 // -- rax : value |
213 // ----------------------------------- | 213 // ----------------------------------- |
214 Generate_DebugBreakCallHelper(masm, rax.bit(), 0, false); | 214 Generate_DebugBreakCallHelper(masm, rax.bit(), 0, false); |
215 } | 215 } |
216 | 216 |
217 | 217 |
218 void Debug::GenerateReturnDebugBreak(MacroAssembler* masm) { | 218 void DebugCodegen::GenerateReturnDebugBreak(MacroAssembler* masm) { |
219 // Register state just before return from JS function (from codegen-x64.cc). | 219 // Register state just before return from JS function (from codegen-x64.cc). |
220 // ----------- S t a t e ------------- | 220 // ----------- S t a t e ------------- |
221 // -- rax: return value | 221 // -- rax: return value |
222 // ----------------------------------- | 222 // ----------------------------------- |
223 Generate_DebugBreakCallHelper(masm, rax.bit(), 0, true); | 223 Generate_DebugBreakCallHelper(masm, rax.bit(), 0, true); |
224 } | 224 } |
225 | 225 |
226 | 226 |
227 void Debug::GenerateCallFunctionStubDebugBreak(MacroAssembler* masm) { | 227 void DebugCodegen::GenerateCallFunctionStubDebugBreak(MacroAssembler* masm) { |
228 // Register state for CallFunctionStub (from code-stubs-x64.cc). | 228 // Register state for CallFunctionStub (from code-stubs-x64.cc). |
229 // ----------- S t a t e ------------- | 229 // ----------- S t a t e ------------- |
230 // -- rdi : function | 230 // -- rdi : function |
231 // ----------------------------------- | 231 // ----------------------------------- |
232 Generate_DebugBreakCallHelper(masm, rdi.bit(), 0, false); | 232 Generate_DebugBreakCallHelper(masm, rdi.bit(), 0, false); |
233 } | 233 } |
234 | 234 |
235 | 235 |
236 void Debug::GenerateCallConstructStubDebugBreak(MacroAssembler* masm) { | 236 void DebugCodegen::GenerateCallConstructStubDebugBreak(MacroAssembler* masm) { |
237 // Register state for CallConstructStub (from code-stubs-x64.cc). | 237 // Register state for CallConstructStub (from code-stubs-x64.cc). |
238 // rax is the actual number of arguments not encoded as a smi, see comment | 238 // rax is the actual number of arguments not encoded as a smi, see comment |
239 // above IC call. | 239 // above IC call. |
240 // ----------- S t a t e ------------- | 240 // ----------- S t a t e ------------- |
241 // -- rax: number of arguments | 241 // -- rax: number of arguments |
242 // ----------------------------------- | 242 // ----------------------------------- |
243 // The number of arguments in rax is not smi encoded. | 243 // The number of arguments in rax is not smi encoded. |
244 Generate_DebugBreakCallHelper(masm, rdi.bit(), rax.bit(), false); | 244 Generate_DebugBreakCallHelper(masm, rdi.bit(), rax.bit(), false); |
245 } | 245 } |
246 | 246 |
247 | 247 |
248 void Debug::GenerateCallConstructStubRecordDebugBreak(MacroAssembler* masm) { | 248 void DebugCodegen::GenerateCallConstructStubRecordDebugBreak( |
| 249 MacroAssembler* masm) { |
249 // Register state for CallConstructStub (from code-stubs-x64.cc). | 250 // Register state for CallConstructStub (from code-stubs-x64.cc). |
250 // rax is the actual number of arguments not encoded as a smi, see comment | 251 // rax is the actual number of arguments not encoded as a smi, see comment |
251 // above IC call. | 252 // above IC call. |
252 // ----------- S t a t e ------------- | 253 // ----------- S t a t e ------------- |
253 // -- rax: number of arguments | 254 // -- rax: number of arguments |
254 // -- rbx: feedback array | 255 // -- rbx: feedback array |
255 // -- rdx: feedback slot (smi) | 256 // -- rdx: feedback slot (smi) |
256 // ----------------------------------- | 257 // ----------------------------------- |
257 // The number of arguments in rax is not smi encoded. | 258 // The number of arguments in rax is not smi encoded. |
258 Generate_DebugBreakCallHelper(masm, rbx.bit() | rdx.bit() | rdi.bit(), | 259 Generate_DebugBreakCallHelper(masm, rbx.bit() | rdx.bit() | rdi.bit(), |
259 rax.bit(), false); | 260 rax.bit(), false); |
260 } | 261 } |
261 | 262 |
262 | 263 |
263 void Debug::GenerateSlot(MacroAssembler* masm) { | 264 void DebugCodegen::GenerateSlot(MacroAssembler* masm) { |
264 // Generate enough nop's to make space for a call instruction. | 265 // Generate enough nop's to make space for a call instruction. |
265 Label check_codesize; | 266 Label check_codesize; |
266 __ bind(&check_codesize); | 267 __ bind(&check_codesize); |
267 __ RecordDebugBreakSlot(); | 268 __ RecordDebugBreakSlot(); |
268 __ Nop(Assembler::kDebugBreakSlotLength); | 269 __ Nop(Assembler::kDebugBreakSlotLength); |
269 ASSERT_EQ(Assembler::kDebugBreakSlotLength, | 270 ASSERT_EQ(Assembler::kDebugBreakSlotLength, |
270 masm->SizeOfCodeGeneratedSince(&check_codesize)); | 271 masm->SizeOfCodeGeneratedSince(&check_codesize)); |
271 } | 272 } |
272 | 273 |
273 | 274 |
274 void Debug::GenerateSlotDebugBreak(MacroAssembler* masm) { | 275 void DebugCodegen::GenerateSlotDebugBreak(MacroAssembler* masm) { |
275 // In the places where a debug break slot is inserted no registers can contain | 276 // In the places where a debug break slot is inserted no registers can contain |
276 // object pointers. | 277 // object pointers. |
277 Generate_DebugBreakCallHelper(masm, 0, 0, true); | 278 Generate_DebugBreakCallHelper(masm, 0, 0, true); |
278 } | 279 } |
279 | 280 |
280 | 281 |
281 void Debug::GeneratePlainReturnLiveEdit(MacroAssembler* masm) { | 282 void DebugCodegen::GeneratePlainReturnLiveEdit(MacroAssembler* masm) { |
282 masm->ret(0); | 283 masm->ret(0); |
283 } | 284 } |
284 | 285 |
285 | 286 |
286 void Debug::GenerateFrameDropperLiveEdit(MacroAssembler* masm) { | 287 void DebugCodegen::GenerateFrameDropperLiveEdit(MacroAssembler* masm) { |
287 ExternalReference restarter_frame_function_slot = | 288 ExternalReference restarter_frame_function_slot = |
288 ExternalReference::debug_restarter_frame_function_pointer_address( | 289 ExternalReference::debug_restarter_frame_function_pointer_address( |
289 masm->isolate()); | 290 masm->isolate()); |
290 __ Move(rax, restarter_frame_function_slot); | 291 __ Move(rax, restarter_frame_function_slot); |
291 __ movp(Operand(rax, 0), Immediate(0)); | 292 __ movp(Operand(rax, 0), Immediate(0)); |
292 | 293 |
293 // We do not know our frame height, but set rsp based on rbp. | 294 // We do not know our frame height, but set rsp based on rbp. |
294 __ leap(rsp, Operand(rbp, -1 * kPointerSize)); | 295 __ leap(rsp, Operand(rbp, -1 * kPointerSize)); |
295 | 296 |
296 __ Pop(rdi); // Function. | 297 __ Pop(rdi); // Function. |
(...skipping 11 matching lines...) Expand all Loading... |
308 __ jmp(rdx); | 309 __ jmp(rdx); |
309 } | 310 } |
310 | 311 |
311 const bool Debug::kFrameDropperSupported = true; | 312 const bool Debug::kFrameDropperSupported = true; |
312 | 313 |
313 #undef __ | 314 #undef __ |
314 | 315 |
315 } } // namespace v8::internal | 316 } } // namespace v8::internal |
316 | 317 |
317 #endif // V8_TARGET_ARCH_X64 | 318 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |