OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
88 | 88 |
89 void BreakLocationIterator::ClearDebugBreakAtSlot() { | 89 void BreakLocationIterator::ClearDebugBreakAtSlot() { |
90 ASSERT(IsDebugBreakSlot()); | 90 ASSERT(IsDebugBreakSlot()); |
91 rinfo()->PatchCode(original_rinfo()->pc(), Assembler::kDebugBreakSlotLength); | 91 rinfo()->PatchCode(original_rinfo()->pc(), Assembler::kDebugBreakSlotLength); |
92 } | 92 } |
93 | 93 |
94 const bool Debug::FramePaddingLayout::kIsSupported = true; | 94 const bool Debug::FramePaddingLayout::kIsSupported = true; |
95 | 95 |
96 | 96 |
97 #define __ ACCESS_MASM(masm) | 97 #define __ ACCESS_MASM(masm) |
| 98 #define __q __ |
98 | 99 |
99 | 100 |
100 static void Generate_DebugBreakCallHelper(MacroAssembler* masm, | 101 static void Generate_DebugBreakCallHelper(MacroAssembler* masm, |
101 RegList object_regs, | 102 RegList object_regs, |
102 RegList non_object_regs, | 103 RegList non_object_regs, |
103 bool convert_call_to_jmp) { | 104 bool convert_call_to_jmp) { |
104 // Enter an internal frame. | 105 // Enter an internal frame. |
105 { | 106 { |
106 FrameScope scope(masm, StackFrame::INTERNAL); | 107 FrameScope scope(masm, StackFrame::INTERNAL); |
107 | 108 |
(...skipping 11 matching lines...) Expand all Loading... |
119 ASSERT((object_regs & non_object_regs) == 0); | 120 ASSERT((object_regs & non_object_regs) == 0); |
120 for (int i = 0; i < kNumJSCallerSaved; i++) { | 121 for (int i = 0; i < kNumJSCallerSaved; i++) { |
121 int r = JSCallerSavedCode(i); | 122 int r = JSCallerSavedCode(i); |
122 Register reg = { r }; | 123 Register reg = { r }; |
123 ASSERT(!reg.is(kScratchRegister)); | 124 ASSERT(!reg.is(kScratchRegister)); |
124 if ((object_regs & (1 << r)) != 0) { | 125 if ((object_regs & (1 << r)) != 0) { |
125 __ push(reg); | 126 __ push(reg); |
126 } | 127 } |
127 // Store the 64-bit value as two smis. | 128 // Store the 64-bit value as two smis. |
128 if ((non_object_regs & (1 << r)) != 0) { | 129 if ((non_object_regs & (1 << r)) != 0) { |
| 130 #ifndef V8_TARGET_ARCH_X32 |
129 __ movq(kScratchRegister, reg); | 131 __ movq(kScratchRegister, reg); |
130 __ Integer32ToSmi(reg, reg); | 132 __ Integer32ToSmi(reg, reg); |
131 __ push(reg); | 133 __ push(reg); |
132 __ sar(kScratchRegister, Immediate(32)); | 134 __ sar(kScratchRegister, Immediate(32)); |
133 __ Integer32ToSmi(kScratchRegister, kScratchRegister); | 135 __ Integer32ToSmi(kScratchRegister, kScratchRegister); |
134 __ push(kScratchRegister); | 136 __ push(kScratchRegister); |
| 137 #else |
| 138 if (FLAG_debug_code) { |
| 139 __ testl(reg, Immediate(0xc0000000)); |
| 140 __ Assert(zero, "Unable to encode value as smi"); |
| 141 } |
| 142 __ Integer32ToSmi(reg, reg); |
| 143 __ Push(reg); |
| 144 #endif |
135 } | 145 } |
136 } | 146 } |
137 | 147 |
138 #ifdef DEBUG | 148 #ifdef DEBUG |
139 __ RecordComment("// Calling from debug break to runtime - come in - over"); | 149 __ RecordComment("// Calling from debug break to runtime - come in - over"); |
140 #endif | 150 #endif |
141 __ Set(rax, 0); // No arguments (argc == 0). | 151 __ Set(rax, 0); // No arguments (argc == 0). |
142 __ movq(rbx, ExternalReference::debug_break(masm->isolate())); | 152 __ movq(rbx, ExternalReference::debug_break(masm->isolate())); |
143 | 153 |
144 CEntryStub ceb(1); | 154 CEntryStub ceb(1); |
145 __ CallStub(&ceb); | 155 __ CallStub(&ceb); |
146 | 156 |
147 // Restore the register values from the expression stack. | 157 // Restore the register values from the expression stack. |
148 for (int i = kNumJSCallerSaved - 1; i >= 0; i--) { | 158 for (int i = kNumJSCallerSaved - 1; i >= 0; i--) { |
149 int r = JSCallerSavedCode(i); | 159 int r = JSCallerSavedCode(i); |
150 Register reg = { r }; | 160 Register reg = { r }; |
151 if (FLAG_debug_code) { | 161 if (FLAG_debug_code) { |
152 __ Set(reg, kDebugZapValue); | 162 __ Set(reg, kDebugZapValue); |
153 } | 163 } |
154 if ((object_regs & (1 << r)) != 0) { | 164 if ((object_regs & (1 << r)) != 0) { |
155 __ pop(reg); | 165 __ pop(reg); |
156 } | 166 } |
157 // Reconstruct the 64-bit value from two smis. | 167 // Reconstruct the 64-bit value from two smis. |
158 if ((non_object_regs & (1 << r)) != 0) { | 168 if ((non_object_regs & (1 << r)) != 0) { |
| 169 #ifndef V8_TARGET_ARCH_X32 |
159 __ pop(kScratchRegister); | 170 __ pop(kScratchRegister); |
160 __ SmiToInteger32(kScratchRegister, kScratchRegister); | 171 __ SmiToInteger32(kScratchRegister, kScratchRegister); |
161 __ shl(kScratchRegister, Immediate(32)); | 172 __ shl(kScratchRegister, Immediate(32)); |
162 __ pop(reg); | 173 __ pop(reg); |
163 __ SmiToInteger32(reg, reg); | 174 __ SmiToInteger32(reg, reg); |
164 __ or_(reg, kScratchRegister); | 175 __ or_(reg, kScratchRegister); |
| 176 #else |
| 177 __ Pop(reg); |
| 178 __ SmiToInteger32(reg, reg); |
| 179 #endif |
165 } | 180 } |
166 } | 181 } |
167 | 182 |
168 // Read current padding counter and skip corresponding number of words. | 183 // Read current padding counter and skip corresponding number of words. |
169 __ pop(kScratchRegister); | 184 __ pop(kScratchRegister); |
170 __ SmiToInteger32(kScratchRegister, kScratchRegister); | 185 __ SmiToInteger32(kScratchRegister, kScratchRegister); |
171 __ lea(rsp, Operand(rsp, kScratchRegister, times_pointer_size, 0)); | 186 __ lea(rsp, Operand(rsp, kScratchRegister, times_pointer_size, 0)); |
172 | 187 |
173 // Get rid of the internal frame. | 188 // Get rid of the internal frame. |
174 } | 189 } |
175 | 190 |
176 // If this call did not replace a call but patched other code then there will | 191 // If this call did not replace a call but patched other code then there will |
177 // be an unwanted return address left on the stack. Here we get rid of that. | 192 // be an unwanted return address left on the stack. Here we get rid of that. |
178 if (convert_call_to_jmp) { | 193 if (convert_call_to_jmp) { |
179 __ addq(rsp, Immediate(kPointerSize)); | 194 __q addq(rsp, Immediate(kPointerSize)); |
180 } | 195 } |
181 | 196 |
182 // Now that the break point has been handled, resume normal execution by | 197 // Now that the break point has been handled, resume normal execution by |
183 // jumping to the target address intended by the caller and that was | 198 // jumping to the target address intended by the caller and that was |
184 // overwritten by the address of DebugBreakXXX. | 199 // overwritten by the address of DebugBreakXXX. |
185 ExternalReference after_break_target = | 200 ExternalReference after_break_target = |
186 ExternalReference(Debug_Address::AfterBreakTarget(), masm->isolate()); | 201 ExternalReference(Debug_Address::AfterBreakTarget(), masm->isolate()); |
187 __ movq(kScratchRegister, after_break_target); | 202 __ movq(kScratchRegister, after_break_target); |
| 203 #ifndef V8_TARGET_ARCH_X32 |
188 __ jmp(Operand(kScratchRegister, 0)); | 204 __ jmp(Operand(kScratchRegister, 0)); |
| 205 #else |
| 206 __ Jump(Operand(kScratchRegister, 0)); |
| 207 #endif |
189 } | 208 } |
190 | 209 |
191 | 210 |
192 void Debug::GenerateLoadICDebugBreak(MacroAssembler* masm) { | 211 void Debug::GenerateLoadICDebugBreak(MacroAssembler* masm) { |
193 // Register state for IC load call (from ic-x64.cc). | 212 // Register state for IC load call (from ic-x64.cc). |
194 // ----------- S t a t e ------------- | 213 // ----------- S t a t e ------------- |
195 // -- rax : receiver | 214 // -- rax : receiver |
196 // -- rcx : name | 215 // -- rcx : name |
197 // ----------------------------------- | 216 // ----------------------------------- |
198 Generate_DebugBreakCallHelper(masm, rax.bit() | rcx.bit(), 0, false); | 217 Generate_DebugBreakCallHelper(masm, rax.bit() | rcx.bit(), 0, false); |
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
347 __ movq(rdx, FieldOperand(rdi, JSFunction::kSharedFunctionInfoOffset)); | 366 __ movq(rdx, FieldOperand(rdi, JSFunction::kSharedFunctionInfoOffset)); |
348 __ movq(rdx, FieldOperand(rdx, SharedFunctionInfo::kCodeOffset)); | 367 __ movq(rdx, FieldOperand(rdx, SharedFunctionInfo::kCodeOffset)); |
349 __ lea(rdx, FieldOperand(rdx, Code::kHeaderSize)); | 368 __ lea(rdx, FieldOperand(rdx, Code::kHeaderSize)); |
350 | 369 |
351 // Re-run JSFunction, rdi is function, rsi is context. | 370 // Re-run JSFunction, rdi is function, rsi is context. |
352 __ jmp(rdx); | 371 __ jmp(rdx); |
353 } | 372 } |
354 | 373 |
355 const bool Debug::kFrameDropperSupported = true; | 374 const bool Debug::kFrameDropperSupported = true; |
356 | 375 |
| 376 #undef __q |
357 #undef __ | 377 #undef __ |
358 | 378 |
359 #endif // ENABLE_DEBUGGER_SUPPORT | 379 #endif // ENABLE_DEBUGGER_SUPPORT |
360 | 380 |
361 } } // namespace v8::internal | 381 } } // namespace v8::internal |
362 | 382 |
363 #endif // V8_TARGET_ARCH_X64 | 383 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |