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