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

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

Issue 1222093007: Debugger: use debug break slot to break on call. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: rebased and addressed comments Created 5 years, 5 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/mips64/assembler-mips64.h ('k') | src/mips64/full-codegen-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 5
6 6
7 #include "src/v8.h" 7 #include "src/v8.h"
8 8
9 #if V8_TARGET_ARCH_MIPS64 9 #if V8_TARGET_ARCH_MIPS64
10 10
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 Operand(reinterpret_cast<int64_t>( 56 Operand(reinterpret_cast<int64_t>(
57 debug_info_->GetIsolate()->builtins()->Slot_DebugBreak()->entry())), 57 debug_info_->GetIsolate()->builtins()->Slot_DebugBreak()->entry())),
58 ADDRESS_LOAD); 58 ADDRESS_LOAD);
59 patcher.masm()->Call(v8::internal::t9); 59 patcher.masm()->Call(v8::internal::t9);
60 } 60 }
61 61
62 62
63 #define __ ACCESS_MASM(masm) 63 #define __ ACCESS_MASM(masm)
64 64
65 65
66
67 static void Generate_DebugBreakCallHelper(MacroAssembler* masm, 66 static void Generate_DebugBreakCallHelper(MacroAssembler* masm,
68 RegList object_regs, 67 RegList object_regs) {
69 RegList non_object_regs) {
70 { 68 {
71 FrameScope scope(masm, StackFrame::INTERNAL); 69 FrameScope scope(masm, StackFrame::INTERNAL);
72 70
73 // Load padding words on stack. 71 // Load padding words on stack.
74 __ li(at, Operand(Smi::FromInt(LiveEdit::kFramePaddingValue))); 72 __ li(at, Operand(Smi::FromInt(LiveEdit::kFramePaddingValue)));
75 __ Dsubu(sp, sp, 73 __ Dsubu(sp, sp,
76 Operand(kPointerSize * LiveEdit::kFramePaddingInitialSize)); 74 Operand(kPointerSize * LiveEdit::kFramePaddingInitialSize));
77 for (int i = LiveEdit::kFramePaddingInitialSize - 1; i >= 0; i--) { 75 for (int i = LiveEdit::kFramePaddingInitialSize - 1; i >= 0; i--) {
78 __ sd(at, MemOperand(sp, kPointerSize * i)); 76 __ sd(at, MemOperand(sp, kPointerSize * i));
79 } 77 }
80 __ li(at, Operand(Smi::FromInt(LiveEdit::kFramePaddingInitialSize))); 78 __ li(at, Operand(Smi::FromInt(LiveEdit::kFramePaddingInitialSize)));
81 __ push(at); 79 __ push(at);
82 80
83 81
84 // TODO(plind): This needs to be revised to store pairs of smi's per 82 // TODO(plind): This needs to be revised to store pairs of smi's per
85 // the other 64-bit arch's. 83 // the other 64-bit arch's.
86 84
87 // Store the registers containing live values on the expression stack to 85 // Store the registers containing live values on the expression stack to
88 // make sure that these are correctly updated during GC. Non object values 86 // make sure that these are correctly updated during GC. Non object values
89 // are stored as a smi causing it to be untouched by GC. 87 // are stored as a smi causing it to be untouched by GC.
90 DCHECK((object_regs & ~kJSCallerSaved) == 0); 88 DCHECK((object_regs & ~kJSCallerSaved) == 0);
91 DCHECK((non_object_regs & ~kJSCallerSaved) == 0);
92 DCHECK((object_regs & non_object_regs) == 0);
93 for (int i = 0; i < kNumJSCallerSaved; i++) { 89 for (int i = 0; i < kNumJSCallerSaved; i++) {
94 int r = JSCallerSavedCode(i); 90 int r = JSCallerSavedCode(i);
95 Register reg = { r }; 91 Register reg = { r };
96 if ((object_regs & (1 << r)) != 0) { 92 if ((object_regs & (1 << r)) != 0) {
97 __ push(reg); 93 __ push(reg);
98 } 94 }
99 if ((non_object_regs & (1 << r)) != 0) {
100 __ PushRegisterAsTwoSmis(reg);
101 }
102 } 95 }
103 96
104 #ifdef DEBUG 97 #ifdef DEBUG
105 __ RecordComment("// Calling from debug break to runtime - come in - over"); 98 __ RecordComment("// Calling from debug break to runtime - come in - over");
106 #endif 99 #endif
107 __ PrepareCEntryArgs(0); // No arguments. 100 __ PrepareCEntryArgs(0); // No arguments.
108 __ PrepareCEntryFunction(ExternalReference::debug_break(masm->isolate())); 101 __ PrepareCEntryFunction(ExternalReference::debug_break(masm->isolate()));
109 102
110 CEntryStub ceb(masm->isolate(), 1); 103 CEntryStub ceb(masm->isolate(), 1);
111 __ CallStub(&ceb); 104 __ CallStub(&ceb);
112 105
113 // Restore the register values from the expression stack. 106 // Restore the register values from the expression stack.
114 for (int i = kNumJSCallerSaved - 1; i >= 0; i--) { 107 for (int i = kNumJSCallerSaved - 1; i >= 0; i--) {
115 int r = JSCallerSavedCode(i); 108 int r = JSCallerSavedCode(i);
116 Register reg = { r }; 109 Register reg = { r };
117 if ((non_object_regs & (1 << r)) != 0) {
118 __ PopRegisterAsTwoSmis(reg, at);
119 }
120 if ((object_regs & (1 << r)) != 0) { 110 if ((object_regs & (1 << r)) != 0) {
121 __ pop(reg); 111 __ pop(reg);
122 } 112 }
123 if (FLAG_debug_code && 113 if (FLAG_debug_code && ((object_regs & (1 << r)) == 0)) {
124 (((object_regs |non_object_regs) & (1 << r)) == 0)) {
125 __ li(reg, kDebugZapValue); 114 __ li(reg, kDebugZapValue);
126 } 115 }
127 } 116 }
128 117
129 // Don't bother removing padding bytes pushed on the stack 118 // Don't bother removing padding bytes pushed on the stack
130 // as the frame is going to be restored right away. 119 // as the frame is going to be restored right away.
131 120
132 // Leave the internal frame. 121 // Leave the internal frame.
133 } 122 }
134 123
135 // Now that the break point has been handled, resume normal execution by 124 // Now that the break point has been handled, resume normal execution by
136 // jumping to the target address intended by the caller and that was 125 // jumping to the target address intended by the caller and that was
137 // overwritten by the address of DebugBreakXXX. 126 // overwritten by the address of DebugBreakXXX.
138 ExternalReference after_break_target = 127 ExternalReference after_break_target =
139 ExternalReference::debug_after_break_target_address(masm->isolate()); 128 ExternalReference::debug_after_break_target_address(masm->isolate());
140 __ li(t9, Operand(after_break_target)); 129 __ li(t9, Operand(after_break_target));
141 __ ld(t9, MemOperand(t9)); 130 __ ld(t9, MemOperand(t9));
142 __ Jump(t9); 131 __ Jump(t9);
143 } 132 }
144 133
145 134
146 void DebugCodegen::GenerateCallICStubDebugBreak(MacroAssembler* masm) {
147 // Register state for CallICStub
148 // ----------- S t a t e -------------
149 // -- a1 : function
150 // -- a3 : slot in feedback array (smi)
151 // -----------------------------------
152 Generate_DebugBreakCallHelper(masm, a1.bit() | a3.bit(), 0);
153 }
154
155
156 void DebugCodegen::GenerateReturnDebugBreak(MacroAssembler* masm) { 135 void DebugCodegen::GenerateReturnDebugBreak(MacroAssembler* masm) {
157 // In places other than IC call sites it is expected that v0 is TOS which 136 // In places other than IC call sites it is expected that v0 is TOS which
158 // is an object - this is not generally the case so this should be used with 137 // is an object - this is not generally the case so this should be used with
159 // care. 138 // care.
160 Generate_DebugBreakCallHelper(masm, v0.bit(), 0); 139 Generate_DebugBreakCallHelper(masm, v0.bit());
161 } 140 }
162 141
163 142
164 void DebugCodegen::GenerateCallFunctionStubDebugBreak(MacroAssembler* masm) {
165 // Register state for CallFunctionStub (from code-stubs-mips.cc).
166 // ----------- S t a t e -------------
167 // -- a1 : function
168 // -----------------------------------
169 Generate_DebugBreakCallHelper(masm, a1.bit(), 0);
170 }
171
172
173 void DebugCodegen::GenerateCallConstructStubDebugBreak(MacroAssembler* masm) {
174 // Calling convention for CallConstructStub (from code-stubs-mips.cc).
175 // ----------- S t a t e -------------
176 // -- a0 : number of arguments (not smi)
177 // -- a1 : constructor function
178 // -----------------------------------
179 Generate_DebugBreakCallHelper(masm, a1.bit() , a0.bit());
180 }
181
182
183
184 void DebugCodegen::GenerateCallConstructStubRecordDebugBreak(
185 MacroAssembler* masm) {
186 // Calling convention for CallConstructStub (from code-stubs-mips.cc).
187 // ----------- S t a t e -------------
188 // -- a0 : number of arguments (not smi)
189 // -- a1 : constructor function
190 // -- a2 : feedback array
191 // -- a3 : feedback slot (smi)
192 // -----------------------------------
193 Generate_DebugBreakCallHelper(masm, a1.bit() | a2.bit() | a3.bit(), a0.bit());
194 }
195
196
197 void DebugCodegen::GenerateSlot(MacroAssembler* masm) { 143 void DebugCodegen::GenerateSlot(MacroAssembler* masm) {
198 // Generate enough nop's to make space for a call instruction. Avoid emitting 144 // Generate enough nop's to make space for a call instruction. Avoid emitting
199 // the trampoline pool in the debug break slot code. 145 // the trampoline pool in the debug break slot code.
200 Assembler::BlockTrampolinePoolScope block_trampoline_pool(masm); 146 Assembler::BlockTrampolinePoolScope block_trampoline_pool(masm);
201 Label check_codesize; 147 Label check_codesize;
202 __ bind(&check_codesize); 148 __ bind(&check_codesize);
203 __ RecordDebugBreakSlot();
204 for (int i = 0; i < Assembler::kDebugBreakSlotInstructions; i++) { 149 for (int i = 0; i < Assembler::kDebugBreakSlotInstructions; i++) {
205 __ nop(MacroAssembler::DEBUG_BREAK_NOP); 150 __ nop(MacroAssembler::DEBUG_BREAK_NOP);
206 } 151 }
207 DCHECK_EQ(Assembler::kDebugBreakSlotInstructions, 152 DCHECK_EQ(Assembler::kDebugBreakSlotInstructions,
208 masm->InstructionsGeneratedSince(&check_codesize)); 153 masm->InstructionsGeneratedSince(&check_codesize));
209 } 154 }
210 155
211 156
212 void DebugCodegen::GenerateSlotDebugBreak(MacroAssembler* masm) { 157 void DebugCodegen::GenerateSlotDebugBreak(MacroAssembler* masm) {
213 // In the places where a debug break slot is inserted no registers can contain 158 // In the places where a debug break slot is inserted no registers can contain
214 // object pointers. 159 // object pointers.
215 Generate_DebugBreakCallHelper(masm, 0, 0); 160 Generate_DebugBreakCallHelper(masm, 0);
216 } 161 }
217 162
218 163
219 void DebugCodegen::GeneratePlainReturnLiveEdit(MacroAssembler* masm) { 164 void DebugCodegen::GeneratePlainReturnLiveEdit(MacroAssembler* masm) {
220 __ Ret(); 165 __ Ret();
221 } 166 }
222 167
223 168
224 void DebugCodegen::GenerateFrameDropperLiveEdit(MacroAssembler* masm) { 169 void DebugCodegen::GenerateFrameDropperLiveEdit(MacroAssembler* masm) {
225 ExternalReference restarter_frame_function_slot = 170 ExternalReference restarter_frame_function_slot =
(...skipping 21 matching lines...) Expand all
247 192
248 193
249 const bool LiveEdit::kFrameDropperSupported = true; 194 const bool LiveEdit::kFrameDropperSupported = true;
250 195
251 #undef __ 196 #undef __
252 197
253 } // namespace internal 198 } // namespace internal
254 } // namespace v8 199 } // namespace v8
255 200
256 #endif // V8_TARGET_ARCH_MIPS64 201 #endif // V8_TARGET_ARCH_MIPS64
OLDNEW
« no previous file with comments | « src/mips64/assembler-mips64.h ('k') | src/mips64/full-codegen-mips64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698