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 #if V8_TARGET_ARCH_X64 | 5 #if V8_TARGET_ARCH_X64 |
6 | 6 |
7 #include "src/codegen.h" | 7 #include "src/codegen.h" |
8 #include "src/deoptimizer.h" | 8 #include "src/deoptimizer.h" |
9 #include "src/full-codegen/full-codegen.h" | 9 #include "src/full-codegen/full-codegen.h" |
10 #include "src/objects-inl.h" | 10 #include "src/objects-inl.h" |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
118 __ subp(rsp, Immediate(kDoubleRegsSize)); | 118 __ subp(rsp, Immediate(kDoubleRegsSize)); |
119 | 119 |
120 const RegisterConfiguration* config = RegisterConfiguration::Crankshaft(); | 120 const RegisterConfiguration* config = RegisterConfiguration::Crankshaft(); |
121 for (int i = 0; i < config->num_allocatable_double_registers(); ++i) { | 121 for (int i = 0; i < config->num_allocatable_double_registers(); ++i) { |
122 int code = config->GetAllocatableDoubleCode(i); | 122 int code = config->GetAllocatableDoubleCode(i); |
123 XMMRegister xmm_reg = XMMRegister::from_code(code); | 123 XMMRegister xmm_reg = XMMRegister::from_code(code); |
124 int offset = code * kDoubleSize; | 124 int offset = code * kDoubleSize; |
125 __ Movsd(Operand(rsp, offset), xmm_reg); | 125 __ Movsd(Operand(rsp, offset), xmm_reg); |
126 } | 126 } |
127 | 127 |
| 128 const int kFloatRegsSize = kFloatSize * XMMRegister::kMaxNumRegisters; |
| 129 __ subp(rsp, Immediate(kFloatRegsSize)); |
| 130 |
| 131 for (int i = 0; i < config->num_allocatable_float_registers(); ++i) { |
| 132 int code = config->GetAllocatableFloatCode(i); |
| 133 XMMRegister xmm_reg = XMMRegister::from_code(code); |
| 134 int offset = code * kFloatSize; |
| 135 __ Movss(Operand(rsp, offset), xmm_reg); |
| 136 } |
| 137 |
128 // We push all registers onto the stack, even though we do not need | 138 // We push all registers onto the stack, even though we do not need |
129 // to restore all later. | 139 // to restore all later. |
130 for (int i = 0; i < kNumberOfRegisters; i++) { | 140 for (int i = 0; i < kNumberOfRegisters; i++) { |
131 Register r = Register::from_code(i); | 141 Register r = Register::from_code(i); |
132 __ pushq(r); | 142 __ pushq(r); |
133 } | 143 } |
134 | 144 |
135 const int kSavedRegistersAreaSize = kNumberOfRegisters * kRegisterSize + | 145 const int kSavedRegistersAreaSize = |
136 kDoubleRegsSize; | 146 kNumberOfRegisters * kRegisterSize + kDoubleRegsSize + kFloatRegsSize; |
137 | 147 |
138 __ Store(ExternalReference(Isolate::kCEntryFPAddress, isolate()), rbp); | 148 __ Store(ExternalReference(Isolate::kCEntryFPAddress, isolate()), rbp); |
139 | 149 |
140 // We use this to keep the value of the fifth argument temporarily. | 150 // We use this to keep the value of the fifth argument temporarily. |
141 // Unfortunately we can't store it directly in r8 (used for passing | 151 // Unfortunately we can't store it directly in r8 (used for passing |
142 // this on linux), since it is another parameter passing register on windows. | 152 // this on linux), since it is another parameter passing register on windows. |
143 Register arg5 = r11; | 153 Register arg5 = r11; |
144 | 154 |
145 // Get the bailout id from the stack. | 155 // Get the bailout id from the stack. |
146 __ movp(arg_reg_3, Operand(rsp, kSavedRegistersAreaSize)); | 156 __ movp(arg_reg_3, Operand(rsp, kSavedRegistersAreaSize)); |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
183 // Preserve deoptimizer object in register rax and get the input | 193 // Preserve deoptimizer object in register rax and get the input |
184 // frame descriptor pointer. | 194 // frame descriptor pointer. |
185 __ movp(rbx, Operand(rax, Deoptimizer::input_offset())); | 195 __ movp(rbx, Operand(rax, Deoptimizer::input_offset())); |
186 | 196 |
187 // Fill in the input registers. | 197 // Fill in the input registers. |
188 for (int i = kNumberOfRegisters -1; i >= 0; i--) { | 198 for (int i = kNumberOfRegisters -1; i >= 0; i--) { |
189 int offset = (i * kPointerSize) + FrameDescription::registers_offset(); | 199 int offset = (i * kPointerSize) + FrameDescription::registers_offset(); |
190 __ PopQuad(Operand(rbx, offset)); | 200 __ PopQuad(Operand(rbx, offset)); |
191 } | 201 } |
192 | 202 |
| 203 // Fill in the float input registers. |
| 204 int float_regs_offset = FrameDescription::float_registers_offset(); |
| 205 for (int i = 0; i < XMMRegister::kMaxNumRegisters; i++) { |
| 206 int src_offset = i * kFloatSize; |
| 207 int dst_offset = i * kFloatSize + float_regs_offset; |
| 208 __ movl(rcx, Operand(rsp, src_offset)); |
| 209 __ movl(Operand(rbx, dst_offset), rcx); |
| 210 } |
| 211 __ addp(rsp, Immediate(kFloatRegsSize)); |
| 212 |
193 // Fill in the double input registers. | 213 // Fill in the double input registers. |
194 int double_regs_offset = FrameDescription::double_registers_offset(); | 214 int double_regs_offset = FrameDescription::double_registers_offset(); |
195 for (int i = 0; i < XMMRegister::kMaxNumRegisters; i++) { | 215 for (int i = 0; i < XMMRegister::kMaxNumRegisters; i++) { |
196 int dst_offset = i * kDoubleSize + double_regs_offset; | 216 int dst_offset = i * kDoubleSize + double_regs_offset; |
197 __ popq(Operand(rbx, dst_offset)); | 217 __ popq(Operand(rbx, dst_offset)); |
198 } | 218 } |
199 | 219 |
200 // Remove the bailout id and return address from the stack. | 220 // Remove the bailout id and return address from the stack. |
201 __ addp(rsp, Immediate(1 * kRegisterSize + kPCOnStackSize)); | 221 __ addp(rsp, Immediate(1 * kRegisterSize + kPCOnStackSize)); |
202 | 222 |
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
334 } | 354 } |
335 | 355 |
336 | 356 |
337 #undef __ | 357 #undef __ |
338 | 358 |
339 | 359 |
340 } // namespace internal | 360 } // namespace internal |
341 } // namespace v8 | 361 } // namespace v8 |
342 | 362 |
343 #endif // V8_TARGET_ARCH_X64 | 363 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |