| 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/crankshaft/x64/lithium-gap-resolver-x64.h" | 7 #include "src/crankshaft/x64/lithium-gap-resolver-x64.h" |
| 8 | 8 |
| 9 #include "src/crankshaft/x64/lithium-codegen-x64.h" | 9 #include "src/crankshaft/x64/lithium-codegen-x64.h" |
| 10 | 10 |
| (...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 216 } else { | 216 } else { |
| 217 DCHECK(destination->IsDoubleStackSlot()); | 217 DCHECK(destination->IsDoubleStackSlot()); |
| 218 __ Movsd(cgen_->ToOperand(destination), src); | 218 __ Movsd(cgen_->ToOperand(destination), src); |
| 219 } | 219 } |
| 220 } else if (source->IsDoubleStackSlot()) { | 220 } else if (source->IsDoubleStackSlot()) { |
| 221 Operand src = cgen_->ToOperand(source); | 221 Operand src = cgen_->ToOperand(source); |
| 222 if (destination->IsDoubleRegister()) { | 222 if (destination->IsDoubleRegister()) { |
| 223 __ Movsd(cgen_->ToDoubleRegister(destination), src); | 223 __ Movsd(cgen_->ToDoubleRegister(destination), src); |
| 224 } else { | 224 } else { |
| 225 DCHECK(destination->IsDoubleStackSlot()); | 225 DCHECK(destination->IsDoubleStackSlot()); |
| 226 __ Movsd(xmm0, src); | 226 __ Movsd(kScratchDoubleReg, src); |
| 227 __ Movsd(cgen_->ToOperand(destination), xmm0); | 227 __ Movsd(cgen_->ToOperand(destination), kScratchDoubleReg); |
| 228 } | 228 } |
| 229 } else { | 229 } else { |
| 230 UNREACHABLE(); | 230 UNREACHABLE(); |
| 231 } | 231 } |
| 232 | 232 |
| 233 moves_[index].Eliminate(); | 233 moves_[index].Eliminate(); |
| 234 } | 234 } |
| 235 | 235 |
| 236 | 236 |
| 237 void LGapResolver::EmitSwap(int index) { | 237 void LGapResolver::EmitSwap(int index) { |
| (...skipping 19 matching lines...) Expand all Loading... |
| 257 cgen_->ToOperand(source->IsRegister() ? destination : source); | 257 cgen_->ToOperand(source->IsRegister() ? destination : source); |
| 258 __ movp(kScratchRegister, mem); | 258 __ movp(kScratchRegister, mem); |
| 259 __ movp(mem, reg); | 259 __ movp(mem, reg); |
| 260 __ movp(reg, kScratchRegister); | 260 __ movp(reg, kScratchRegister); |
| 261 | 261 |
| 262 } else if ((source->IsStackSlot() && destination->IsStackSlot()) || | 262 } else if ((source->IsStackSlot() && destination->IsStackSlot()) || |
| 263 (source->IsDoubleStackSlot() && destination->IsDoubleStackSlot())) { | 263 (source->IsDoubleStackSlot() && destination->IsDoubleStackSlot())) { |
| 264 // Swap two stack slots or two double stack slots. | 264 // Swap two stack slots or two double stack slots. |
| 265 Operand src = cgen_->ToOperand(source); | 265 Operand src = cgen_->ToOperand(source); |
| 266 Operand dst = cgen_->ToOperand(destination); | 266 Operand dst = cgen_->ToOperand(destination); |
| 267 __ Movsd(xmm0, src); | 267 __ Movsd(kScratchDoubleReg, src); |
| 268 __ movp(kScratchRegister, dst); | 268 __ movp(kScratchRegister, dst); |
| 269 __ Movsd(dst, xmm0); | 269 __ Movsd(dst, kScratchDoubleReg); |
| 270 __ movp(src, kScratchRegister); | 270 __ movp(src, kScratchRegister); |
| 271 | 271 |
| 272 } else if (source->IsDoubleRegister() && destination->IsDoubleRegister()) { | 272 } else if (source->IsDoubleRegister() && destination->IsDoubleRegister()) { |
| 273 // Swap two double registers. | 273 // Swap two double registers. |
| 274 XMMRegister source_reg = cgen_->ToDoubleRegister(source); | 274 XMMRegister source_reg = cgen_->ToDoubleRegister(source); |
| 275 XMMRegister destination_reg = cgen_->ToDoubleRegister(destination); | 275 XMMRegister destination_reg = cgen_->ToDoubleRegister(destination); |
| 276 __ Movapd(xmm0, source_reg); | 276 __ Movapd(kScratchDoubleReg, source_reg); |
| 277 __ Movapd(source_reg, destination_reg); | 277 __ Movapd(source_reg, destination_reg); |
| 278 __ Movapd(destination_reg, xmm0); | 278 __ Movapd(destination_reg, kScratchDoubleReg); |
| 279 | 279 |
| 280 } else if (source->IsDoubleRegister() || destination->IsDoubleRegister()) { | 280 } else if (source->IsDoubleRegister() || destination->IsDoubleRegister()) { |
| 281 // Swap a double register and a double stack slot. | 281 // Swap a double register and a double stack slot. |
| 282 DCHECK((source->IsDoubleRegister() && destination->IsDoubleStackSlot()) || | 282 DCHECK((source->IsDoubleRegister() && destination->IsDoubleStackSlot()) || |
| 283 (source->IsDoubleStackSlot() && destination->IsDoubleRegister())); | 283 (source->IsDoubleStackSlot() && destination->IsDoubleRegister())); |
| 284 XMMRegister reg = cgen_->ToDoubleRegister(source->IsDoubleRegister() | 284 XMMRegister reg = cgen_->ToDoubleRegister(source->IsDoubleRegister() |
| 285 ? source | 285 ? source |
| 286 : destination); | 286 : destination); |
| 287 LOperand* other = source->IsDoubleRegister() ? destination : source; | 287 LOperand* other = source->IsDoubleRegister() ? destination : source; |
| 288 DCHECK(other->IsDoubleStackSlot()); | 288 DCHECK(other->IsDoubleStackSlot()); |
| 289 Operand other_operand = cgen_->ToOperand(other); | 289 Operand other_operand = cgen_->ToOperand(other); |
| 290 __ Movapd(xmm0, reg); | 290 __ Movapd(kScratchDoubleReg, reg); |
| 291 __ Movsd(reg, other_operand); | 291 __ Movsd(reg, other_operand); |
| 292 __ Movsd(other_operand, xmm0); | 292 __ Movsd(other_operand, kScratchDoubleReg); |
| 293 | 293 |
| 294 } else { | 294 } else { |
| 295 // No other combinations are possible. | 295 // No other combinations are possible. |
| 296 UNREACHABLE(); | 296 UNREACHABLE(); |
| 297 } | 297 } |
| 298 | 298 |
| 299 // The swap of source and destination has executed a move from source to | 299 // The swap of source and destination has executed a move from source to |
| 300 // destination. | 300 // destination. |
| 301 moves_[index].Eliminate(); | 301 moves_[index].Eliminate(); |
| 302 | 302 |
| 303 // Any unperformed (including pending) move with a source of either | 303 // Any unperformed (including pending) move with a source of either |
| 304 // this move's source or destination needs to have their source | 304 // this move's source or destination needs to have their source |
| 305 // changed to reflect the state of affairs after the swap. | 305 // changed to reflect the state of affairs after the swap. |
| 306 for (int i = 0; i < moves_.length(); ++i) { | 306 for (int i = 0; i < moves_.length(); ++i) { |
| 307 LMoveOperands other_move = moves_[i]; | 307 LMoveOperands other_move = moves_[i]; |
| 308 if (other_move.Blocks(source)) { | 308 if (other_move.Blocks(source)) { |
| 309 moves_[i].set_source(destination); | 309 moves_[i].set_source(destination); |
| 310 } else if (other_move.Blocks(destination)) { | 310 } else if (other_move.Blocks(destination)) { |
| 311 moves_[i].set_source(source); | 311 moves_[i].set_source(source); |
| 312 } | 312 } |
| 313 } | 313 } |
| 314 } | 314 } |
| 315 | 315 |
| 316 #undef __ | 316 #undef __ |
| 317 | 317 |
| 318 } // namespace internal | 318 } // namespace internal |
| 319 } // namespace v8 | 319 } // namespace v8 |
| 320 | 320 |
| 321 #endif // V8_TARGET_ARCH_X64 | 321 #endif // V8_TARGET_ARCH_X64 |
| OLD | NEW |