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
3 // found in the LICENSE file.
4
5 #if V8_TARGET_ARCH_IA32
6
7 #include "src/debug/debug.h"
8
9 #include "src/debug/liveedit.h"
10 #include "src/frames-inl.h"
11 #include "src/macro-assembler.h"
12
13 namespace v8 {
14 namespace internal {
15
16 #define __ ACCESS_MASM(masm)
17
GenerateHandleDebuggerStatement(MacroAssembler * masm)18 void DebugCodegen::GenerateHandleDebuggerStatement(MacroAssembler* masm) {
19 {
20 FrameScope scope(masm, StackFrame::INTERNAL);
21 __ CallRuntime(Runtime::kHandleDebuggerStatement, 0);
22 }
23 __ MaybeDropFrames();
24
25 // Return to caller.
26 __ ret(0);
27 }
28
GenerateFrameDropperTrampoline(MacroAssembler * masm)29 void DebugCodegen::GenerateFrameDropperTrampoline(MacroAssembler* masm) {
30 // Frame is being dropped:
31 // - Drop to the target frame specified by ebx.
32 // - Look up current function on the frame.
33 // - Leave the frame.
34 // - Restart the frame by calling the function.
35 __ mov(ebp, ebx);
36 __ mov(edi, Operand(ebp, JavaScriptFrameConstants::kFunctionOffset));
37 __ leave();
38
39 __ mov(ebx, FieldOperand(edi, JSFunction::kSharedFunctionInfoOffset));
40 __ movzx_w(
41 ebx, FieldOperand(ebx, SharedFunctionInfo::kFormalParameterCountOffset));
42
43 ParameterCount dummy(ebx);
44 __ InvokeFunction(edi, dummy, dummy, JUMP_FUNCTION);
45 }
46
47
48 const bool LiveEdit::kFrameDropperSupported = true;
49
50 #undef __
51
52 } // namespace internal
53 } // namespace v8
54
55 #endif // V8_TARGET_ARCH_IA32
56