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_MIPS
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 a1.
32   // - Look up current function on the frame.
33   // - Leave the frame.
34   // - Restart the frame by calling the function.
35   __ mov(fp, a1);
36   __ lw(a1, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset));
37 
38   // Pop return address and frame.
39   __ LeaveFrame(StackFrame::INTERNAL);
40 
41   __ lw(a0, FieldMemOperand(a1, JSFunction::kSharedFunctionInfoOffset));
42   __ lhu(a0,
43          FieldMemOperand(a0, SharedFunctionInfo::kFormalParameterCountOffset));
44   __ mov(a2, a0);
45 
46   ParameterCount dummy1(a2);
47   ParameterCount dummy2(a0);
48   __ InvokeFunction(a1, dummy1, dummy2, JUMP_FUNCTION);
49 }
50 
51 
52 const bool LiveEdit::kFrameDropperSupported = true;
53 
54 #undef __
55 
56 }  // namespace internal
57 }  // namespace v8
58 
59 #endif  // V8_TARGET_ARCH_MIPS
60