OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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/x64/lithium-codegen-x64.h" | 7 #include "src/x64/lithium-codegen-x64.h" |
8 #include "src/x64/lithium-gap-resolver-x64.h" | 8 #include "src/x64/lithium-gap-resolver-x64.h" |
9 | 9 |
10 namespace v8 { | 10 namespace v8 { |
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
204 __ movp(dst, Immediate(cgen_->ToInteger32(constant_source))); | 204 __ movp(dst, Immediate(cgen_->ToInteger32(constant_source))); |
205 } else { | 205 } else { |
206 __ Move(kScratchRegister, cgen_->ToHandle(constant_source)); | 206 __ Move(kScratchRegister, cgen_->ToHandle(constant_source)); |
207 __ movp(dst, kScratchRegister); | 207 __ movp(dst, kScratchRegister); |
208 } | 208 } |
209 } | 209 } |
210 | 210 |
211 } else if (source->IsDoubleRegister()) { | 211 } else if (source->IsDoubleRegister()) { |
212 XMMRegister src = cgen_->ToDoubleRegister(source); | 212 XMMRegister src = cgen_->ToDoubleRegister(source); |
213 if (destination->IsDoubleRegister()) { | 213 if (destination->IsDoubleRegister()) { |
214 __ movaps(cgen_->ToDoubleRegister(destination), src); | 214 __ Movapd(cgen_->ToDoubleRegister(destination), src); |
215 } else { | 215 } else { |
216 DCHECK(destination->IsDoubleStackSlot()); | 216 DCHECK(destination->IsDoubleStackSlot()); |
217 __ Movsd(cgen_->ToOperand(destination), src); | 217 __ Movsd(cgen_->ToOperand(destination), src); |
218 } | 218 } |
219 } else if (source->IsDoubleStackSlot()) { | 219 } else if (source->IsDoubleStackSlot()) { |
220 Operand src = cgen_->ToOperand(source); | 220 Operand src = cgen_->ToOperand(source); |
221 if (destination->IsDoubleRegister()) { | 221 if (destination->IsDoubleRegister()) { |
222 __ Movsd(cgen_->ToDoubleRegister(destination), src); | 222 __ Movsd(cgen_->ToDoubleRegister(destination), src); |
223 } else { | 223 } else { |
224 DCHECK(destination->IsDoubleStackSlot()); | 224 DCHECK(destination->IsDoubleStackSlot()); |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
263 Operand dst = cgen_->ToOperand(destination); | 263 Operand dst = cgen_->ToOperand(destination); |
264 __ Movsd(xmm0, src); | 264 __ Movsd(xmm0, src); |
265 __ movp(kScratchRegister, dst); | 265 __ movp(kScratchRegister, dst); |
266 __ Movsd(dst, xmm0); | 266 __ Movsd(dst, xmm0); |
267 __ movp(src, kScratchRegister); | 267 __ movp(src, kScratchRegister); |
268 | 268 |
269 } else if (source->IsDoubleRegister() && destination->IsDoubleRegister()) { | 269 } else if (source->IsDoubleRegister() && destination->IsDoubleRegister()) { |
270 // Swap two double registers. | 270 // Swap two double registers. |
271 XMMRegister source_reg = cgen_->ToDoubleRegister(source); | 271 XMMRegister source_reg = cgen_->ToDoubleRegister(source); |
272 XMMRegister destination_reg = cgen_->ToDoubleRegister(destination); | 272 XMMRegister destination_reg = cgen_->ToDoubleRegister(destination); |
273 __ movaps(xmm0, source_reg); | 273 __ Movapd(xmm0, source_reg); |
274 __ movaps(source_reg, destination_reg); | 274 __ Movapd(source_reg, destination_reg); |
275 __ movaps(destination_reg, xmm0); | 275 __ Movapd(destination_reg, xmm0); |
276 | 276 |
277 } else if (source->IsDoubleRegister() || destination->IsDoubleRegister()) { | 277 } else if (source->IsDoubleRegister() || destination->IsDoubleRegister()) { |
278 // Swap a double register and a double stack slot. | 278 // Swap a double register and a double stack slot. |
279 DCHECK((source->IsDoubleRegister() && destination->IsDoubleStackSlot()) || | 279 DCHECK((source->IsDoubleRegister() && destination->IsDoubleStackSlot()) || |
280 (source->IsDoubleStackSlot() && destination->IsDoubleRegister())); | 280 (source->IsDoubleStackSlot() && destination->IsDoubleRegister())); |
281 XMMRegister reg = cgen_->ToDoubleRegister(source->IsDoubleRegister() | 281 XMMRegister reg = cgen_->ToDoubleRegister(source->IsDoubleRegister() |
282 ? source | 282 ? source |
283 : destination); | 283 : destination); |
284 LOperand* other = source->IsDoubleRegister() ? destination : source; | 284 LOperand* other = source->IsDoubleRegister() ? destination : source; |
285 DCHECK(other->IsDoubleStackSlot()); | 285 DCHECK(other->IsDoubleStackSlot()); |
286 Operand other_operand = cgen_->ToOperand(other); | 286 Operand other_operand = cgen_->ToOperand(other); |
287 __ Movsd(xmm0, other_operand); | 287 __ Movapd(xmm0, reg); |
288 __ Movsd(other_operand, reg); | 288 __ Movsd(reg, other_operand); |
289 __ movaps(reg, xmm0); | 289 __ Movsd(other_operand, xmm0); |
290 | 290 |
291 } else { | 291 } else { |
292 // No other combinations are possible. | 292 // No other combinations are possible. |
293 UNREACHABLE(); | 293 UNREACHABLE(); |
294 } | 294 } |
295 | 295 |
296 // The swap of source and destination has executed a move from source to | 296 // The swap of source and destination has executed a move from source to |
297 // destination. | 297 // destination. |
298 moves_[index].Eliminate(); | 298 moves_[index].Eliminate(); |
299 | 299 |
300 // Any unperformed (including pending) move with a source of either | 300 // Any unperformed (including pending) move with a source of either |
301 // this move's source or destination needs to have their source | 301 // this move's source or destination needs to have their source |
302 // changed to reflect the state of affairs after the swap. | 302 // changed to reflect the state of affairs after the swap. |
303 for (int i = 0; i < moves_.length(); ++i) { | 303 for (int i = 0; i < moves_.length(); ++i) { |
304 LMoveOperands other_move = moves_[i]; | 304 LMoveOperands other_move = moves_[i]; |
305 if (other_move.Blocks(source)) { | 305 if (other_move.Blocks(source)) { |
306 moves_[i].set_source(destination); | 306 moves_[i].set_source(destination); |
307 } else if (other_move.Blocks(destination)) { | 307 } else if (other_move.Blocks(destination)) { |
308 moves_[i].set_source(source); | 308 moves_[i].set_source(source); |
309 } | 309 } |
310 } | 310 } |
311 } | 311 } |
312 | 312 |
313 #undef __ | 313 #undef __ |
314 | 314 |
315 } // namespace internal | 315 } // namespace internal |
316 } // namespace v8 | 316 } // namespace v8 |
317 | 317 |
318 #endif // V8_TARGET_ARCH_X64 | 318 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |