sgjesse@chromium.org | b302e56 | 2010-02-03 11:26:59 +0000 | [diff] [blame] | 1 | // Copyright 2010 the V8 project authors. All rights reserved. |
ager@chromium.org | 5ec4892 | 2009-05-05 07:25:34 +0000 | [diff] [blame] | 2 | // Redistribution and use in source and binary forms, with or without |
| 3 | // modification, are permitted provided that the following conditions are |
| 4 | // met: |
| 5 | // |
| 6 | // * Redistributions of source code must retain the above copyright |
| 7 | // notice, this list of conditions and the following disclaimer. |
| 8 | // * Redistributions in binary form must reproduce the above |
| 9 | // copyright notice, this list of conditions and the following |
| 10 | // disclaimer in the documentation and/or other materials provided |
| 11 | // with the distribution. |
| 12 | // * Neither the name of Google Inc. nor the names of its |
| 13 | // contributors may be used to endorse or promote products derived |
| 14 | // from this software without specific prior written permission. |
| 15 | // |
| 16 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
| 17 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
| 18 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
| 19 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
| 20 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
| 21 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
| 22 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 23 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 24 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 25 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 26 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 27 | |
kasperl@chromium.org | 71affb5 | 2009-05-26 05:44:31 +0000 | [diff] [blame] | 28 | |
| 29 | #include "v8.h" |
| 30 | |
erik.corry@gmail.com | 9dfbea4 | 2010-05-21 12:58:28 +0000 | [diff] [blame] | 31 | #if defined(V8_TARGET_ARCH_X64) |
| 32 | |
kasperl@chromium.org | 71affb5 | 2009-05-26 05:44:31 +0000 | [diff] [blame] | 33 | #include "codegen-inl.h" |
| 34 | #include "debug.h" |
| 35 | |
| 36 | |
| 37 | namespace v8 { |
| 38 | namespace internal { |
| 39 | |
| 40 | #ifdef ENABLE_DEBUGGER_SUPPORT |
| 41 | |
| 42 | bool Debug::IsDebugBreakAtReturn(v8::internal::RelocInfo* rinfo) { |
kasperl@chromium.org | defbd10 | 2009-07-13 14:04:26 +0000 | [diff] [blame] | 43 | ASSERT(RelocInfo::IsJSReturn(rinfo->rmode())); |
christian.plesner.hansen@gmail.com | 9d58c2b | 2009-10-16 11:48:38 +0000 | [diff] [blame] | 44 | return rinfo->IsPatchedReturnSequence(); |
kasperl@chromium.org | 71affb5 | 2009-05-26 05:44:31 +0000 | [diff] [blame] | 45 | } |
| 46 | |
sgjesse@chromium.org | 911335c | 2009-08-19 12:59:44 +0000 | [diff] [blame] | 47 | #define __ ACCESS_MASM(masm) |
| 48 | |
| 49 | static void Generate_DebugBreakCallHelper(MacroAssembler* masm, |
ricow@chromium.org | d236f4d | 2010-09-01 06:52:08 +0000 | [diff] [blame^] | 50 | RegList object_regs, |
| 51 | RegList non_object_regs, |
sgjesse@chromium.org | 911335c | 2009-08-19 12:59:44 +0000 | [diff] [blame] | 52 | bool convert_call_to_jmp) { |
sgjesse@chromium.org | 911335c | 2009-08-19 12:59:44 +0000 | [diff] [blame] | 53 | // Enter an internal frame. |
| 54 | __ EnterInternalFrame(); |
| 55 | |
ricow@chromium.org | d236f4d | 2010-09-01 06:52:08 +0000 | [diff] [blame^] | 56 | // Store the registers containing live values on the expression stack to |
| 57 | // make sure that these are correctly updated during GC. Non object values |
| 58 | // are stored as as two smi causing it to be untouched by GC. |
| 59 | ASSERT((object_regs & ~kJSCallerSaved) == 0); |
| 60 | ASSERT((non_object_regs & ~kJSCallerSaved) == 0); |
| 61 | ASSERT((object_regs & non_object_regs) == 0); |
| 62 | for (int i = 0; i < kNumJSCallerSaved; i++) { |
| 63 | int r = JSCallerSavedCode(i); |
| 64 | Register reg = { r }; |
| 65 | ASSERT(!reg.is(kScratchRegister)); |
| 66 | if ((object_regs & (1 << r)) != 0) { |
| 67 | __ push(reg); |
| 68 | } |
| 69 | // Store the 64-bit value as two smis. |
| 70 | if ((non_object_regs & (1 << r)) != 0) { |
| 71 | __ movq(kScratchRegister, reg); |
| 72 | __ Integer32ToSmi(reg, reg); |
| 73 | __ push(reg); |
| 74 | __ sar(kScratchRegister, Immediate(32)); |
| 75 | __ Integer32ToSmi(kScratchRegister, kScratchRegister); |
| 76 | __ push(kScratchRegister); |
| 77 | } |
| 78 | } |
sgjesse@chromium.org | 911335c | 2009-08-19 12:59:44 +0000 | [diff] [blame] | 79 | |
| 80 | #ifdef DEBUG |
| 81 | __ RecordComment("// Calling from debug break to runtime - come in - over"); |
| 82 | #endif |
| 83 | __ xor_(rax, rax); // No arguments (argc == 0). |
| 84 | __ movq(rbx, ExternalReference::debug_break()); |
| 85 | |
ricow@chromium.org | d236f4d | 2010-09-01 06:52:08 +0000 | [diff] [blame^] | 86 | CEntryStub ceb(1); |
sgjesse@chromium.org | 911335c | 2009-08-19 12:59:44 +0000 | [diff] [blame] | 87 | __ CallStub(&ceb); |
| 88 | |
ricow@chromium.org | d236f4d | 2010-09-01 06:52:08 +0000 | [diff] [blame^] | 89 | // Restore the register values from the expression stack. |
| 90 | for (int i = kNumJSCallerSaved - 1; i >= 0; i--) { |
| 91 | int r = JSCallerSavedCode(i); |
| 92 | Register reg = { r }; |
| 93 | if (FLAG_debug_code) { |
| 94 | __ Set(reg, kDebugZapValue); |
| 95 | } |
| 96 | if ((object_regs & (1 << r)) != 0) { |
| 97 | __ pop(reg); |
| 98 | } |
| 99 | // Reconstruct the 64-bit value from two smis. |
| 100 | if ((non_object_regs & (1 << r)) != 0) { |
| 101 | __ pop(kScratchRegister); |
| 102 | __ SmiToInteger32(kScratchRegister, kScratchRegister); |
| 103 | __ shl(kScratchRegister, Immediate(32)); |
| 104 | __ pop(reg); |
| 105 | __ SmiToInteger32(reg, reg); |
| 106 | __ or_(reg, kScratchRegister); |
| 107 | } |
| 108 | } |
sgjesse@chromium.org | 911335c | 2009-08-19 12:59:44 +0000 | [diff] [blame] | 109 | |
| 110 | // Get rid of the internal frame. |
| 111 | __ LeaveInternalFrame(); |
| 112 | |
| 113 | // If this call did not replace a call but patched other code then there will |
| 114 | // be an unwanted return address left on the stack. Here we get rid of that. |
| 115 | if (convert_call_to_jmp) { |
ricow@chromium.org | d236f4d | 2010-09-01 06:52:08 +0000 | [diff] [blame^] | 116 | __ addq(rsp, Immediate(kPointerSize)); |
sgjesse@chromium.org | 911335c | 2009-08-19 12:59:44 +0000 | [diff] [blame] | 117 | } |
| 118 | |
sgjesse@chromium.org | 911335c | 2009-08-19 12:59:44 +0000 | [diff] [blame] | 119 | // Now that the break point has been handled, resume normal execution by |
| 120 | // jumping to the target address intended by the caller and that was |
| 121 | // overwritten by the address of DebugBreakXXX. |
| 122 | ExternalReference after_break_target = |
| 123 | ExternalReference(Debug_Address::AfterBreakTarget()); |
| 124 | __ movq(kScratchRegister, after_break_target); |
| 125 | __ jmp(Operand(kScratchRegister, 0)); |
| 126 | } |
| 127 | |
| 128 | |
kasperl@chromium.org | 71affb5 | 2009-05-26 05:44:31 +0000 | [diff] [blame] | 129 | void Debug::GenerateCallICDebugBreak(MacroAssembler* masm) { |
ricow@chromium.org | 65fae84 | 2010-08-25 15:26:24 +0000 | [diff] [blame] | 130 | // Register state for IC call call (from ic-x64.cc) |
sgjesse@chromium.org | 911335c | 2009-08-19 12:59:44 +0000 | [diff] [blame] | 131 | // ----------- S t a t e ------------- |
ricow@chromium.org | 65fae84 | 2010-08-25 15:26:24 +0000 | [diff] [blame] | 132 | // -- rcx: function name |
sgjesse@chromium.org | 911335c | 2009-08-19 12:59:44 +0000 | [diff] [blame] | 133 | // ----------------------------------- |
ricow@chromium.org | d236f4d | 2010-09-01 06:52:08 +0000 | [diff] [blame^] | 134 | Generate_DebugBreakCallHelper(masm, rcx.bit(), 0, false); |
kasperl@chromium.org | 71affb5 | 2009-05-26 05:44:31 +0000 | [diff] [blame] | 135 | } |
| 136 | |
sgjesse@chromium.org | 911335c | 2009-08-19 12:59:44 +0000 | [diff] [blame] | 137 | |
kasperl@chromium.org | 71affb5 | 2009-05-26 05:44:31 +0000 | [diff] [blame] | 138 | void Debug::GenerateConstructCallDebugBreak(MacroAssembler* masm) { |
sgjesse@chromium.org | 911335c | 2009-08-19 12:59:44 +0000 | [diff] [blame] | 139 | // Register state just before return from JS function (from codegen-x64.cc). |
| 140 | // rax is the actual number of arguments not encoded as a smi, see comment |
| 141 | // above IC call. |
| 142 | // ----------- S t a t e ------------- |
| 143 | // -- rax: number of arguments |
| 144 | // ----------------------------------- |
| 145 | // The number of arguments in rax is not smi encoded. |
ricow@chromium.org | d236f4d | 2010-09-01 06:52:08 +0000 | [diff] [blame^] | 146 | Generate_DebugBreakCallHelper(masm, rdi.bit(), rax.bit(), false); |
kasperl@chromium.org | 71affb5 | 2009-05-26 05:44:31 +0000 | [diff] [blame] | 147 | } |
| 148 | |
sgjesse@chromium.org | 911335c | 2009-08-19 12:59:44 +0000 | [diff] [blame] | 149 | |
kasperl@chromium.org | 71affb5 | 2009-05-26 05:44:31 +0000 | [diff] [blame] | 150 | void Debug::GenerateKeyedLoadICDebugBreak(MacroAssembler* masm) { |
sgjesse@chromium.org | 911335c | 2009-08-19 12:59:44 +0000 | [diff] [blame] | 151 | // Register state for keyed IC load call (from ic-x64.cc). |
| 152 | // ----------- S t a t e ------------- |
lrn@chromium.org | 1af7e1b | 2010-06-07 11:12:01 +0000 | [diff] [blame] | 153 | // -- rax : key |
| 154 | // -- rdx : receiver |
sgjesse@chromium.org | 911335c | 2009-08-19 12:59:44 +0000 | [diff] [blame] | 155 | // ----------------------------------- |
ricow@chromium.org | d236f4d | 2010-09-01 06:52:08 +0000 | [diff] [blame^] | 156 | Generate_DebugBreakCallHelper(masm, rax.bit() | rdx.bit(), 0, false); |
kasperl@chromium.org | 71affb5 | 2009-05-26 05:44:31 +0000 | [diff] [blame] | 157 | } |
| 158 | |
sgjesse@chromium.org | 911335c | 2009-08-19 12:59:44 +0000 | [diff] [blame] | 159 | |
kasperl@chromium.org | 71affb5 | 2009-05-26 05:44:31 +0000 | [diff] [blame] | 160 | void Debug::GenerateKeyedStoreICDebugBreak(MacroAssembler* masm) { |
sgjesse@chromium.org | 911335c | 2009-08-19 12:59:44 +0000 | [diff] [blame] | 161 | // Register state for keyed IC load call (from ic-x64.cc). |
| 162 | // ----------- S t a t e ------------- |
| 163 | // -- rax : value |
erik.corry@gmail.com | 9dfbea4 | 2010-05-21 12:58:28 +0000 | [diff] [blame] | 164 | // -- rcx : key |
| 165 | // -- rdx : receiver |
sgjesse@chromium.org | 911335c | 2009-08-19 12:59:44 +0000 | [diff] [blame] | 166 | // ----------------------------------- |
ricow@chromium.org | d236f4d | 2010-09-01 06:52:08 +0000 | [diff] [blame^] | 167 | Generate_DebugBreakCallHelper( |
| 168 | masm, rax.bit() | rcx.bit() | rdx.bit(), 0, false); |
kasperl@chromium.org | 71affb5 | 2009-05-26 05:44:31 +0000 | [diff] [blame] | 169 | } |
| 170 | |
sgjesse@chromium.org | 911335c | 2009-08-19 12:59:44 +0000 | [diff] [blame] | 171 | |
kasperl@chromium.org | 71affb5 | 2009-05-26 05:44:31 +0000 | [diff] [blame] | 172 | void Debug::GenerateLoadICDebugBreak(MacroAssembler* masm) { |
sgjesse@chromium.org | 911335c | 2009-08-19 12:59:44 +0000 | [diff] [blame] | 173 | // Register state for IC load call (from ic-x64.cc). |
| 174 | // ----------- S t a t e ------------- |
sgjesse@chromium.org | 82dbbab | 2010-06-02 08:57:44 +0000 | [diff] [blame] | 175 | // -- rax : receiver |
sgjesse@chromium.org | 911335c | 2009-08-19 12:59:44 +0000 | [diff] [blame] | 176 | // -- rcx : name |
| 177 | // ----------------------------------- |
ricow@chromium.org | d236f4d | 2010-09-01 06:52:08 +0000 | [diff] [blame^] | 178 | Generate_DebugBreakCallHelper(masm, rax.bit() | rcx.bit(), 0, false); |
kasperl@chromium.org | 71affb5 | 2009-05-26 05:44:31 +0000 | [diff] [blame] | 179 | } |
| 180 | |
sgjesse@chromium.org | 911335c | 2009-08-19 12:59:44 +0000 | [diff] [blame] | 181 | |
kasperl@chromium.org | 71affb5 | 2009-05-26 05:44:31 +0000 | [diff] [blame] | 182 | void Debug::GenerateReturnDebugBreak(MacroAssembler* masm) { |
sgjesse@chromium.org | 911335c | 2009-08-19 12:59:44 +0000 | [diff] [blame] | 183 | // Register state just before return from JS function (from codegen-x64.cc). |
| 184 | // ----------- S t a t e ------------- |
| 185 | // -- rax: return value |
| 186 | // ----------------------------------- |
ricow@chromium.org | d236f4d | 2010-09-01 06:52:08 +0000 | [diff] [blame^] | 187 | Generate_DebugBreakCallHelper(masm, rax.bit(), 0, true); |
kasperl@chromium.org | 71affb5 | 2009-05-26 05:44:31 +0000 | [diff] [blame] | 188 | } |
| 189 | |
sgjesse@chromium.org | 911335c | 2009-08-19 12:59:44 +0000 | [diff] [blame] | 190 | |
kasperl@chromium.org | 71affb5 | 2009-05-26 05:44:31 +0000 | [diff] [blame] | 191 | void Debug::GenerateStoreICDebugBreak(MacroAssembler* masm) { |
sgjesse@chromium.org | b302e56 | 2010-02-03 11:26:59 +0000 | [diff] [blame] | 192 | // Register state for IC store call (from ic-x64.cc). |
sgjesse@chromium.org | 911335c | 2009-08-19 12:59:44 +0000 | [diff] [blame] | 193 | // ----------- S t a t e ------------- |
| 194 | // -- rax : value |
| 195 | // -- rcx : name |
sgjesse@chromium.org | b302e56 | 2010-02-03 11:26:59 +0000 | [diff] [blame] | 196 | // -- rdx : receiver |
sgjesse@chromium.org | 911335c | 2009-08-19 12:59:44 +0000 | [diff] [blame] | 197 | // ----------------------------------- |
ricow@chromium.org | d236f4d | 2010-09-01 06:52:08 +0000 | [diff] [blame^] | 198 | Generate_DebugBreakCallHelper( |
| 199 | masm, rax.bit() | rcx.bit() | rdx.bit(), 0, false); |
kasperl@chromium.org | 71affb5 | 2009-05-26 05:44:31 +0000 | [diff] [blame] | 200 | } |
| 201 | |
sgjesse@chromium.org | 911335c | 2009-08-19 12:59:44 +0000 | [diff] [blame] | 202 | |
kasperl@chromium.org | 71affb5 | 2009-05-26 05:44:31 +0000 | [diff] [blame] | 203 | void Debug::GenerateStubNoRegistersDebugBreak(MacroAssembler* masm) { |
sgjesse@chromium.org | 911335c | 2009-08-19 12:59:44 +0000 | [diff] [blame] | 204 | // Register state for stub CallFunction (from CallFunctionStub in ic-x64.cc). |
| 205 | // ----------- S t a t e ------------- |
| 206 | // No registers used on entry. |
| 207 | // ----------------------------------- |
ricow@chromium.org | d236f4d | 2010-09-01 06:52:08 +0000 | [diff] [blame^] | 208 | Generate_DebugBreakCallHelper(masm, 0, 0, false); |
kasperl@chromium.org | 71affb5 | 2009-05-26 05:44:31 +0000 | [diff] [blame] | 209 | } |
| 210 | |
sgjesse@chromium.org | 911335c | 2009-08-19 12:59:44 +0000 | [diff] [blame] | 211 | |
vegorov@chromium.org | 2356e6f | 2010-06-09 09:38:56 +0000 | [diff] [blame] | 212 | void Debug::GenerateSlot(MacroAssembler* masm) { |
| 213 | // Generate enough nop's to make space for a call instruction. |
| 214 | Label check_codesize; |
| 215 | __ bind(&check_codesize); |
| 216 | __ RecordDebugBreakSlot(); |
| 217 | for (int i = 0; i < Assembler::kDebugBreakSlotLength; i++) { |
| 218 | __ nop(); |
| 219 | } |
| 220 | ASSERT_EQ(Assembler::kDebugBreakSlotLength, |
| 221 | masm->SizeOfCodeGeneratedSince(&check_codesize)); |
| 222 | } |
| 223 | |
| 224 | |
| 225 | void Debug::GenerateSlotDebugBreak(MacroAssembler* masm) { |
| 226 | // In the places where a debug break slot is inserted no registers can contain |
| 227 | // object pointers. |
ricow@chromium.org | d236f4d | 2010-09-01 06:52:08 +0000 | [diff] [blame^] | 228 | Generate_DebugBreakCallHelper(masm, 0, 0, true); |
vegorov@chromium.org | 2356e6f | 2010-06-09 09:38:56 +0000 | [diff] [blame] | 229 | } |
| 230 | |
| 231 | |
ager@chromium.org | 357bf65 | 2010-04-12 11:30:10 +0000 | [diff] [blame] | 232 | void Debug::GeneratePlainReturnLiveEdit(MacroAssembler* masm) { |
ager@chromium.org | ea4f62e | 2010-08-16 16:28:43 +0000 | [diff] [blame] | 233 | masm->ret(0); |
ager@chromium.org | 357bf65 | 2010-04-12 11:30:10 +0000 | [diff] [blame] | 234 | } |
| 235 | |
vegorov@chromium.org | 2356e6f | 2010-06-09 09:38:56 +0000 | [diff] [blame] | 236 | |
ager@chromium.org | 357bf65 | 2010-04-12 11:30:10 +0000 | [diff] [blame] | 237 | void Debug::GenerateFrameDropperLiveEdit(MacroAssembler* masm) { |
ager@chromium.org | ea4f62e | 2010-08-16 16:28:43 +0000 | [diff] [blame] | 238 | ExternalReference restarter_frame_function_slot = |
| 239 | ExternalReference(Debug_Address::RestarterFrameFunctionPointer()); |
| 240 | __ movq(rax, restarter_frame_function_slot); |
| 241 | __ movq(Operand(rax, 0), Immediate(0)); |
| 242 | |
| 243 | // We do not know our frame height, but set rsp based on rbp. |
| 244 | __ lea(rsp, Operand(rbp, -1 * kPointerSize)); |
| 245 | |
| 246 | __ pop(rdi); // Function. |
| 247 | __ pop(rbp); |
| 248 | |
| 249 | // Load context from the function. |
| 250 | __ movq(rsi, FieldOperand(rdi, JSFunction::kContextOffset)); |
| 251 | |
| 252 | // Get function code. |
| 253 | __ movq(rdx, FieldOperand(rdi, JSFunction::kSharedFunctionInfoOffset)); |
| 254 | __ movq(rdx, FieldOperand(rdx, SharedFunctionInfo::kCodeOffset)); |
| 255 | __ lea(rdx, FieldOperand(rdx, Code::kHeaderSize)); |
| 256 | |
| 257 | // Re-run JSFunction, rdi is function, rsi is context. |
| 258 | __ jmp(rdx); |
ager@chromium.org | 357bf65 | 2010-04-12 11:30:10 +0000 | [diff] [blame] | 259 | } |
| 260 | |
ager@chromium.org | ea4f62e | 2010-08-16 16:28:43 +0000 | [diff] [blame] | 261 | const bool Debug::kFrameDropperSupported = true; |
| 262 | |
sgjesse@chromium.org | 911335c | 2009-08-19 12:59:44 +0000 | [diff] [blame] | 263 | #undef __ |
| 264 | |
| 265 | |
ager@chromium.org | 357bf65 | 2010-04-12 11:30:10 +0000 | [diff] [blame] | 266 | |
| 267 | |
kasperl@chromium.org | e959c18 | 2009-07-27 08:59:04 +0000 | [diff] [blame] | 268 | void BreakLocationIterator::ClearDebugBreakAtReturn() { |
sgjesse@chromium.org | 911335c | 2009-08-19 12:59:44 +0000 | [diff] [blame] | 269 | rinfo()->PatchCode(original_rinfo()->pc(), |
sgjesse@chromium.org | ac6aa17 | 2009-12-04 12:29:05 +0000 | [diff] [blame] | 270 | Assembler::kJSReturnSequenceLength); |
kasperl@chromium.org | e959c18 | 2009-07-27 08:59:04 +0000 | [diff] [blame] | 271 | } |
| 272 | |
sgjesse@chromium.org | 911335c | 2009-08-19 12:59:44 +0000 | [diff] [blame] | 273 | |
kasperl@chromium.org | e959c18 | 2009-07-27 08:59:04 +0000 | [diff] [blame] | 274 | bool BreakLocationIterator::IsDebugBreakAtReturn() { |
sgjesse@chromium.org | 911335c | 2009-08-19 12:59:44 +0000 | [diff] [blame] | 275 | return Debug::IsDebugBreakAtReturn(rinfo()); |
kasperl@chromium.org | e959c18 | 2009-07-27 08:59:04 +0000 | [diff] [blame] | 276 | } |
| 277 | |
sgjesse@chromium.org | 911335c | 2009-08-19 12:59:44 +0000 | [diff] [blame] | 278 | |
kasperl@chromium.org | e959c18 | 2009-07-27 08:59:04 +0000 | [diff] [blame] | 279 | void BreakLocationIterator::SetDebugBreakAtReturn() { |
sgjesse@chromium.org | ac6aa17 | 2009-12-04 12:29:05 +0000 | [diff] [blame] | 280 | ASSERT(Assembler::kJSReturnSequenceLength >= |
| 281 | Assembler::kCallInstructionLength); |
ager@chromium.org | a1645e2 | 2009-09-09 19:27:10 +0000 | [diff] [blame] | 282 | rinfo()->PatchCodeWithCall(Debug::debug_break_return()->entry(), |
sgjesse@chromium.org | ac6aa17 | 2009-12-04 12:29:05 +0000 | [diff] [blame] | 283 | Assembler::kJSReturnSequenceLength - Assembler::kCallInstructionLength); |
kasperl@chromium.org | e959c18 | 2009-07-27 08:59:04 +0000 | [diff] [blame] | 284 | } |
| 285 | |
vegorov@chromium.org | 2356e6f | 2010-06-09 09:38:56 +0000 | [diff] [blame] | 286 | |
| 287 | bool BreakLocationIterator::IsDebugBreakAtSlot() { |
| 288 | ASSERT(IsDebugBreakSlot()); |
| 289 | // Check whether the debug break slot instructions have been patched. |
| 290 | return !Assembler::IsNop(rinfo()->pc()); |
| 291 | } |
| 292 | |
| 293 | |
| 294 | void BreakLocationIterator::SetDebugBreakAtSlot() { |
| 295 | ASSERT(IsDebugBreakSlot()); |
| 296 | rinfo()->PatchCodeWithCall( |
| 297 | Debug::debug_break_slot()->entry(), |
| 298 | Assembler::kDebugBreakSlotLength - Assembler::kCallInstructionLength); |
| 299 | } |
| 300 | |
| 301 | |
| 302 | void BreakLocationIterator::ClearDebugBreakAtSlot() { |
| 303 | ASSERT(IsDebugBreakSlot()); |
| 304 | rinfo()->PatchCode(original_rinfo()->pc(), Assembler::kDebugBreakSlotLength); |
| 305 | } |
| 306 | |
| 307 | |
kasperl@chromium.org | 71affb5 | 2009-05-26 05:44:31 +0000 | [diff] [blame] | 308 | #endif // ENABLE_DEBUGGER_SUPPORT |
| 309 | |
| 310 | } } // namespace v8::internal |
erik.corry@gmail.com | 9dfbea4 | 2010-05-21 12:58:28 +0000 | [diff] [blame] | 311 | |
| 312 | #endif // V8_TARGET_ARCH_X64 |