The data contained in this repository can be downloaded to your computer using one of several clients.
Please see the documentation of your version control software client for more information.
Please select the desired protocol below to get the URL.
This URL has Read-Only access.
main_repo / deps / v8 / src / debug-arm.cc @ 40c0f755
History | View | Annotate | Download (6.84 KB)
1 |
// Copyright 2006-2008 the V8 project authors. All rights reserved.
|
---|---|
2 |
// Redistribution and use in source and binary forms, with or without
|
3 |
// modification, are permitted provided that the following conditions are
|
4 |
// met:
|
5 |
//
|
6 |
// * Redistributions of source code must retain the above copyright
|
7 |
// notice, this list of conditions and the following disclaimer.
|
8 |
// * Redistributions in binary form must reproduce the above
|
9 |
// copyright notice, this list of conditions and the following
|
10 |
// disclaimer in the documentation and/or other materials provided
|
11 |
// with the distribution.
|
12 |
// * Neither the name of Google Inc. nor the names of its
|
13 |
// contributors may be used to endorse or promote products derived
|
14 |
// from this software without specific prior written permission.
|
15 |
//
|
16 |
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
17 |
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
18 |
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
19 |
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
20 |
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
21 |
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
22 |
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
23 |
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
24 |
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
25 |
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
26 |
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
27 |
|
28 |
#include "v8.h" |
29 |
|
30 |
#include "codegen-inl.h" |
31 |
#include "debug.h" |
32 |
|
33 |
namespace v8 { namespace internal { |
34 |
|
35 |
|
36 |
// Currently debug break is not supported in frame exit code on ARM.
|
37 |
bool BreakLocationIterator::IsDebugBreakAtReturn() {
|
38 |
return false; |
39 |
} |
40 |
|
41 |
|
42 |
// Currently debug break is not supported in frame exit code on ARM.
|
43 |
void BreakLocationIterator::SetDebugBreakAtReturn() {
|
44 |
UNIMPLEMENTED(); |
45 |
} |
46 |
|
47 |
|
48 |
// Currently debug break is not supported in frame exit code on ARM.
|
49 |
void BreakLocationIterator::ClearDebugBreakAtReturn() {
|
50 |
UNIMPLEMENTED(); |
51 |
} |
52 |
|
53 |
|
54 |
bool Debug::IsDebugBreakAtReturn(RelocInfo* rinfo) {
|
55 |
ASSERT(RelocInfo::IsJSReturn(rinfo->rmode())); |
56 |
// Currently debug break is not supported in frame exit code on ARM.
|
57 |
return false; |
58 |
} |
59 |
|
60 |
|
61 |
#define __ masm->
|
62 |
|
63 |
|
64 |
static void Generate_DebugBreakCallHelper(MacroAssembler* masm, |
65 |
RegList pointer_regs) { |
66 |
// Save the content of all general purpose registers in memory. This copy in
|
67 |
// memory is later pushed onto the JS expression stack for the fake JS frame
|
68 |
// generated and also to the C frame generated on top of that. In the JS
|
69 |
// frame ONLY the registers containing pointers will be pushed on the
|
70 |
// expression stack. This causes the GC to update these pointers so that
|
71 |
// they will have the correct value when returning from the debugger.
|
72 |
__ SaveRegistersToMemory(kJSCallerSaved); |
73 |
|
74 |
__ EnterInternalFrame(); |
75 |
|
76 |
// Store the registers containing object pointers on the expression stack to
|
77 |
// make sure that these are correctly updated during GC.
|
78 |
// Use sp as base to push.
|
79 |
__ CopyRegistersFromMemoryToStack(sp, pointer_regs); |
80 |
|
81 |
#ifdef DEBUG
|
82 |
__ RecordComment("// Calling from debug break to runtime - come in - over");
|
83 |
#endif
|
84 |
__ mov(r0, Operand(0)); // no arguments |
85 |
__ mov(r1, Operand(ExternalReference::debug_break())); |
86 |
|
87 |
CEntryDebugBreakStub ceb; |
88 |
__ CallStub(&ceb); |
89 |
|
90 |
// Restore the register values containing object pointers from the expression
|
91 |
// stack in the reverse order as they where pushed.
|
92 |
// Use sp as base to pop.
|
93 |
__ CopyRegistersFromStackToMemory(sp, r3, pointer_regs); |
94 |
|
95 |
__ LeaveInternalFrame(); |
96 |
|
97 |
// Inlined ExitJSFrame ends here.
|
98 |
|
99 |
// Finally restore all registers.
|
100 |
__ RestoreRegistersFromMemory(kJSCallerSaved); |
101 |
|
102 |
// Now that the break point has been handled, resume normal execution by
|
103 |
// jumping to the target address intended by the caller and that was
|
104 |
// overwritten by the address of DebugBreakXXX.
|
105 |
__ mov(ip, Operand(ExternalReference(Debug_Address::AfterBreakTarget()))); |
106 |
__ ldr(ip, MemOperand(ip)); |
107 |
__ Jump(ip); |
108 |
} |
109 |
|
110 |
|
111 |
void Debug::GenerateLoadICDebugBreak(MacroAssembler* masm) {
|
112 |
// Calling convention for IC load (from ic-arm.cc).
|
113 |
// ----------- S t a t e -------------
|
114 |
// -- r0 : receiver
|
115 |
// -- r2 : name
|
116 |
// -- lr : return address
|
117 |
// -- [sp] : receiver
|
118 |
// -----------------------------------
|
119 |
// Registers r0 and r2 contain objects that needs to be pushed on the
|
120 |
// expression stack of the fake JS frame.
|
121 |
Generate_DebugBreakCallHelper(masm, r0.bit() | r2.bit()); |
122 |
} |
123 |
|
124 |
|
125 |
void Debug::GenerateStoreICDebugBreak(MacroAssembler* masm) {
|
126 |
// Calling convention for IC store (from ic-arm.cc).
|
127 |
// ----------- S t a t e -------------
|
128 |
// -- r0 : receiver
|
129 |
// -- r2 : name
|
130 |
// -- lr : return address
|
131 |
// -- [sp] : receiver
|
132 |
// -----------------------------------
|
133 |
// Registers r0 and r2 contain objects that needs to be pushed on the
|
134 |
// expression stack of the fake JS frame.
|
135 |
Generate_DebugBreakCallHelper(masm, r0.bit() | r2.bit()); |
136 |
} |
137 |
|
138 |
|
139 |
void Debug::GenerateKeyedLoadICDebugBreak(MacroAssembler* masm) {
|
140 |
// Keyed load IC not implemented on ARM.
|
141 |
} |
142 |
|
143 |
|
144 |
void Debug::GenerateKeyedStoreICDebugBreak(MacroAssembler* masm) {
|
145 |
// Keyed store IC not implemented on ARM.
|
146 |
} |
147 |
|
148 |
|
149 |
void Debug::GenerateCallICDebugBreak(MacroAssembler* masm) {
|
150 |
// Calling convention for IC call (from ic-arm.cc)
|
151 |
// ----------- S t a t e -------------
|
152 |
// -- r0: number of arguments
|
153 |
// -- r1: receiver
|
154 |
// -- lr: return address
|
155 |
// -----------------------------------
|
156 |
// Register r1 contains an object that needs to be pushed on the expression
|
157 |
// stack of the fake JS frame. r0 is the actual number of arguments not
|
158 |
// encoded as a smi, therefore it cannot be on the expression stack of the
|
159 |
// fake JS frame as it can easily be an invalid pointer (e.g. 1). r0 will be
|
160 |
// pushed on the stack of the C frame and restored from there.
|
161 |
Generate_DebugBreakCallHelper(masm, r1.bit()); |
162 |
} |
163 |
|
164 |
|
165 |
void Debug::GenerateConstructCallDebugBreak(MacroAssembler* masm) {
|
166 |
// In places other than IC call sites it is expected that r0 is TOS which
|
167 |
// is an object - this is not generally the case so this should be used with
|
168 |
// care.
|
169 |
Generate_DebugBreakCallHelper(masm, r0.bit()); |
170 |
} |
171 |
|
172 |
|
173 |
void Debug::GenerateReturnDebugBreak(MacroAssembler* masm) {
|
174 |
// In places other than IC call sites it is expected that r0 is TOS which
|
175 |
// is an object - this is not generally the case so this should be used with
|
176 |
// care.
|
177 |
Generate_DebugBreakCallHelper(masm, r0.bit()); |
178 |
} |
179 |
|
180 |
|
181 |
void Debug::GenerateReturnDebugBreakEntry(MacroAssembler* masm) {
|
182 |
// Generate nothing as this handling of debug break return is not done this
|
183 |
// way on ARM - yet.
|
184 |
} |
185 |
|
186 |
|
187 |
void Debug::GenerateStubNoRegistersDebugBreak(MacroAssembler* masm) {
|
188 |
// Generate nothing as CodeStub CallFunction is not used on ARM.
|
189 |
} |
190 |
|
191 |
|
192 |
#undef __
|
193 |
|
194 |
|
195 |
} } // namespace v8::internal
|