| OLD | NEW |
| 1 // Copyright 2006-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2008 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 50 // to a call to the debug break return code. | 50 // to a call to the debug break return code. |
| 51 // #if USE_BLX | 51 // #if USE_BLX |
| 52 // ldr ip, [pc, #0] | 52 // ldr ip, [pc, #0] |
| 53 // blx ip | 53 // blx ip |
| 54 // #else | 54 // #else |
| 55 // mov lr, pc | 55 // mov lr, pc |
| 56 // ldr pc, [pc, #-4] | 56 // ldr pc, [pc, #-4] |
| 57 // #endif | 57 // #endif |
| 58 // <debug break return code entry point address> | 58 // <debug break return code entry point address> |
| 59 // bktp 0 | 59 // bktp 0 |
| 60 CodePatcher patcher(rinfo()->pc(), 4); | 60 CodePatcher patcher(rinfo()->pc(), Assembler::kJSReturnSequenceInstructions); |
| 61 #ifdef USE_BLX | 61 #ifdef USE_BLX |
| 62 patcher.masm()->ldr(v8::internal::ip, MemOperand(v8::internal::pc, 0)); | 62 patcher.masm()->ldr(v8::internal::ip, MemOperand(v8::internal::pc, 0)); |
| 63 patcher.masm()->blx(v8::internal::ip); | 63 patcher.masm()->blx(v8::internal::ip); |
| 64 #else | 64 #else |
| 65 patcher.masm()->mov(v8::internal::lr, v8::internal::pc); | 65 patcher.masm()->mov(v8::internal::lr, v8::internal::pc); |
| 66 patcher.masm()->ldr(v8::internal::pc, MemOperand(v8::internal::pc, -4)); | 66 patcher.masm()->ldr(v8::internal::pc, MemOperand(v8::internal::pc, -4)); |
| 67 #endif | 67 #endif |
| 68 patcher.Emit(Debug::debug_break_return()->entry()); | 68 patcher.Emit(Debug::debug_break_return()->entry()); |
| 69 patcher.masm()->bkpt(0); | 69 patcher.masm()->bkpt(0); |
| 70 } | 70 } |
| 71 | 71 |
| 72 | 72 |
| 73 // Restore the JS frame exit code. | 73 // Restore the JS frame exit code. |
| 74 void BreakLocationIterator::ClearDebugBreakAtReturn() { | 74 void BreakLocationIterator::ClearDebugBreakAtReturn() { |
| 75 rinfo()->PatchCode(original_rinfo()->pc(), | 75 rinfo()->PatchCode(original_rinfo()->pc(), |
| 76 Assembler::kJSReturnSequenceLength); | 76 Assembler::kJSReturnSequenceInstructions); |
| 77 } | 77 } |
| 78 | 78 |
| 79 | 79 |
| 80 // A debug break in the exit code is identified by a call. | 80 // A debug break in the frame exit code is identified by the JS frame exit code |
| 81 // having been patched with a call instruction. |
| 81 bool Debug::IsDebugBreakAtReturn(RelocInfo* rinfo) { | 82 bool Debug::IsDebugBreakAtReturn(RelocInfo* rinfo) { |
| 82 ASSERT(RelocInfo::IsJSReturn(rinfo->rmode())); | 83 ASSERT(RelocInfo::IsJSReturn(rinfo->rmode())); |
| 83 return rinfo->IsPatchedReturnSequence(); | 84 return rinfo->IsPatchedReturnSequence(); |
| 84 } | 85 } |
| 85 | 86 |
| 86 | 87 |
| 88 bool BreakLocationIterator::IsDebugBreakAtSlot() { |
| 89 ASSERT(IsDebugBreakSlot()); |
| 90 // Check whether the debug break slot instructions have been patched. |
| 91 return rinfo()->IsPatchedDebugBreakSlotSequence(); |
| 92 } |
| 93 |
| 94 |
| 95 void BreakLocationIterator::SetDebugBreakAtSlot() { |
| 96 ASSERT(IsDebugBreakSlot()); |
| 97 // Patch the code changing the debug break slot code from |
| 98 // mov r2, r2 |
| 99 // mov r2, r2 |
| 100 // mov r2, r2 |
| 101 // to a call to the debug break slot code. |
| 102 // #if USE_BLX |
| 103 // ldr ip, [pc, #0] |
| 104 // blx ip |
| 105 // #else |
| 106 // mov lr, pc |
| 107 // ldr pc, [pc, #-4] |
| 108 // #endif |
| 109 // <debug break slot code entry point address> |
| 110 CodePatcher patcher(rinfo()->pc(), Assembler::kDebugBreakSlotInstructions); |
| 111 #ifdef USE_BLX |
| 112 patcher.masm()->ldr(v8::internal::ip, MemOperand(v8::internal::pc, 0)); |
| 113 patcher.masm()->blx(v8::internal::ip); |
| 114 #else |
| 115 patcher.masm()->mov(v8::internal::lr, v8::internal::pc); |
| 116 patcher.masm()->ldr(v8::internal::pc, MemOperand(v8::internal::pc, -4)); |
| 117 #endif |
| 118 patcher.Emit(Debug::debug_break_return()->entry()); |
| 119 } |
| 120 |
| 121 |
| 122 void BreakLocationIterator::ClearDebugBreakAtSlot() { |
| 123 ASSERT(IsDebugBreakSlot()); |
| 124 rinfo()->PatchCode(original_rinfo()->pc(), |
| 125 Assembler::kDebugBreakSlotInstructions); |
| 126 } |
| 127 |
| 128 |
| 87 #define __ ACCESS_MASM(masm) | 129 #define __ ACCESS_MASM(masm) |
| 88 | 130 |
| 89 | 131 |
| 90 static void Generate_DebugBreakCallHelper(MacroAssembler* masm, | 132 static void Generate_DebugBreakCallHelper(MacroAssembler* masm, |
| 91 RegList pointer_regs) { | 133 RegList pointer_regs) { |
| 92 // Save the content of all general purpose registers in memory. This copy in | 134 // Save the content of all general purpose registers in memory. This copy in |
| 93 // memory is later pushed onto the JS expression stack for the fake JS frame | 135 // memory is later pushed onto the JS expression stack for the fake JS frame |
| 94 // generated and also to the C frame generated on top of that. In the JS | 136 // generated and also to the C frame generated on top of that. In the JS |
| 95 // frame ONLY the registers containing pointers will be pushed on the | 137 // frame ONLY the registers containing pointers will be pushed on the |
| 96 // expression stack. This causes the GC to update these pointers so that | 138 // expression stack. This causes the GC to update these pointers so that |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 213 | 255 |
| 214 | 256 |
| 215 void Debug::GenerateStubNoRegistersDebugBreak(MacroAssembler* masm) { | 257 void Debug::GenerateStubNoRegistersDebugBreak(MacroAssembler* masm) { |
| 216 // ----------- S t a t e ------------- | 258 // ----------- S t a t e ------------- |
| 217 // No registers used on entry. | 259 // No registers used on entry. |
| 218 // ----------------------------------- | 260 // ----------------------------------- |
| 219 Generate_DebugBreakCallHelper(masm, 0); | 261 Generate_DebugBreakCallHelper(masm, 0); |
| 220 } | 262 } |
| 221 | 263 |
| 222 | 264 |
| 265 void Debug::GenerateSlot(MacroAssembler* masm) { |
| 266 // Generate enough nop's to make space for a call instruction. |
| 267 Label check_codesize; |
| 268 __ bind(&check_codesize); |
| 269 __ RecordDebugBreakSlot(); |
| 270 for (int i = 0; i < Assembler::kDebugBreakSlotInstructions; i++) { |
| 271 __ nop(2); |
| 272 } |
| 273 ASSERT_EQ(Assembler::kDebugBreakSlotInstructions, |
| 274 masm->InstructionsGeneratedSince(&check_codesize)); |
| 275 } |
| 276 |
| 277 |
| 278 void Debug::GenerateSlotDebugBreak(MacroAssembler* masm) { |
| 279 // In the places where a debug break slot is inserted no registers can contain |
| 280 // object pointers. |
| 281 Generate_DebugBreakCallHelper(masm, 0); |
| 282 } |
| 283 |
| 284 |
| 223 void Debug::GeneratePlainReturnLiveEdit(MacroAssembler* masm) { | 285 void Debug::GeneratePlainReturnLiveEdit(MacroAssembler* masm) { |
| 224 masm->Abort("LiveEdit frame dropping is not supported on arm"); | 286 masm->Abort("LiveEdit frame dropping is not supported on arm"); |
| 225 } | 287 } |
| 226 | 288 |
| 289 |
| 227 void Debug::GenerateFrameDropperLiveEdit(MacroAssembler* masm) { | 290 void Debug::GenerateFrameDropperLiveEdit(MacroAssembler* masm) { |
| 228 masm->Abort("LiveEdit frame dropping is not supported on arm"); | 291 masm->Abort("LiveEdit frame dropping is not supported on arm"); |
| 229 } | 292 } |
| 230 | 293 |
| 231 #undef __ | 294 #undef __ |
| 232 | 295 |
| 233 | 296 |
| 234 void Debug::SetUpFrameDropperFrame(StackFrame* bottom_js_frame, | 297 void Debug::SetUpFrameDropperFrame(StackFrame* bottom_js_frame, |
| 235 Handle<Code> code) { | 298 Handle<Code> code) { |
| 236 UNREACHABLE(); | 299 UNREACHABLE(); |
| 237 } | 300 } |
| 238 const int Debug::kFrameDropperFrameSize = -1; | 301 const int Debug::kFrameDropperFrameSize = -1; |
| 239 | 302 |
| 240 #endif // ENABLE_DEBUGGER_SUPPORT | 303 #endif // ENABLE_DEBUGGER_SUPPORT |
| 241 | 304 |
| 242 } } // namespace v8::internal | 305 } } // namespace v8::internal |
| 243 | 306 |
| 244 #endif // V8_TARGET_ARCH_ARM | 307 #endif // V8_TARGET_ARCH_ARM |
| OLD | NEW |