Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(431)

Side by Side Diff: src/debug/mips/debug-mips.cc

Issue 2636913002: [liveedit] reimplement frame restarting. (Closed)
Patch Set: rebase Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/debug/liveedit.cc ('k') | src/debug/mips64/debug-mips64.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #if V8_TARGET_ARCH_MIPS 5 #if V8_TARGET_ARCH_MIPS
6 6
7 #include "src/debug/debug.h" 7 #include "src/debug/debug.h"
8 8
9 #include "src/codegen.h" 9 #include "src/codegen.h"
10 #include "src/debug/liveedit.h" 10 #include "src/debug/liveedit.h"
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
62 Instr current_instr = Assembler::instr_at(pc); 62 Instr current_instr = Assembler::instr_at(pc);
63 return !Assembler::IsNop(current_instr, Assembler::DEBUG_BREAK_NOP); 63 return !Assembler::IsNop(current_instr, Assembler::DEBUG_BREAK_NOP);
64 } 64 }
65 65
66 void DebugCodegen::GenerateDebugBreakStub(MacroAssembler* masm, 66 void DebugCodegen::GenerateDebugBreakStub(MacroAssembler* masm,
67 DebugBreakCallHelperMode mode) { 67 DebugBreakCallHelperMode mode) {
68 __ RecordComment("Debug break"); 68 __ RecordComment("Debug break");
69 { 69 {
70 FrameScope scope(masm, StackFrame::INTERNAL); 70 FrameScope scope(masm, StackFrame::INTERNAL);
71 71
72 // Load padding words on stack.
73 __ li(at, Operand(Smi::FromInt(LiveEdit::kFramePaddingValue)));
74 __ Subu(sp, sp,
75 Operand(kPointerSize * LiveEdit::kFramePaddingInitialSize));
76 for (int i = LiveEdit::kFramePaddingInitialSize - 1; i >= 0; i--) {
77 __ sw(at, MemOperand(sp, kPointerSize * i));
78 }
79 __ li(at, Operand(Smi::FromInt(LiveEdit::kFramePaddingInitialSize)));
80 __ push(at);
81
82 // Push arguments for DebugBreak call. 72 // Push arguments for DebugBreak call.
83 if (mode == SAVE_RESULT_REGISTER) { 73 if (mode == SAVE_RESULT_REGISTER) {
84 // Break on return. 74 // Break on return.
85 __ push(v0); 75 __ push(v0);
86 } else { 76 } else {
87 // Non-return breaks. 77 // Non-return breaks.
88 __ Push(masm->isolate()->factory()->the_hole_value()); 78 __ Push(masm->isolate()->factory()->the_hole_value());
89 } 79 }
90 __ PrepareCEntryArgs(1); 80 __ PrepareCEntryArgs(1);
91 __ PrepareCEntryFunction(ExternalReference( 81 __ PrepareCEntryFunction(ExternalReference(
92 Runtime::FunctionForId(Runtime::kDebugBreak), masm->isolate())); 82 Runtime::FunctionForId(Runtime::kDebugBreak), masm->isolate()));
93 83
94 CEntryStub ceb(masm->isolate(), 1); 84 CEntryStub ceb(masm->isolate(), 1);
95 __ CallStub(&ceb); 85 __ CallStub(&ceb);
96 86
97 if (FLAG_debug_code) { 87 if (FLAG_debug_code) {
98 for (int i = 0; i < kNumJSCallerSaved; i++) { 88 for (int i = 0; i < kNumJSCallerSaved; i++) {
99 Register reg = {JSCallerSavedCode(i)}; 89 Register reg = {JSCallerSavedCode(i)};
100 // Do not clobber v0 if mode is SAVE_RESULT_REGISTER. It will 90 // Do not clobber v0 if mode is SAVE_RESULT_REGISTER. It will
101 // contain return value of the function returned by DebugBreak. 91 // contain return value of the function returned by DebugBreak.
102 if (!(reg.is(v0) && (mode == SAVE_RESULT_REGISTER))) { 92 if (!(reg.is(v0) && (mode == SAVE_RESULT_REGISTER))) {
103 __ li(reg, kDebugZapValue); 93 __ li(reg, kDebugZapValue);
104 } 94 }
105 } 95 }
106 } 96 }
107
108 // Don't bother removing padding bytes pushed on the stack
109 // as the frame is going to be restored right away.
110
111 // Leave the internal frame. 97 // Leave the internal frame.
112 } 98 }
113 99
114 // Now that the break point has been handled, resume normal execution by 100 __ MaybeDropFrames();
115 // jumping to the target address intended by the caller and that was 101
116 // overwritten by the address of DebugBreakXXX. 102 // Return to caller.
117 ExternalReference after_break_target = 103 __ Ret();
118 ExternalReference::debug_after_break_target_address(masm->isolate());
119 __ li(t9, Operand(after_break_target));
120 __ lw(t9, MemOperand(t9));
121 __ Jump(t9);
122 } 104 }
123 105
106 void DebugCodegen::GenerateHandleDebuggerStatement(MacroAssembler* masm) {
107 {
108 FrameScope scope(masm, StackFrame::INTERNAL);
109 __ CallRuntime(Runtime::kHandleDebuggerStatement, 0);
110 }
111 __ MaybeDropFrames();
124 112
125 void DebugCodegen::GenerateFrameDropperLiveEdit(MacroAssembler* masm) { 113 // Return to caller.
126 // We do not know our frame height, but set sp based on fp. 114 __ Ret();
127 __ lw(a1, MemOperand(fp, FrameDropperFrameConstants::kFunctionOffset)); 115 }
116
117 void DebugCodegen::GenerateFrameDropperTrampoline(MacroAssembler* masm) {
118 // Frame is being dropped:
119 // - Drop to the target frame specified by a1.
120 // - Look up current function on the frame.
121 // - Leave the frame.
122 // - Restart the frame by calling the function.
123 __ mov(fp, a1);
124 __ lw(a1, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset));
128 125
129 // Pop return address and frame. 126 // Pop return address and frame.
130 __ LeaveFrame(StackFrame::INTERNAL); 127 __ LeaveFrame(StackFrame::INTERNAL);
131 128
132 ParameterCount dummy(0); 129 __ lw(a0, FieldMemOperand(a1, JSFunction::kSharedFunctionInfoOffset));
133 __ CheckDebugHook(a1, no_reg, dummy, dummy); 130 __ lw(a0,
131 FieldMemOperand(a0, SharedFunctionInfo::kFormalParameterCountOffset));
132 __ mov(a2, a0);
134 133
135 // Load context from the function. 134 ParameterCount dummy1(a2);
136 __ lw(cp, FieldMemOperand(a1, JSFunction::kContextOffset)); 135 ParameterCount dummy2(a0);
137 136 __ InvokeFunction(a1, dummy1, dummy2, JUMP_FUNCTION,
138 // Clear new.target as a safety measure. 137 CheckDebugStepCallWrapper());
139 __ LoadRoot(a3, Heap::kUndefinedValueRootIndex);
140
141 // Get function code.
142 __ lw(at, FieldMemOperand(a1, JSFunction::kSharedFunctionInfoOffset));
143 __ lw(at, FieldMemOperand(at, SharedFunctionInfo::kCodeOffset));
144 __ Addu(t9, at, Operand(Code::kHeaderSize - kHeapObjectTag));
145
146 // Re-run JSFunction, a1 is function, cp is context.
147 __ Jump(t9);
148 } 138 }
149 139
150 140
151 const bool LiveEdit::kFrameDropperSupported = true; 141 const bool LiveEdit::kFrameDropperSupported = true;
152 142
153 #undef __ 143 #undef __
154 144
155 } // namespace internal 145 } // namespace internal
156 } // namespace v8 146 } // namespace v8
157 147
158 #endif // V8_TARGET_ARCH_MIPS 148 #endif // V8_TARGET_ARCH_MIPS
OLDNEW
« no previous file with comments | « src/debug/liveedit.cc ('k') | src/debug/mips64/debug-mips64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698