| OLD | NEW |
| 1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 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 "src/v8.h" | 5 #include "src/v8.h" |
| 6 | 6 |
| 7 #if V8_TARGET_ARCH_PPC | 7 #if V8_TARGET_ARCH_PPC |
| 8 | 8 |
| 9 #include "src/codegen.h" | 9 #include "src/codegen.h" |
| 10 #include "src/debug.h" | 10 #include "src/debug.h" |
| 11 | 11 |
| 12 namespace v8 { | 12 namespace v8 { |
| 13 namespace internal { | 13 namespace internal { |
| 14 | 14 |
| 15 bool BreakLocationIterator::IsDebugBreakAtReturn() { | 15 void BreakLocation::SetDebugBreakAtReturn() { |
| 16 return Debug::IsDebugBreakAtReturn(rinfo()); | |
| 17 } | |
| 18 | |
| 19 | |
| 20 void BreakLocationIterator::SetDebugBreakAtReturn() { | |
| 21 // Patch the code changing the return from JS function sequence from | 16 // Patch the code changing the return from JS function sequence from |
| 22 // | 17 // |
| 23 // LeaveFrame | 18 // LeaveFrame |
| 24 // blr | 19 // blr |
| 25 // | 20 // |
| 26 // to a call to the debug break return code. | 21 // to a call to the debug break return code. |
| 27 // this uses a FIXED_SEQUENCE to load an address constant | 22 // this uses a FIXED_SEQUENCE to load an address constant |
| 28 // | 23 // |
| 29 // mov r0, <address> | 24 // mov r0, <address> |
| 30 // mtlr r0 | 25 // mtlr r0 |
| 31 // blrl | 26 // blrl |
| 32 // bkpt | 27 // bkpt |
| 33 // | 28 // |
| 34 CodePatcher patcher(rinfo()->pc(), Assembler::kJSReturnSequenceInstructions); | 29 CodePatcher patcher(pc(), Assembler::kJSReturnSequenceInstructions); |
| 35 Assembler::BlockTrampolinePoolScope block_trampoline_pool(patcher.masm()); | 30 Assembler::BlockTrampolinePoolScope block_trampoline_pool(patcher.masm()); |
| 36 patcher.masm()->mov( | 31 patcher.masm()->mov( |
| 37 v8::internal::r0, | 32 v8::internal::r0, |
| 38 Operand(reinterpret_cast<intptr_t>(debug_info_->GetIsolate() | 33 Operand(reinterpret_cast<intptr_t>(debug_info_->GetIsolate() |
| 39 ->builtins() | 34 ->builtins() |
| 40 ->Return_DebugBreak() | 35 ->Return_DebugBreak() |
| 41 ->entry()))); | 36 ->entry()))); |
| 42 patcher.masm()->mtctr(v8::internal::r0); | 37 patcher.masm()->mtctr(v8::internal::r0); |
| 43 patcher.masm()->bctrl(); | 38 patcher.masm()->bctrl(); |
| 44 patcher.masm()->bkpt(0); | 39 patcher.masm()->bkpt(0); |
| 45 } | 40 } |
| 46 | 41 |
| 47 | 42 |
| 48 // Restore the JS frame exit code. | 43 void BreakLocation::SetDebugBreakAtSlot() { |
| 49 void BreakLocationIterator::ClearDebugBreakAtReturn() { | |
| 50 rinfo()->PatchCode(original_rinfo()->pc(), | |
| 51 Assembler::kJSReturnSequenceInstructions); | |
| 52 } | |
| 53 | |
| 54 | |
| 55 // A debug break in the frame exit code is identified by the JS frame exit code | |
| 56 // having been patched with a call instruction. | |
| 57 bool Debug::IsDebugBreakAtReturn(RelocInfo* rinfo) { | |
| 58 DCHECK(RelocInfo::IsJSReturn(rinfo->rmode())); | |
| 59 return rinfo->IsPatchedReturnSequence(); | |
| 60 } | |
| 61 | |
| 62 | |
| 63 bool BreakLocationIterator::IsDebugBreakAtSlot() { | |
| 64 DCHECK(IsDebugBreakSlot()); | |
| 65 // Check whether the debug break slot instructions have been patched. | |
| 66 return rinfo()->IsPatchedDebugBreakSlotSequence(); | |
| 67 } | |
| 68 | |
| 69 | |
| 70 void BreakLocationIterator::SetDebugBreakAtSlot() { | |
| 71 DCHECK(IsDebugBreakSlot()); | 44 DCHECK(IsDebugBreakSlot()); |
| 72 // Patch the code changing the debug break slot code from | 45 // Patch the code changing the debug break slot code from |
| 73 // | 46 // |
| 74 // ori r3, r3, 0 | 47 // ori r3, r3, 0 |
| 75 // ori r3, r3, 0 | 48 // ori r3, r3, 0 |
| 76 // ori r3, r3, 0 | 49 // ori r3, r3, 0 |
| 77 // ori r3, r3, 0 | 50 // ori r3, r3, 0 |
| 78 // ori r3, r3, 0 | 51 // ori r3, r3, 0 |
| 79 // | 52 // |
| 80 // to a call to the debug break code, using a FIXED_SEQUENCE. | 53 // to a call to the debug break code, using a FIXED_SEQUENCE. |
| 81 // | 54 // |
| 82 // mov r0, <address> | 55 // mov r0, <address> |
| 83 // mtlr r0 | 56 // mtlr r0 |
| 84 // blrl | 57 // blrl |
| 85 // | 58 // |
| 86 CodePatcher patcher(rinfo()->pc(), Assembler::kDebugBreakSlotInstructions); | 59 CodePatcher patcher(pc(), Assembler::kDebugBreakSlotInstructions); |
| 87 Assembler::BlockTrampolinePoolScope block_trampoline_pool(patcher.masm()); | 60 Assembler::BlockTrampolinePoolScope block_trampoline_pool(patcher.masm()); |
| 88 patcher.masm()->mov( | 61 patcher.masm()->mov( |
| 89 v8::internal::r0, | 62 v8::internal::r0, |
| 90 Operand(reinterpret_cast<intptr_t>( | 63 Operand(reinterpret_cast<intptr_t>( |
| 91 debug_info_->GetIsolate()->builtins()->Slot_DebugBreak()->entry()))); | 64 debug_info_->GetIsolate()->builtins()->Slot_DebugBreak()->entry()))); |
| 92 patcher.masm()->mtctr(v8::internal::r0); | 65 patcher.masm()->mtctr(v8::internal::r0); |
| 93 patcher.masm()->bctrl(); | 66 patcher.masm()->bctrl(); |
| 94 } | 67 } |
| 95 | 68 |
| 96 | 69 |
| 97 void BreakLocationIterator::ClearDebugBreakAtSlot() { | |
| 98 DCHECK(IsDebugBreakSlot()); | |
| 99 rinfo()->PatchCode(original_rinfo()->pc(), | |
| 100 Assembler::kDebugBreakSlotInstructions); | |
| 101 } | |
| 102 | |
| 103 | |
| 104 #define __ ACCESS_MASM(masm) | 70 #define __ ACCESS_MASM(masm) |
| 105 | 71 |
| 106 | 72 |
| 107 static void Generate_DebugBreakCallHelper(MacroAssembler* masm, | 73 static void Generate_DebugBreakCallHelper(MacroAssembler* masm, |
| 108 RegList object_regs, | 74 RegList object_regs, |
| 109 RegList non_object_regs) { | 75 RegList non_object_regs) { |
| 110 { | 76 { |
| 111 FrameScope scope(masm, StackFrame::INTERNAL); | 77 FrameScope scope(masm, StackFrame::INTERNAL); |
| 112 | 78 |
| 113 // Load padding words on stack. | 79 // Load padding words on stack. |
| (...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 333 } | 299 } |
| 334 | 300 |
| 335 | 301 |
| 336 const bool LiveEdit::kFrameDropperSupported = true; | 302 const bool LiveEdit::kFrameDropperSupported = true; |
| 337 | 303 |
| 338 #undef __ | 304 #undef __ |
| 339 } | 305 } |
| 340 } // namespace v8::internal | 306 } // namespace v8::internal |
| 341 | 307 |
| 342 #endif // V8_TARGET_ARCH_PPC | 308 #endif // V8_TARGET_ARCH_PPC |
| OLD | NEW |