OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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_IA32 | 7 #if V8_TARGET_ARCH_IA32 |
8 | 8 |
9 #include "codegen.h" | 9 #include "codegen.h" |
10 #include "debug.h" | 10 #include "debug.h" |
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
165 | 165 |
166 // Now that the break point has been handled, resume normal execution by | 166 // Now that the break point has been handled, resume normal execution by |
167 // jumping to the target address intended by the caller and that was | 167 // jumping to the target address intended by the caller and that was |
168 // overwritten by the address of DebugBreakXXX. | 168 // overwritten by the address of DebugBreakXXX. |
169 ExternalReference after_break_target = | 169 ExternalReference after_break_target = |
170 ExternalReference::debug_after_break_target_address(masm->isolate()); | 170 ExternalReference::debug_after_break_target_address(masm->isolate()); |
171 __ jmp(Operand::StaticVariable(after_break_target)); | 171 __ jmp(Operand::StaticVariable(after_break_target)); |
172 } | 172 } |
173 | 173 |
174 | 174 |
175 void Debug::GenerateCallICStubDebugBreak(MacroAssembler* masm) { | 175 void DebugCodegen::GenerateCallICStubDebugBreak(MacroAssembler* masm) { |
176 // Register state for CallICStub | 176 // Register state for CallICStub |
177 // ----------- S t a t e ------------- | 177 // ----------- S t a t e ------------- |
178 // -- edx : type feedback slot (smi) | 178 // -- edx : type feedback slot (smi) |
179 // -- edi : function | 179 // -- edi : function |
180 // ----------------------------------- | 180 // ----------------------------------- |
181 Generate_DebugBreakCallHelper(masm, edx.bit() | edi.bit(), | 181 Generate_DebugBreakCallHelper(masm, edx.bit() | edi.bit(), |
182 0, false); | 182 0, false); |
183 } | 183 } |
184 | 184 |
185 | 185 |
186 void Debug::GenerateLoadICDebugBreak(MacroAssembler* masm) { | 186 void DebugCodegen::GenerateLoadICDebugBreak(MacroAssembler* masm) { |
187 // Register state for IC load call (from ic-ia32.cc). | 187 // Register state for IC load call (from ic-ia32.cc). |
188 // ----------- S t a t e ------------- | 188 // ----------- S t a t e ------------- |
189 // -- ecx : name | 189 // -- ecx : name |
190 // -- edx : receiver | 190 // -- edx : receiver |
191 // ----------------------------------- | 191 // ----------------------------------- |
192 Generate_DebugBreakCallHelper(masm, ecx.bit() | edx.bit(), 0, false); | 192 Generate_DebugBreakCallHelper(masm, ecx.bit() | edx.bit(), 0, false); |
193 } | 193 } |
194 | 194 |
195 | 195 |
196 void Debug::GenerateStoreICDebugBreak(MacroAssembler* masm) { | 196 void DebugCodegen::GenerateStoreICDebugBreak(MacroAssembler* masm) { |
197 // Register state for IC store call (from ic-ia32.cc). | 197 // Register state for IC store call (from ic-ia32.cc). |
198 // ----------- S t a t e ------------- | 198 // ----------- S t a t e ------------- |
199 // -- eax : value | 199 // -- eax : value |
200 // -- ecx : name | 200 // -- ecx : name |
201 // -- edx : receiver | 201 // -- edx : receiver |
202 // ----------------------------------- | 202 // ----------------------------------- |
203 Generate_DebugBreakCallHelper( | 203 Generate_DebugBreakCallHelper( |
204 masm, eax.bit() | ecx.bit() | edx.bit(), 0, false); | 204 masm, eax.bit() | ecx.bit() | edx.bit(), 0, false); |
205 } | 205 } |
206 | 206 |
207 | 207 |
208 void Debug::GenerateKeyedLoadICDebugBreak(MacroAssembler* masm) { | 208 void DebugCodegen::GenerateKeyedLoadICDebugBreak(MacroAssembler* masm) { |
209 // Register state for keyed IC load call (from ic-ia32.cc). | 209 // Register state for keyed IC load call (from ic-ia32.cc). |
210 // ----------- S t a t e ------------- | 210 // ----------- S t a t e ------------- |
211 // -- ecx : key | 211 // -- ecx : key |
212 // -- edx : receiver | 212 // -- edx : receiver |
213 // ----------------------------------- | 213 // ----------------------------------- |
214 Generate_DebugBreakCallHelper(masm, ecx.bit() | edx.bit(), 0, false); | 214 Generate_DebugBreakCallHelper(masm, ecx.bit() | edx.bit(), 0, false); |
215 } | 215 } |
216 | 216 |
217 | 217 |
218 void Debug::GenerateKeyedStoreICDebugBreak(MacroAssembler* masm) { | 218 void DebugCodegen::GenerateKeyedStoreICDebugBreak(MacroAssembler* masm) { |
219 // Register state for keyed IC load call (from ic-ia32.cc). | 219 // Register state for keyed IC load call (from ic-ia32.cc). |
220 // ----------- S t a t e ------------- | 220 // ----------- S t a t e ------------- |
221 // -- eax : value | 221 // -- eax : value |
222 // -- ecx : key | 222 // -- ecx : key |
223 // -- edx : receiver | 223 // -- edx : receiver |
224 // ----------------------------------- | 224 // ----------------------------------- |
225 Generate_DebugBreakCallHelper( | 225 Generate_DebugBreakCallHelper( |
226 masm, eax.bit() | ecx.bit() | edx.bit(), 0, false); | 226 masm, eax.bit() | ecx.bit() | edx.bit(), 0, false); |
227 } | 227 } |
228 | 228 |
229 | 229 |
230 void Debug::GenerateCompareNilICDebugBreak(MacroAssembler* masm) { | 230 void DebugCodegen::GenerateCompareNilICDebugBreak(MacroAssembler* masm) { |
231 // Register state for CompareNil IC | 231 // Register state for CompareNil IC |
232 // ----------- S t a t e ------------- | 232 // ----------- S t a t e ------------- |
233 // -- eax : value | 233 // -- eax : value |
234 // ----------------------------------- | 234 // ----------------------------------- |
235 Generate_DebugBreakCallHelper(masm, eax.bit(), 0, false); | 235 Generate_DebugBreakCallHelper(masm, eax.bit(), 0, false); |
236 } | 236 } |
237 | 237 |
238 | 238 |
239 void Debug::GenerateReturnDebugBreak(MacroAssembler* masm) { | 239 void DebugCodegen::GenerateReturnDebugBreak(MacroAssembler* masm) { |
240 // Register state just before return from JS function (from codegen-ia32.cc). | 240 // Register state just before return from JS function (from codegen-ia32.cc). |
241 // ----------- S t a t e ------------- | 241 // ----------- S t a t e ------------- |
242 // -- eax: return value | 242 // -- eax: return value |
243 // ----------------------------------- | 243 // ----------------------------------- |
244 Generate_DebugBreakCallHelper(masm, eax.bit(), 0, true); | 244 Generate_DebugBreakCallHelper(masm, eax.bit(), 0, true); |
245 } | 245 } |
246 | 246 |
247 | 247 |
248 void Debug::GenerateCallFunctionStubDebugBreak(MacroAssembler* masm) { | 248 void DebugCodegen::GenerateCallFunctionStubDebugBreak(MacroAssembler* masm) { |
249 // Register state for CallFunctionStub (from code-stubs-ia32.cc). | 249 // Register state for CallFunctionStub (from code-stubs-ia32.cc). |
250 // ----------- S t a t e ------------- | 250 // ----------- S t a t e ------------- |
251 // -- edi: function | 251 // -- edi: function |
252 // ----------------------------------- | 252 // ----------------------------------- |
253 Generate_DebugBreakCallHelper(masm, edi.bit(), 0, false); | 253 Generate_DebugBreakCallHelper(masm, edi.bit(), 0, false); |
254 } | 254 } |
255 | 255 |
256 | 256 |
257 void Debug::GenerateCallConstructStubDebugBreak(MacroAssembler* masm) { | 257 void DebugCodegen::GenerateCallConstructStubDebugBreak(MacroAssembler* masm) { |
258 // Register state for CallConstructStub (from code-stubs-ia32.cc). | 258 // Register state for CallConstructStub (from code-stubs-ia32.cc). |
259 // eax is the actual number of arguments not encoded as a smi see comment | 259 // eax is the actual number of arguments not encoded as a smi see comment |
260 // above IC call. | 260 // above IC call. |
261 // ----------- S t a t e ------------- | 261 // ----------- S t a t e ------------- |
262 // -- eax: number of arguments (not smi) | 262 // -- eax: number of arguments (not smi) |
263 // -- edi: constructor function | 263 // -- edi: constructor function |
264 // ----------------------------------- | 264 // ----------------------------------- |
265 // The number of arguments in eax is not smi encoded. | 265 // The number of arguments in eax is not smi encoded. |
266 Generate_DebugBreakCallHelper(masm, edi.bit(), eax.bit(), false); | 266 Generate_DebugBreakCallHelper(masm, edi.bit(), eax.bit(), false); |
267 } | 267 } |
268 | 268 |
269 | 269 |
270 void Debug::GenerateCallConstructStubRecordDebugBreak(MacroAssembler* masm) { | 270 void DebugCodegen::GenerateCallConstructStubRecordDebugBreak( |
| 271 MacroAssembler* masm) { |
271 // Register state for CallConstructStub (from code-stubs-ia32.cc). | 272 // Register state for CallConstructStub (from code-stubs-ia32.cc). |
272 // eax is the actual number of arguments not encoded as a smi see comment | 273 // eax is the actual number of arguments not encoded as a smi see comment |
273 // above IC call. | 274 // above IC call. |
274 // ----------- S t a t e ------------- | 275 // ----------- S t a t e ------------- |
275 // -- eax: number of arguments (not smi) | 276 // -- eax: number of arguments (not smi) |
276 // -- ebx: feedback array | 277 // -- ebx: feedback array |
277 // -- edx: feedback slot (smi) | 278 // -- edx: feedback slot (smi) |
278 // -- edi: constructor function | 279 // -- edi: constructor function |
279 // ----------------------------------- | 280 // ----------------------------------- |
280 // The number of arguments in eax is not smi encoded. | 281 // The number of arguments in eax is not smi encoded. |
281 Generate_DebugBreakCallHelper(masm, ebx.bit() | edx.bit() | edi.bit(), | 282 Generate_DebugBreakCallHelper(masm, ebx.bit() | edx.bit() | edi.bit(), |
282 eax.bit(), false); | 283 eax.bit(), false); |
283 } | 284 } |
284 | 285 |
285 | 286 |
286 void Debug::GenerateSlot(MacroAssembler* masm) { | 287 void DebugCodegen::GenerateSlot(MacroAssembler* masm) { |
287 // Generate enough nop's to make space for a call instruction. | 288 // Generate enough nop's to make space for a call instruction. |
288 Label check_codesize; | 289 Label check_codesize; |
289 __ bind(&check_codesize); | 290 __ bind(&check_codesize); |
290 __ RecordDebugBreakSlot(); | 291 __ RecordDebugBreakSlot(); |
291 __ Nop(Assembler::kDebugBreakSlotLength); | 292 __ Nop(Assembler::kDebugBreakSlotLength); |
292 ASSERT_EQ(Assembler::kDebugBreakSlotLength, | 293 ASSERT_EQ(Assembler::kDebugBreakSlotLength, |
293 masm->SizeOfCodeGeneratedSince(&check_codesize)); | 294 masm->SizeOfCodeGeneratedSince(&check_codesize)); |
294 } | 295 } |
295 | 296 |
296 | 297 |
297 void Debug::GenerateSlotDebugBreak(MacroAssembler* masm) { | 298 void DebugCodegen::GenerateSlotDebugBreak(MacroAssembler* masm) { |
298 // In the places where a debug break slot is inserted no registers can contain | 299 // In the places where a debug break slot is inserted no registers can contain |
299 // object pointers. | 300 // object pointers. |
300 Generate_DebugBreakCallHelper(masm, 0, 0, true); | 301 Generate_DebugBreakCallHelper(masm, 0, 0, true); |
301 } | 302 } |
302 | 303 |
303 | 304 |
304 void Debug::GeneratePlainReturnLiveEdit(MacroAssembler* masm) { | 305 void DebugCodegen::GeneratePlainReturnLiveEdit(MacroAssembler* masm) { |
305 masm->ret(0); | 306 masm->ret(0); |
306 } | 307 } |
307 | 308 |
308 | 309 |
309 void Debug::GenerateFrameDropperLiveEdit(MacroAssembler* masm) { | 310 void DebugCodegen::GenerateFrameDropperLiveEdit(MacroAssembler* masm) { |
310 ExternalReference restarter_frame_function_slot = | 311 ExternalReference restarter_frame_function_slot = |
311 ExternalReference::debug_restarter_frame_function_pointer_address( | 312 ExternalReference::debug_restarter_frame_function_pointer_address( |
312 masm->isolate()); | 313 masm->isolate()); |
313 __ mov(Operand::StaticVariable(restarter_frame_function_slot), Immediate(0)); | 314 __ mov(Operand::StaticVariable(restarter_frame_function_slot), Immediate(0)); |
314 | 315 |
315 // We do not know our frame height, but set esp based on ebp. | 316 // We do not know our frame height, but set esp based on ebp. |
316 __ lea(esp, Operand(ebp, -1 * kPointerSize)); | 317 __ lea(esp, Operand(ebp, -1 * kPointerSize)); |
317 | 318 |
318 __ pop(edi); // Function. | 319 __ pop(edi); // Function. |
319 __ pop(ebp); | 320 __ pop(ebp); |
(...skipping 10 matching lines...) Expand all Loading... |
330 __ jmp(edx); | 331 __ jmp(edx); |
331 } | 332 } |
332 | 333 |
333 const bool Debug::kFrameDropperSupported = true; | 334 const bool Debug::kFrameDropperSupported = true; |
334 | 335 |
335 #undef __ | 336 #undef __ |
336 | 337 |
337 } } // namespace v8::internal | 338 } } // namespace v8::internal |
338 | 339 |
339 #endif // V8_TARGET_ARCH_IA32 | 340 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |