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 || V8_TARGET_ARCH_PPC64
6
7 #include "src/debug/debug.h"
8
9 #include "src/codegen/macro-assembler.h"
10 #include "src/debug/liveedit.h"
11 #include "src/execution/frames-inl.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, StandardFrameConstants::kFunctionOffset));
38 __ LeaveFrame(StackFrame::INTERNAL);
39 __ LoadTaggedPointerField(
40 r3, FieldMemOperand(r4, JSFunction::kSharedFunctionInfoOffset));
41 __ lhz(r3,
42 FieldMemOperand(r3, SharedFunctionInfo::kFormalParameterCountOffset));
43 __ mr(r5, r3);
44
45 __ InvokeFunction(r4, r5, r3, JUMP_FUNCTION);
46 }
47
48 const bool LiveEdit::kFrameDropperSupported = true;
49
50 #undef __
51 } // namespace internal
52 } // namespace v8
53
54 #endif // V8_TARGET_ARCH_PPC || V8_TARGET_ARCH_PPC64
55