| OLD | NEW |
| 1 // Copyright 2010 the V8 project authors. All rights reserved. | 1 // Copyright 2010 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 236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 247 // object pointers. | 247 // object pointers. |
| 248 Generate_DebugBreakCallHelper(masm, 0, true); | 248 Generate_DebugBreakCallHelper(masm, 0, true); |
| 249 } | 249 } |
| 250 | 250 |
| 251 | 251 |
| 252 void Debug::GeneratePlainReturnLiveEdit(MacroAssembler* masm) { | 252 void Debug::GeneratePlainReturnLiveEdit(MacroAssembler* masm) { |
| 253 masm->ret(0); | 253 masm->ret(0); |
| 254 } | 254 } |
| 255 | 255 |
| 256 | 256 |
| 257 // FrameDropper is a code replacement for a JavaScript frame with possibly | 257 // See documentation in debug.h. |
| 258 // several frames above. | 258 void Debug::GenerateRestarterPatchLiveEdit(MacroAssembler* masm) { |
| 259 // There is no calling conventions here, because it never actually gets called, | 259 #ifdef DEBUG |
| 260 // it only gets returned to. | 260 int offset1 = masm->pc_offset(); |
| 261 // Frame structure (conforms InternalFrame structure): | 261 __ nop(); |
| 262 // -- JSFunction | 262 int offset2 = masm->pc_offset(); |
| 263 // -- code | 263 ASSERT_EQ(offset2 - offset1, kFrameRestarterEntryOffset); |
| 264 // -- SMI maker | 264 #else |
| 265 // -- context | 265 __ nop(); |
| 266 // -- frame base | 266 #endif |
| 267 void Debug::GenerateFrameDropperLiveEdit(MacroAssembler* masm) { | |
| 268 // We do not know our frame height, but set esp based on ebp. | |
| 269 __ lea(esp, Operand(ebp, -4 * kPointerSize)); | |
| 270 | 267 |
| 268 ExternalReference restarted_frame_id = |
| 269 ExternalReference(Debug_Address::RestartedFrameFp()); |
| 270 |
| 271 // Reset restarted_frame_id variable. It means that frame has |
| 272 // actually restarted and has become a regular frame. |
| 273 __ mov(Operand::StaticVariable(restarted_frame_id), Immediate(0)); |
| 274 |
| 275 // Whatever the height the frame was, reset the stack pointer |
| 276 // according to the base pointer. |
| 277 __ lea(esp, Operand(ebp, -2 * kPointerSize)); |
| 278 |
| 279 // Read back registers value. |
| 271 __ pop(edi); // function | 280 __ pop(edi); // function |
| 272 | |
| 273 // Skip code self-reference and marker. | |
| 274 __ add(Operand(esp), Immediate(2 * kPointerSize)); | |
| 275 | |
| 276 __ pop(esi); // Context. | 281 __ pop(esi); // Context. |
| 277 __ pop(ebp); | 282 __ pop(ebp); |
| 278 | 283 |
| 279 // Get function code. | 284 // Get function code. |
| 280 __ mov(edx, FieldOperand(edi, JSFunction::kSharedFunctionInfoOffset)); | 285 __ mov(edx, FieldOperand(edi, JSFunction::kSharedFunctionInfoOffset)); |
| 281 __ mov(edx, FieldOperand(edx, SharedFunctionInfo::kCodeOffset)); | 286 __ mov(edx, FieldOperand(edx, SharedFunctionInfo::kCodeOffset)); |
| 282 __ lea(edx, FieldOperand(edx, Code::kHeaderSize)); | 287 __ lea(edx, FieldOperand(edx, Code::kHeaderSize)); |
| 283 | 288 |
| 284 // Re-run JSFunction, edi is function, esi is context. | 289 // Re-run JSFunction, edi is function, esi is context. |
| 285 __ jmp(Operand(edx)); | 290 __ jmp(Operand(edx)); |
| 286 } | 291 } |
| 287 | 292 |
| 288 #undef __ | 293 #undef __ |
| 289 | 294 |
| 290 | 295 |
| 291 void Debug::SetUpFrameDropperFrame(StackFrame* bottom_js_frame, | 296 const int Debug::kFrameRestarterEntryOffset = 1; |
| 292 Handle<Code> code) { | 297 const int Debug::kRestartedFrameHeight = 3; |
| 293 ASSERT(bottom_js_frame->is_java_script()); | |
| 294 | 298 |
| 295 Address fp = bottom_js_frame->fp(); | |
| 296 Memory::Object_at(fp - 4 * kPointerSize) = | |
| 297 Memory::Object_at(fp - 2 * kPointerSize); // Move edi (function). | |
| 298 | |
| 299 Memory::Object_at(fp - 3 * kPointerSize) = *code; | |
| 300 Memory::Object_at(fp - 2 * kPointerSize) = Smi::FromInt(StackFrame::INTERNAL); | |
| 301 } | |
| 302 const int Debug::kFrameDropperFrameSize = 5; | |
| 303 | 299 |
| 304 | 300 |
| 305 #endif // ENABLE_DEBUGGER_SUPPORT | 301 #endif // ENABLE_DEBUGGER_SUPPORT |
| 306 | 302 |
| 307 } } // namespace v8::internal | 303 } } // namespace v8::internal |
| 308 | 304 |
| 309 #endif // V8_TARGET_ARCH_IA32 | 305 #endif // V8_TARGET_ARCH_IA32 |
| OLD | NEW |