OLD | NEW |
---|---|
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 #include "src/assembler-inl.h" | 5 #include "src/assembler-inl.h" |
6 #include "src/codegen.h" | 6 #include "src/codegen.h" |
7 #include "src/deoptimizer.h" | 7 #include "src/deoptimizer.h" |
8 #include "src/full-codegen/full-codegen.h" | 8 #include "src/full-codegen/full-codegen.h" |
9 #include "src/objects-inl.h" | 9 #include "src/objects-inl.h" |
10 #include "src/register-configuration.h" | 10 #include "src/register-configuration.h" |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
114 void Deoptimizer::TableEntryGenerator::Generate() { | 114 void Deoptimizer::TableEntryGenerator::Generate() { |
115 GeneratePrologue(); | 115 GeneratePrologue(); |
116 | 116 |
117 // Save all general purpose registers before messing with them. | 117 // Save all general purpose registers before messing with them. |
118 const int kNumberOfRegisters = Register::kNumRegisters; | 118 const int kNumberOfRegisters = Register::kNumRegisters; |
119 | 119 |
120 // Everything but pc, lr and ip which will be saved but not restored. | 120 // Everything but pc, lr and ip which will be saved but not restored. |
121 RegList restored_regs = kJSCallerSaved | kCalleeSaved | ip.bit(); | 121 RegList restored_regs = kJSCallerSaved | kCalleeSaved | ip.bit(); |
122 | 122 |
123 const int kDoubleRegsSize = kDoubleSize * DwVfpRegister::kMaxNumRegisters; | 123 const int kDoubleRegsSize = kDoubleSize * DwVfpRegister::kMaxNumRegisters; |
124 const int kFloatRegsSize = kFloatSize * SwVfpRegister::kMaxNumRegisters; | |
124 | 125 |
125 // Save all allocatable VFP registers before messing with them. | 126 // Save all allocatable VFP registers before messing with them. |
126 DCHECK(kDoubleRegZero.code() == 14); | 127 DCHECK(kDoubleRegZero.code() == 14); |
127 DCHECK(kScratchDoubleReg.code() == 15); | 128 DCHECK(kScratchDoubleReg.code() == 15); |
128 | 129 |
129 { | 130 { |
130 // We use a run-time check for VFP32DREGS. | 131 // We use a run-time check for VFP32DREGS. |
131 CpuFeatureScope scope(masm(), VFP32DREGS, | 132 CpuFeatureScope scope(masm(), VFP32DREGS, |
132 CpuFeatureScope::kDontCheckSupported); | 133 CpuFeatureScope::kDontCheckSupported); |
133 | 134 |
134 // Check CPU flags for number of registers, setting the Z condition flag. | 135 // Check CPU flags for number of registers, setting the Z condition flag. |
135 __ CheckFor32DRegs(ip); | 136 __ CheckFor32DRegs(ip); |
136 | 137 |
137 // Push registers d0-d15, and possibly d16-d31, on the stack. | 138 // Push registers d0-d15, and possibly d16-d31, on the stack. |
138 // If d16-d31 are not pushed, decrease the stack pointer instead. | 139 // If d16-d31 are not pushed, decrease the stack pointer instead. |
139 __ vstm(db_w, sp, d16, d31, ne); | 140 __ vstm(db_w, sp, d16, d31, ne); |
140 __ sub(sp, sp, Operand(16 * kDoubleSize), LeaveCC, eq); | 141 __ sub(sp, sp, Operand(16 * kDoubleSize), LeaveCC, eq); |
141 __ vstm(db_w, sp, d0, d15); | 142 __ vstm(db_w, sp, d0, d15); |
143 | |
144 // Push registers s0-s15, and possibly s16-s31, on the stack. | |
bbudge
2017/03/22 17:08:02
I think all ARM targets have 32 single precision r
| |
145 // If s16-s31 are not pushed, decrease the stack pointer instead. | |
146 __ vstm(db_w, sp, s16, s31, ne); | |
147 __ sub(sp, sp, Operand(16 * kFloatSize), LeaveCC, eq); | |
148 __ vstm(db_w, sp, s0, s15); | |
142 } | 149 } |
143 | 150 |
144 // Push all 16 registers (needed to populate FrameDescription::registers_). | 151 // Push all 16 registers (needed to populate FrameDescription::registers_). |
145 // TODO(1588) Note that using pc with stm is deprecated, so we should perhaps | 152 // TODO(1588) Note that using pc with stm is deprecated, so we should perhaps |
146 // handle this a bit differently. | 153 // handle this a bit differently. |
147 __ stm(db_w, sp, restored_regs | sp.bit() | lr.bit() | pc.bit()); | 154 __ stm(db_w, sp, restored_regs | sp.bit() | lr.bit() | pc.bit()); |
148 | 155 |
149 __ mov(ip, Operand(ExternalReference(Isolate::kCEntryFPAddress, isolate()))); | 156 __ mov(ip, Operand(ExternalReference(Isolate::kCEntryFPAddress, isolate()))); |
150 __ str(fp, MemOperand(ip)); | 157 __ str(fp, MemOperand(ip)); |
151 | 158 |
152 const int kSavedRegistersAreaSize = | 159 const int kSavedRegistersAreaSize = |
153 (kNumberOfRegisters * kPointerSize) + kDoubleRegsSize; | 160 (kNumberOfRegisters * kPointerSize) + kDoubleRegsSize + kFloatRegsSize; |
154 | 161 |
155 // Get the bailout id from the stack. | 162 // Get the bailout id from the stack. |
156 __ ldr(r2, MemOperand(sp, kSavedRegistersAreaSize)); | 163 __ ldr(r2, MemOperand(sp, kSavedRegistersAreaSize)); |
157 | 164 |
158 // Get the address of the location in the code object (r3) (return | 165 // Get the address of the location in the code object (r3) (return |
159 // address for lazy deoptimization) and compute the fp-to-sp delta in | 166 // address for lazy deoptimization) and compute the fp-to-sp delta in |
160 // register r4. | 167 // register r4. |
161 __ mov(r3, lr); | 168 __ mov(r3, lr); |
162 // Correct one word for bailout id. | 169 // Correct one word for bailout id. |
163 __ add(r4, sp, Operand(kSavedRegistersAreaSize + (1 * kPointerSize))); | 170 __ add(r4, sp, Operand(kSavedRegistersAreaSize + (1 * kPointerSize))); |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
196 __ str(r2, MemOperand(r1, offset)); | 203 __ str(r2, MemOperand(r1, offset)); |
197 } | 204 } |
198 | 205 |
199 // Copy VFP registers to | 206 // Copy VFP registers to |
200 // double_registers_[DoubleRegister::kMaxNumAllocatableRegisters] | 207 // double_registers_[DoubleRegister::kMaxNumAllocatableRegisters] |
201 int double_regs_offset = FrameDescription::double_registers_offset(); | 208 int double_regs_offset = FrameDescription::double_registers_offset(); |
202 const RegisterConfiguration* config = RegisterConfiguration::Crankshaft(); | 209 const RegisterConfiguration* config = RegisterConfiguration::Crankshaft(); |
203 for (int i = 0; i < config->num_allocatable_double_registers(); ++i) { | 210 for (int i = 0; i < config->num_allocatable_double_registers(); ++i) { |
204 int code = config->GetAllocatableDoubleCode(i); | 211 int code = config->GetAllocatableDoubleCode(i); |
205 int dst_offset = code * kDoubleSize + double_regs_offset; | 212 int dst_offset = code * kDoubleSize + double_regs_offset; |
206 int src_offset = code * kDoubleSize + kNumberOfRegisters * kPointerSize; | 213 int src_offset = |
214 code * kDoubleSize + kNumberOfRegisters * kPointerSize + kFloatRegsSize; | |
207 __ vldr(d0, sp, src_offset); | 215 __ vldr(d0, sp, src_offset); |
208 __ vstr(d0, r1, dst_offset); | 216 __ vstr(d0, r1, dst_offset); |
209 } | 217 } |
210 | 218 |
219 // Copy VFP registers to | |
220 // float_registers_[FloatRegister::kMaxNumAllocatableRegisters] | |
221 int float_regs_offset = FrameDescription::float_registers_offset(); | |
222 for (int i = 0; i < config->num_allocatable_float_registers(); ++i) { | |
223 int code = config->GetAllocatableFloatCode(i); | |
224 int dst_offset = code * kFloatSize + float_regs_offset; | |
225 int src_offset = code * kFloatSize + kNumberOfRegisters * kPointerSize; | |
226 __ ldr(r2, MemOperand(sp, src_offset)); | |
227 __ str(r2, MemOperand(r1, dst_offset)); | |
228 } | |
229 | |
211 // Remove the bailout id and the saved registers from the stack. | 230 // Remove the bailout id and the saved registers from the stack. |
212 __ add(sp, sp, Operand(kSavedRegistersAreaSize + (1 * kPointerSize))); | 231 __ add(sp, sp, Operand(kSavedRegistersAreaSize + (1 * kPointerSize))); |
213 | 232 |
214 // Compute a pointer to the unwinding limit in register r2; that is | 233 // Compute a pointer to the unwinding limit in register r2; that is |
215 // the first stack slot not part of the input frame. | 234 // the first stack slot not part of the input frame. |
216 __ ldr(r2, MemOperand(r1, FrameDescription::frame_size_offset())); | 235 __ ldr(r2, MemOperand(r1, FrameDescription::frame_size_offset())); |
217 __ add(r2, r2, sp); | 236 __ add(r2, r2, sp); |
218 | 237 |
219 // Unwind the stack down to - but not including - the unwinding | 238 // Unwind the stack down to - but not including - the unwinding |
220 // limit and copy the contents of the activation frame to the input | 239 // limit and copy the contents of the activation frame to the input |
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
374 void FrameDescription::SetCallerConstantPool(unsigned offset, intptr_t value) { | 393 void FrameDescription::SetCallerConstantPool(unsigned offset, intptr_t value) { |
375 DCHECK(FLAG_enable_embedded_constant_pool); | 394 DCHECK(FLAG_enable_embedded_constant_pool); |
376 SetFrameSlot(offset, value); | 395 SetFrameSlot(offset, value); |
377 } | 396 } |
378 | 397 |
379 | 398 |
380 #undef __ | 399 #undef __ |
381 | 400 |
382 } // namespace internal | 401 } // namespace internal |
383 } // namespace v8 | 402 } // namespace v8 |
OLD | NEW |