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 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
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 // FrameDropper is a code replacement for a JavaScript frame with possibly |
258 // several frames above. | 258 // several frames above. |
259 // There is no calling conventions here, because it never actually gets called, | 259 // There is no calling conventions here, because it never actually gets called, |
260 // it only gets returned to. | 260 // it only gets returned to. |
261 // Frame structure (conforms InternalFrame structure): | 261 // Frame structure (conforms InternalFrame structure): |
Søren Thygesen Gjesse
2010/08/12 11:30:48
Remove "conforms InternalFrame structure"?
Peter Rybin
2013/06/26 19:39:23
I do hope it conforms. I need any stack analyzer (
| |
262 // -- JSFunction | |
263 // -- code | 262 // -- code |
264 // -- SMI maker | 263 // -- SMI maker |
265 // -- context | 264 // -- function (slot is called "context") |
266 // -- frame base | 265 // -- frame base |
267 void Debug::GenerateFrameDropperLiveEdit(MacroAssembler* masm) { | 266 void Debug::GenerateFrameDropperLiveEdit(MacroAssembler* masm) { |
268 ExternalReference restarter_frame_function_slot = | 267 ExternalReference restarter_frame_function_slot = |
269 ExternalReference(Debug_Address::RestarterFrameFunctionPointer()); | 268 ExternalReference(Debug_Address::RestarterFrameFunctionPointer()); |
270 __ mov(Operand::StaticVariable(restarter_frame_function_slot), Immediate(0)); | 269 __ mov(Operand::StaticVariable(restarter_frame_function_slot), Immediate(0)); |
271 | 270 |
272 // We do not know our frame height, but set esp based on ebp. | 271 // We do not know our frame height, but set esp based on ebp. |
273 __ lea(esp, Operand(ebp, -4 * kPointerSize)); | 272 __ lea(esp, Operand(ebp, -1 * kPointerSize)); |
274 | 273 |
275 __ pop(edi); // function | 274 __ pop(edi); // Function. |
275 __ pop(ebp); | |
276 | 276 |
277 // Skip code self-reference and marker. | 277 // Load context from the function. |
278 __ add(Operand(esp), Immediate(2 * kPointerSize)); | 278 __ mov(esi, FieldOperand(edi, JSFunction::kContextOffset)); |
279 | |
280 __ pop(esi); // Context. | |
281 __ pop(ebp); | |
282 | 279 |
283 // Get function code. | 280 // Get function code. |
284 __ mov(edx, FieldOperand(edi, JSFunction::kSharedFunctionInfoOffset)); | 281 __ mov(edx, FieldOperand(edi, JSFunction::kSharedFunctionInfoOffset)); |
285 __ mov(edx, FieldOperand(edx, SharedFunctionInfo::kCodeOffset)); | 282 __ mov(edx, FieldOperand(edx, SharedFunctionInfo::kCodeOffset)); |
286 __ lea(edx, FieldOperand(edx, Code::kHeaderSize)); | 283 __ lea(edx, FieldOperand(edx, Code::kHeaderSize)); |
287 | 284 |
288 // Re-run JSFunction, edi is function, esi is context. | 285 // Re-run JSFunction, edi is function, esi is context. |
289 __ jmp(Operand(edx)); | 286 __ jmp(Operand(edx)); |
290 } | 287 } |
291 | 288 |
292 #undef __ | 289 #undef __ |
293 | 290 |
294 | 291 |
295 // TODO(LiveEdit): consider making it platform-independent. | 292 // TODO(LiveEdit): consider making it platform-independent. |
296 // TODO(LiveEdit): use more named constants instead of numbers. | 293 // TODO(LiveEdit): use more named constants instead of numbers. |
297 Object** Debug::SetUpFrameDropperFrame(StackFrame* bottom_js_frame, | 294 Object** Debug::SetUpFrameDropperFrame(StackFrame* bottom_js_frame, |
298 Handle<Code> code) { | 295 Handle<Code> code) { |
299 ASSERT(bottom_js_frame->is_java_script()); | 296 ASSERT(bottom_js_frame->is_java_script()); |
300 | 297 |
301 Address fp = bottom_js_frame->fp(); | 298 Address fp = bottom_js_frame->fp(); |
302 Memory::Object_at(fp - 4 * kPointerSize) = | 299 |
303 Memory::Object_at(fp - 2 * kPointerSize); // Move edi (function). | 300 // Move function pointer into slot that is called referenced |
301 // as StandardFrame::context() | |
302 Memory::Object_at(fp - 1 * kPointerSize) = | |
303 Memory::Object_at(fp - 2 * kPointerSize); | |
304 | 304 |
305 Memory::Object_at(fp - 3 * kPointerSize) = *code; | 305 Memory::Object_at(fp - 3 * kPointerSize) = *code; |
306 Memory::Object_at(fp - 2 * kPointerSize) = Smi::FromInt(StackFrame::INTERNAL); | 306 Memory::Object_at(fp - 2 * kPointerSize) = Smi::FromInt(StackFrame::INTERNAL); |
307 | 307 |
308 return reinterpret_cast<Object**>(&Memory::Object_at(fp - 4 * kPointerSize)); | 308 return reinterpret_cast<Object**>(&Memory::Object_at(fp - 1 * kPointerSize)); |
309 } | 309 } |
310 | 310 |
311 const int Debug::kFrameDropperFrameSize = 5; | 311 const int Debug::kFrameDropperFrameSize = 4; |
312 | 312 |
313 | 313 |
314 #endif // ENABLE_DEBUGGER_SUPPORT | 314 #endif // ENABLE_DEBUGGER_SUPPORT |
315 | 315 |
316 } } // namespace v8::internal | 316 } } // namespace v8::internal |
317 | 317 |
318 #endif // V8_TARGET_ARCH_IA32 | 318 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |