Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(144)

Side by Side Diff: src/ia32/debug-ia32.cc

Issue 3120011: LiveEdit: implement stack manipulations for x64 (Closed)
Patch Set: follow codereview Created 10 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/debug.cc ('k') | src/liveedit.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
258 // several frames above.
259 // There is no calling conventions here, because it never actually gets called,
260 // it only gets returned to.
261 // Frame structure (conforms InternalFrame structure):
262 // -- code
263 // -- SMI maker
264 // -- function (slot is called "context")
265 // -- frame base
266 void Debug::GenerateFrameDropperLiveEdit(MacroAssembler* masm) { 257 void Debug::GenerateFrameDropperLiveEdit(MacroAssembler* masm) {
267 ExternalReference restarter_frame_function_slot = 258 ExternalReference restarter_frame_function_slot =
268 ExternalReference(Debug_Address::RestarterFrameFunctionPointer()); 259 ExternalReference(Debug_Address::RestarterFrameFunctionPointer());
269 __ mov(Operand::StaticVariable(restarter_frame_function_slot), Immediate(0)); 260 __ mov(Operand::StaticVariable(restarter_frame_function_slot), Immediate(0));
270 261
271 // We do not know our frame height, but set esp based on ebp. 262 // We do not know our frame height, but set esp based on ebp.
272 __ lea(esp, Operand(ebp, -1 * kPointerSize)); 263 __ lea(esp, Operand(ebp, -1 * kPointerSize));
273 264
274 __ pop(edi); // Function. 265 __ pop(edi); // Function.
275 __ pop(ebp); 266 __ pop(ebp);
276 267
277 // Load context from the function. 268 // Load context from the function.
278 __ mov(esi, FieldOperand(edi, JSFunction::kContextOffset)); 269 __ mov(esi, FieldOperand(edi, JSFunction::kContextOffset));
279 270
280 // Get function code. 271 // Get function code.
281 __ mov(edx, FieldOperand(edi, JSFunction::kSharedFunctionInfoOffset)); 272 __ mov(edx, FieldOperand(edi, JSFunction::kSharedFunctionInfoOffset));
282 __ mov(edx, FieldOperand(edx, SharedFunctionInfo::kCodeOffset)); 273 __ mov(edx, FieldOperand(edx, SharedFunctionInfo::kCodeOffset));
283 __ lea(edx, FieldOperand(edx, Code::kHeaderSize)); 274 __ lea(edx, FieldOperand(edx, Code::kHeaderSize));
284 275
285 // Re-run JSFunction, edi is function, esi is context. 276 // Re-run JSFunction, edi is function, esi is context.
286 __ jmp(Operand(edx)); 277 __ jmp(Operand(edx));
287 } 278 }
288 279
280 const bool Debug::kFrameDropperSupported = true;
281
289 #undef __ 282 #undef __
290 283
291
292 // TODO(LiveEdit): consider making it platform-independent.
293 // TODO(LiveEdit): use more named constants instead of numbers.
294 Object** Debug::SetUpFrameDropperFrame(StackFrame* bottom_js_frame,
295 Handle<Code> code) {
296 ASSERT(bottom_js_frame->is_java_script());
297
298 Address fp = bottom_js_frame->fp();
299
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
305 Memory::Object_at(fp - 3 * kPointerSize) = *code;
306 Memory::Object_at(fp - 2 * kPointerSize) = Smi::FromInt(StackFrame::INTERNAL);
307
308 return reinterpret_cast<Object**>(&Memory::Object_at(fp - 1 * kPointerSize));
309 }
310
311 const int Debug::kFrameDropperFrameSize = 4;
312
313
314 #endif // ENABLE_DEBUGGER_SUPPORT 284 #endif // ENABLE_DEBUGGER_SUPPORT
315 285
316 } } // namespace v8::internal 286 } } // namespace v8::internal
317 287
318 #endif // V8_TARGET_ARCH_IA32 288 #endif // V8_TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « src/debug.cc ('k') | src/liveedit.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698