OLD | NEW |
1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 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/deoptimizer.h" | 5 #include "src/deoptimizer.h" |
6 #include "src/codegen.h" | 6 #include "src/codegen.h" |
7 #include "src/full-codegen/full-codegen.h" | 7 #include "src/full-codegen/full-codegen.h" |
8 #include "src/register-configuration.h" | 8 #include "src/register-configuration.h" |
9 #include "src/safepoint-table.h" | 9 #include "src/safepoint-table.h" |
10 | 10 |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
106 // easily ported. | 106 // easily ported. |
107 void Deoptimizer::TableEntryGenerator::Generate() { | 107 void Deoptimizer::TableEntryGenerator::Generate() { |
108 GeneratePrologue(); | 108 GeneratePrologue(); |
109 | 109 |
110 // Save all the registers onto the stack | 110 // Save all the registers onto the stack |
111 const int kNumberOfRegisters = Register::kNumRegisters; | 111 const int kNumberOfRegisters = Register::kNumRegisters; |
112 | 112 |
113 RegList restored_regs = kJSCallerSaved | kCalleeSaved; | 113 RegList restored_regs = kJSCallerSaved | kCalleeSaved; |
114 | 114 |
115 const int kDoubleRegsSize = kDoubleSize * DoubleRegister::kNumRegisters; | 115 const int kDoubleRegsSize = kDoubleSize * DoubleRegister::kNumRegisters; |
| 116 const int kFloatRegsSize = kFloatSize * FloatRegister::kNumRegisters; |
116 | 117 |
117 // Save all double registers before messing with them. | 118 // Save all double registers before messing with them. |
118 __ lay(sp, MemOperand(sp, -kDoubleRegsSize)); | 119 __ lay(sp, MemOperand(sp, -kDoubleRegsSize)); |
119 const RegisterConfiguration* config = RegisterConfiguration::Crankshaft(); | 120 const RegisterConfiguration* config = RegisterConfiguration::Crankshaft(); |
120 for (int i = 0; i < config->num_allocatable_double_registers(); ++i) { | 121 for (int i = 0; i < config->num_allocatable_double_registers(); ++i) { |
121 int code = config->GetAllocatableDoubleCode(i); | 122 int code = config->GetAllocatableDoubleCode(i); |
122 const DoubleRegister dreg = DoubleRegister::from_code(code); | 123 const DoubleRegister dreg = DoubleRegister::from_code(code); |
123 int offset = code * kDoubleSize; | 124 int offset = code * kDoubleSize; |
124 __ StoreDouble(dreg, MemOperand(sp, offset)); | 125 __ StoreDouble(dreg, MemOperand(sp, offset)); |
125 } | 126 } |
| 127 // Save all float registers before messing with them. |
| 128 __ lay(sp, MemOperand(sp, -kFloatRegsSize)); |
| 129 for (int i = 0; i < config->num_allocatable_float_registers(); ++i) { |
| 130 int code = config->GetAllocatableFloatCode(i); |
| 131 const FloatRegister dreg = FloatRegister::from_code(code); |
| 132 int offset = code * kFloatSize; |
| 133 __ StoreFloat32(dreg, MemOperand(sp, offset)); |
| 134 } |
126 | 135 |
127 // Push all GPRs onto the stack | 136 // Push all GPRs onto the stack |
128 __ lay(sp, MemOperand(sp, -kNumberOfRegisters * kPointerSize)); | 137 __ lay(sp, MemOperand(sp, -kNumberOfRegisters * kPointerSize)); |
129 __ StoreMultipleP(r0, sp, MemOperand(sp)); // Save all 16 registers | 138 __ StoreMultipleP(r0, sp, MemOperand(sp)); // Save all 16 registers |
130 | 139 |
131 __ mov(ip, Operand(ExternalReference(Isolate::kCEntryFPAddress, isolate()))); | 140 __ mov(ip, Operand(ExternalReference(Isolate::kCEntryFPAddress, isolate()))); |
132 __ StoreP(fp, MemOperand(ip)); | 141 __ StoreP(fp, MemOperand(ip)); |
133 | 142 |
134 const int kSavedRegistersAreaSize = | 143 const int kSavedRegistersAreaSize = |
135 (kNumberOfRegisters * kPointerSize) + kDoubleRegsSize; | 144 (kNumberOfRegisters * kPointerSize) + kDoubleRegsSize + kFloatRegsSize; |
136 | 145 |
137 // Get the bailout id from the stack. | 146 // Get the bailout id from the stack. |
138 __ LoadP(r4, MemOperand(sp, kSavedRegistersAreaSize)); | 147 __ LoadP(r4, MemOperand(sp, kSavedRegistersAreaSize)); |
139 | 148 |
140 // Cleanse the Return address for 31-bit | 149 // Cleanse the Return address for 31-bit |
141 __ CleanseP(r14); | 150 __ CleanseP(r14); |
142 | 151 |
143 // Get the address of the location in the code object (r5)(return | 152 // Get the address of the location in the code object (r5)(return |
144 // address for lazy deoptimization) and compute the fp-to-sp delta in | 153 // address for lazy deoptimization) and compute the fp-to-sp delta in |
145 // register r6. | 154 // register r6. |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
186 __ LoadP(r4, MemOperand(sp, i * kPointerSize)); | 195 __ LoadP(r4, MemOperand(sp, i * kPointerSize)); |
187 __ StoreP(r4, MemOperand(r3, offset)); | 196 __ StoreP(r4, MemOperand(r3, offset)); |
188 } | 197 } |
189 | 198 |
190 int double_regs_offset = FrameDescription::double_registers_offset(); | 199 int double_regs_offset = FrameDescription::double_registers_offset(); |
191 // Copy double registers to | 200 // Copy double registers to |
192 // double_registers_[DoubleRegister::kNumRegisters] | 201 // double_registers_[DoubleRegister::kNumRegisters] |
193 for (int i = 0; i < config->num_allocatable_double_registers(); ++i) { | 202 for (int i = 0; i < config->num_allocatable_double_registers(); ++i) { |
194 int code = config->GetAllocatableDoubleCode(i); | 203 int code = config->GetAllocatableDoubleCode(i); |
195 int dst_offset = code * kDoubleSize + double_regs_offset; | 204 int dst_offset = code * kDoubleSize + double_regs_offset; |
196 int src_offset = code * kDoubleSize + kNumberOfRegisters * kPointerSize; | 205 int src_offset = |
| 206 code * kDoubleSize + kNumberOfRegisters * kPointerSize + kFloatRegsSize; |
197 // TODO(joransiu): MVC opportunity | 207 // TODO(joransiu): MVC opportunity |
198 __ LoadDouble(d0, MemOperand(sp, src_offset)); | 208 __ LoadDouble(d0, MemOperand(sp, src_offset)); |
199 __ StoreDouble(d0, MemOperand(r3, dst_offset)); | 209 __ StoreDouble(d0, MemOperand(r3, dst_offset)); |
200 } | 210 } |
201 | 211 |
| 212 int float_regs_offset = FrameDescription::float_registers_offset(); |
| 213 // Copy float registers to |
| 214 // float_registers_[FloatRegister::kNumRegisters] |
| 215 for (int i = 0; i < config->num_allocatable_float_registers(); ++i) { |
| 216 int code = config->GetAllocatableFloatCode(i); |
| 217 int dst_offset = code * kFloatSize + float_regs_offset; |
| 218 int src_offset = code * kFloatSize + kNumberOfRegisters * kPointerSize; |
| 219 // TODO(joransiu): MVC opportunity |
| 220 __ LoadFloat32(d0, MemOperand(sp, src_offset)); |
| 221 __ StoreFloat32(d0, MemOperand(r3, dst_offset)); |
| 222 } |
202 // Remove the bailout id and the saved registers from the stack. | 223 // Remove the bailout id and the saved registers from the stack. |
203 __ la(sp, MemOperand(sp, kSavedRegistersAreaSize + (1 * kPointerSize))); | 224 __ la(sp, MemOperand(sp, kSavedRegistersAreaSize + (1 * kPointerSize))); |
204 | 225 |
205 // Compute a pointer to the unwinding limit in register r4; that is | 226 // Compute a pointer to the unwinding limit in register r4; that is |
206 // the first stack slot not part of the input frame. | 227 // the first stack slot not part of the input frame. |
207 __ LoadP(r4, MemOperand(r3, FrameDescription::frame_size_offset())); | 228 __ LoadP(r4, MemOperand(r3, FrameDescription::frame_size_offset())); |
208 __ AddP(r4, sp); | 229 __ AddP(r4, sp); |
209 | 230 |
210 // Unwind the stack down to - but not including - the unwinding | 231 // Unwind the stack down to - but not including - the unwinding |
211 // limit and copy the contents of the activation frame to the input | 232 // limit and copy the contents of the activation frame to the input |
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
328 | 349 |
329 void FrameDescription::SetCallerConstantPool(unsigned offset, intptr_t value) { | 350 void FrameDescription::SetCallerConstantPool(unsigned offset, intptr_t value) { |
330 // No out-of-line constant pool support. | 351 // No out-of-line constant pool support. |
331 UNREACHABLE(); | 352 UNREACHABLE(); |
332 } | 353 } |
333 | 354 |
334 #undef __ | 355 #undef __ |
335 | 356 |
336 } // namespace internal | 357 } // namespace internal |
337 } // namespace v8 | 358 } // namespace v8 |
OLD | NEW |