1 // Copyright 2014 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_PPC
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();
27 }
28
GenerateFrameDropperTrampoline(MacroAssembler * masm)29 void DebugCodegen::GenerateFrameDropperTrampoline(MacroAssembler* masm) {
30 // Frame is being dropped:
31 // - Drop to the target frame specified by r4.
32 // - Look up current function on the frame.
33 // - Leave the frame.
34 // - Restart the frame by calling the function.
35
36 __ mr(fp, r4);
37 __ LoadP(r4, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset));
38 __ LeaveFrame(StackFrame::INTERNAL);
39 __ LoadP(r3, FieldMemOperand(r4, JSFunction::kSharedFunctionInfoOffset));
40 __ lhz(r3,
41 FieldMemOperand(r3, SharedFunctionInfo::kFormalParameterCountOffset));
42 __ mr(r5, r3);
43
44 ParameterCount dummy1(r5);
45 ParameterCount dummy2(r3);
46 __ InvokeFunction(r4, dummy1, dummy2, JUMP_FUNCTION);
47 }
48
49 const bool LiveEdit::kFrameDropperSupported = true;
50
51 #undef __
52 } // namespace internal
53 } // namespace v8
54
55 #endif // V8_TARGET_ARCH_PPC
56