1 // Copyright 2013 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_ARM64
6
7 #include "src/debug/debug.h"
8
9 #include "src/arm64/macro-assembler-arm64-inl.h"
10 #include "src/debug/liveedit.h"
11 #include "src/frame-constants.h"
12 #include "src/frames-inl.h"
13 #include "src/objects-inl.h"
14
15 namespace v8 {
16 namespace internal {
17
18 #define __ ACCESS_MASM(masm)
19
GenerateHandleDebuggerStatement(MacroAssembler * masm)20 void DebugCodegen::GenerateHandleDebuggerStatement(MacroAssembler* masm) {
21 {
22 FrameScope scope(masm, StackFrame::INTERNAL);
23 __ CallRuntime(Runtime::kHandleDebuggerStatement, 0);
24 }
25 __ MaybeDropFrames();
26
27 // Return to caller.
28 __ Ret();
29 }
30
GenerateFrameDropperTrampoline(MacroAssembler * masm)31 void DebugCodegen::GenerateFrameDropperTrampoline(MacroAssembler* masm) {
32 // Frame is being dropped:
33 // - Drop to the target frame specified by x1.
34 // - Look up current function on the frame.
35 // - Leave the frame.
36 // - Restart the frame by calling the function.
37 __ Mov(fp, x1);
38 __ Ldr(x1, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset));
39
40 __ Mov(sp, fp);
41 __ Pop(fp, lr); // Frame, Return address.
42
43 __ Ldr(x0, FieldMemOperand(x1, JSFunction::kSharedFunctionInfoOffset));
44 __ Ldrh(x0,
45 FieldMemOperand(x0, SharedFunctionInfo::kFormalParameterCountOffset));
46 __ mov(x2, x0);
47
48 ParameterCount dummy1(x2);
49 ParameterCount dummy2(x0);
50 __ InvokeFunction(x1, dummy1, dummy2, JUMP_FUNCTION);
51 }
52
53
54 const bool LiveEdit::kFrameDropperSupported = true;
55
56 } // namespace internal
57 } // namespace v8
58
59 #undef __
60
61 #endif // V8_TARGET_ARCH_ARM64
62