OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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_ARM64 | 7 #if V8_TARGET_ARCH_ARM64 |
8 | 8 |
9 #include "codegen.h" | 9 #include "codegen.h" |
10 #include "debug.h" | 10 #include "debug.h" |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
73 | 73 |
74 | 74 |
75 bool BreakLocationIterator::IsDebugBreakAtSlot() { | 75 bool BreakLocationIterator::IsDebugBreakAtSlot() { |
76 ASSERT(IsDebugBreakSlot()); | 76 ASSERT(IsDebugBreakSlot()); |
77 // Check whether the debug break slot instructions have been patched. | 77 // Check whether the debug break slot instructions have been patched. |
78 return rinfo()->IsPatchedDebugBreakSlotSequence(); | 78 return rinfo()->IsPatchedDebugBreakSlotSequence(); |
79 } | 79 } |
80 | 80 |
81 | 81 |
82 void BreakLocationIterator::SetDebugBreakAtSlot() { | 82 void BreakLocationIterator::SetDebugBreakAtSlot() { |
83 // Patch the code emitted by Debug::GenerateSlots, changing the debug break | 83 // Patch the code emitted by DebugCodegen::GenerateSlots, changing the debug |
84 // slot code from | 84 // break slot code from |
85 // mov x0, x0 @ nop DEBUG_BREAK_NOP | 85 // mov x0, x0 @ nop DEBUG_BREAK_NOP |
86 // mov x0, x0 @ nop DEBUG_BREAK_NOP | 86 // mov x0, x0 @ nop DEBUG_BREAK_NOP |
87 // mov x0, x0 @ nop DEBUG_BREAK_NOP | 87 // mov x0, x0 @ nop DEBUG_BREAK_NOP |
88 // mov x0, x0 @ nop DEBUG_BREAK_NOP | 88 // mov x0, x0 @ nop DEBUG_BREAK_NOP |
89 // to a call to the debug slot code. | 89 // to a call to the debug slot code. |
90 // ldr ip0, [pc, #(2 * kInstructionSize)] | 90 // ldr ip0, [pc, #(2 * kInstructionSize)] |
91 // blr ip0 | 91 // blr ip0 |
92 // <debug break slot code ... | 92 // <debug break slot code ... |
93 // ... entry point address (64 bits)> | 93 // ... entry point address (64 bits)> |
94 | 94 |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
208 // jumping to the target address intended by the caller and that was | 208 // jumping to the target address intended by the caller and that was |
209 // overwritten by the address of DebugBreakXXX. | 209 // overwritten by the address of DebugBreakXXX. |
210 ExternalReference after_break_target = | 210 ExternalReference after_break_target = |
211 ExternalReference::debug_after_break_target_address(masm->isolate()); | 211 ExternalReference::debug_after_break_target_address(masm->isolate()); |
212 __ Mov(scratch, after_break_target); | 212 __ Mov(scratch, after_break_target); |
213 __ Ldr(scratch, MemOperand(scratch)); | 213 __ Ldr(scratch, MemOperand(scratch)); |
214 __ Br(scratch); | 214 __ Br(scratch); |
215 } | 215 } |
216 | 216 |
217 | 217 |
218 void Debug::GenerateCallICStubDebugBreak(MacroAssembler* masm) { | 218 void DebugCodegen::GenerateCallICStubDebugBreak(MacroAssembler* masm) { |
219 // Register state for CallICStub | 219 // Register state for CallICStub |
220 // ----------- S t a t e ------------- | 220 // ----------- S t a t e ------------- |
221 // -- x1 : function | 221 // -- x1 : function |
222 // -- x3 : slot in feedback array | 222 // -- x3 : slot in feedback array |
223 // ----------------------------------- | 223 // ----------------------------------- |
224 Generate_DebugBreakCallHelper(masm, x1.Bit() | x3.Bit(), 0, x10); | 224 Generate_DebugBreakCallHelper(masm, x1.Bit() | x3.Bit(), 0, x10); |
225 } | 225 } |
226 | 226 |
227 | 227 |
228 void Debug::GenerateLoadICDebugBreak(MacroAssembler* masm) { | 228 void DebugCodegen::GenerateLoadICDebugBreak(MacroAssembler* masm) { |
229 // Calling convention for IC load (from ic-arm.cc). | 229 // Calling convention for IC load (from ic-arm.cc). |
230 // ----------- S t a t e ------------- | 230 // ----------- S t a t e ------------- |
231 // -- x2 : name | 231 // -- x2 : name |
232 // -- lr : return address | 232 // -- lr : return address |
233 // -- x0 : receiver | 233 // -- x0 : receiver |
234 // -- [sp] : receiver | 234 // -- [sp] : receiver |
235 // ----------------------------------- | 235 // ----------------------------------- |
236 // Registers x0 and x2 contain objects that need to be pushed on the | 236 // Registers x0 and x2 contain objects that need to be pushed on the |
237 // expression stack of the fake JS frame. | 237 // expression stack of the fake JS frame. |
238 Generate_DebugBreakCallHelper(masm, x0.Bit() | x2.Bit(), 0, x10); | 238 Generate_DebugBreakCallHelper(masm, x0.Bit() | x2.Bit(), 0, x10); |
239 } | 239 } |
240 | 240 |
241 | 241 |
242 void Debug::GenerateStoreICDebugBreak(MacroAssembler* masm) { | 242 void DebugCodegen::GenerateStoreICDebugBreak(MacroAssembler* masm) { |
243 // Calling convention for IC store (from ic-arm.cc). | 243 // Calling convention for IC store (from ic-arm.cc). |
244 // ----------- S t a t e ------------- | 244 // ----------- S t a t e ------------- |
245 // -- x0 : value | 245 // -- x0 : value |
246 // -- x1 : receiver | 246 // -- x1 : receiver |
247 // -- x2 : name | 247 // -- x2 : name |
248 // -- lr : return address | 248 // -- lr : return address |
249 // ----------------------------------- | 249 // ----------------------------------- |
250 // Registers x0, x1, and x2 contain objects that need to be pushed on the | 250 // Registers x0, x1, and x2 contain objects that need to be pushed on the |
251 // expression stack of the fake JS frame. | 251 // expression stack of the fake JS frame. |
252 Generate_DebugBreakCallHelper(masm, x0.Bit() | x1.Bit() | x2.Bit(), 0, x10); | 252 Generate_DebugBreakCallHelper(masm, x0.Bit() | x1.Bit() | x2.Bit(), 0, x10); |
253 } | 253 } |
254 | 254 |
255 | 255 |
256 void Debug::GenerateKeyedLoadICDebugBreak(MacroAssembler* masm) { | 256 void DebugCodegen::GenerateKeyedLoadICDebugBreak(MacroAssembler* masm) { |
257 // ---------- S t a t e -------------- | 257 // ---------- S t a t e -------------- |
258 // -- lr : return address | 258 // -- lr : return address |
259 // -- x0 : key | 259 // -- x0 : key |
260 // -- x1 : receiver | 260 // -- x1 : receiver |
261 Generate_DebugBreakCallHelper(masm, x0.Bit() | x1.Bit(), 0, x10); | 261 Generate_DebugBreakCallHelper(masm, x0.Bit() | x1.Bit(), 0, x10); |
262 } | 262 } |
263 | 263 |
264 | 264 |
265 void Debug::GenerateKeyedStoreICDebugBreak(MacroAssembler* masm) { | 265 void DebugCodegen::GenerateKeyedStoreICDebugBreak(MacroAssembler* masm) { |
266 // ---------- S t a t e -------------- | 266 // ---------- S t a t e -------------- |
267 // -- x0 : value | 267 // -- x0 : value |
268 // -- x1 : key | 268 // -- x1 : key |
269 // -- x2 : receiver | 269 // -- x2 : receiver |
270 // -- lr : return address | 270 // -- lr : return address |
271 Generate_DebugBreakCallHelper(masm, x0.Bit() | x1.Bit() | x2.Bit(), 0, x10); | 271 Generate_DebugBreakCallHelper(masm, x0.Bit() | x1.Bit() | x2.Bit(), 0, x10); |
272 } | 272 } |
273 | 273 |
274 | 274 |
275 void Debug::GenerateCompareNilICDebugBreak(MacroAssembler* masm) { | 275 void DebugCodegen::GenerateCompareNilICDebugBreak(MacroAssembler* masm) { |
276 // Register state for CompareNil IC | 276 // Register state for CompareNil IC |
277 // ----------- S t a t e ------------- | 277 // ----------- S t a t e ------------- |
278 // -- r0 : value | 278 // -- r0 : value |
279 // ----------------------------------- | 279 // ----------------------------------- |
280 Generate_DebugBreakCallHelper(masm, x0.Bit(), 0, x10); | 280 Generate_DebugBreakCallHelper(masm, x0.Bit(), 0, x10); |
281 } | 281 } |
282 | 282 |
283 | 283 |
284 void Debug::GenerateReturnDebugBreak(MacroAssembler* masm) { | 284 void DebugCodegen::GenerateReturnDebugBreak(MacroAssembler* masm) { |
285 // In places other than IC call sites it is expected that r0 is TOS which | 285 // In places other than IC call sites it is expected that r0 is TOS which |
286 // is an object - this is not generally the case so this should be used with | 286 // is an object - this is not generally the case so this should be used with |
287 // care. | 287 // care. |
288 Generate_DebugBreakCallHelper(masm, x0.Bit(), 0, x10); | 288 Generate_DebugBreakCallHelper(masm, x0.Bit(), 0, x10); |
289 } | 289 } |
290 | 290 |
291 | 291 |
292 void Debug::GenerateCallFunctionStubDebugBreak(MacroAssembler* masm) { | 292 void DebugCodegen::GenerateCallFunctionStubDebugBreak(MacroAssembler* masm) { |
293 // Register state for CallFunctionStub (from code-stubs-arm64.cc). | 293 // Register state for CallFunctionStub (from code-stubs-arm64.cc). |
294 // ----------- S t a t e ------------- | 294 // ----------- S t a t e ------------- |
295 // -- x1 : function | 295 // -- x1 : function |
296 // ----------------------------------- | 296 // ----------------------------------- |
297 Generate_DebugBreakCallHelper(masm, x1.Bit(), 0, x10); | 297 Generate_DebugBreakCallHelper(masm, x1.Bit(), 0, x10); |
298 } | 298 } |
299 | 299 |
300 | 300 |
301 void Debug::GenerateCallConstructStubDebugBreak(MacroAssembler* masm) { | 301 void DebugCodegen::GenerateCallConstructStubDebugBreak(MacroAssembler* masm) { |
302 // Calling convention for CallConstructStub (from code-stubs-arm64.cc). | 302 // Calling convention for CallConstructStub (from code-stubs-arm64.cc). |
303 // ----------- S t a t e ------------- | 303 // ----------- S t a t e ------------- |
304 // -- x0 : number of arguments (not smi) | 304 // -- x0 : number of arguments (not smi) |
305 // -- x1 : constructor function | 305 // -- x1 : constructor function |
306 // ----------------------------------- | 306 // ----------------------------------- |
307 Generate_DebugBreakCallHelper(masm, x1.Bit(), x0.Bit(), x10); | 307 Generate_DebugBreakCallHelper(masm, x1.Bit(), x0.Bit(), x10); |
308 } | 308 } |
309 | 309 |
310 | 310 |
311 void Debug::GenerateCallConstructStubRecordDebugBreak(MacroAssembler* masm) { | 311 void DebugCodegen::GenerateCallConstructStubRecordDebugBreak( |
| 312 MacroAssembler* masm) { |
312 // Calling convention for CallConstructStub (from code-stubs-arm64.cc). | 313 // Calling convention for CallConstructStub (from code-stubs-arm64.cc). |
313 // ----------- S t a t e ------------- | 314 // ----------- S t a t e ------------- |
314 // -- x0 : number of arguments (not smi) | 315 // -- x0 : number of arguments (not smi) |
315 // -- x1 : constructor function | 316 // -- x1 : constructor function |
316 // -- x2 : feedback array | 317 // -- x2 : feedback array |
317 // -- x3 : feedback slot (smi) | 318 // -- x3 : feedback slot (smi) |
318 // ----------------------------------- | 319 // ----------------------------------- |
319 Generate_DebugBreakCallHelper( | 320 Generate_DebugBreakCallHelper( |
320 masm, x1.Bit() | x2.Bit() | x3.Bit(), x0.Bit(), x10); | 321 masm, x1.Bit() | x2.Bit() | x3.Bit(), x0.Bit(), x10); |
321 } | 322 } |
322 | 323 |
323 | 324 |
324 void Debug::GenerateSlot(MacroAssembler* masm) { | 325 void DebugCodegen::GenerateSlot(MacroAssembler* masm) { |
325 // Generate enough nop's to make space for a call instruction. Avoid emitting | 326 // Generate enough nop's to make space for a call instruction. Avoid emitting |
326 // the constant pool in the debug break slot code. | 327 // the constant pool in the debug break slot code. |
327 InstructionAccurateScope scope(masm, Assembler::kDebugBreakSlotInstructions); | 328 InstructionAccurateScope scope(masm, Assembler::kDebugBreakSlotInstructions); |
328 | 329 |
329 __ RecordDebugBreakSlot(); | 330 __ RecordDebugBreakSlot(); |
330 for (int i = 0; i < Assembler::kDebugBreakSlotInstructions; i++) { | 331 for (int i = 0; i < Assembler::kDebugBreakSlotInstructions; i++) { |
331 __ nop(Assembler::DEBUG_BREAK_NOP); | 332 __ nop(Assembler::DEBUG_BREAK_NOP); |
332 } | 333 } |
333 } | 334 } |
334 | 335 |
335 | 336 |
336 void Debug::GenerateSlotDebugBreak(MacroAssembler* masm) { | 337 void DebugCodegen::GenerateSlotDebugBreak(MacroAssembler* masm) { |
337 // In the places where a debug break slot is inserted no registers can contain | 338 // In the places where a debug break slot is inserted no registers can contain |
338 // object pointers. | 339 // object pointers. |
339 Generate_DebugBreakCallHelper(masm, 0, 0, x10); | 340 Generate_DebugBreakCallHelper(masm, 0, 0, x10); |
340 } | 341 } |
341 | 342 |
342 | 343 |
343 void Debug::GeneratePlainReturnLiveEdit(MacroAssembler* masm) { | 344 void DebugCodegen::GeneratePlainReturnLiveEdit(MacroAssembler* masm) { |
344 masm->Abort(kLiveEditFrameDroppingIsNotSupportedOnARM64); | 345 masm->Abort(kLiveEditFrameDroppingIsNotSupportedOnARM64); |
345 } | 346 } |
346 | 347 |
347 | 348 |
348 void Debug::GenerateFrameDropperLiveEdit(MacroAssembler* masm) { | 349 void DebugCodegen::GenerateFrameDropperLiveEdit(MacroAssembler* masm) { |
349 masm->Abort(kLiveEditFrameDroppingIsNotSupportedOnARM64); | 350 masm->Abort(kLiveEditFrameDroppingIsNotSupportedOnARM64); |
350 } | 351 } |
351 | 352 |
352 const bool Debug::kFrameDropperSupported = false; | 353 const bool Debug::kFrameDropperSupported = false; |
353 | 354 |
354 } } // namespace v8::internal | 355 } } // namespace v8::internal |
355 | 356 |
356 #endif // V8_TARGET_ARCH_ARM64 | 357 #endif // V8_TARGET_ARCH_ARM64 |
OLD | NEW |