| OLD | NEW |
| 1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| (...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 165 void LGapResolver::EmitMove(int index) { | 165 void LGapResolver::EmitMove(int index) { |
| 166 LOperand* source = moves_[index].source(); | 166 LOperand* source = moves_[index].source(); |
| 167 LOperand* destination = moves_[index].destination(); | 167 LOperand* destination = moves_[index].destination(); |
| 168 | 168 |
| 169 // Dispatch on the source and destination operand kinds. Not all | 169 // Dispatch on the source and destination operand kinds. Not all |
| 170 // combinations are possible. | 170 // combinations are possible. |
| 171 if (source->IsRegister()) { | 171 if (source->IsRegister()) { |
| 172 Register src = cgen_->ToRegister(source); | 172 Register src = cgen_->ToRegister(source); |
| 173 if (destination->IsRegister()) { | 173 if (destination->IsRegister()) { |
| 174 Register dst = cgen_->ToRegister(destination); | 174 Register dst = cgen_->ToRegister(destination); |
| 175 __ movq(dst, src); | 175 __ movp(dst, src); |
| 176 } else { | 176 } else { |
| 177 ASSERT(destination->IsStackSlot()); | 177 ASSERT(destination->IsStackSlot()); |
| 178 Operand dst = cgen_->ToOperand(destination); | 178 Operand dst = cgen_->ToOperand(destination); |
| 179 __ movq(dst, src); | 179 __ movp(dst, src); |
| 180 } | 180 } |
| 181 | 181 |
| 182 } else if (source->IsStackSlot()) { | 182 } else if (source->IsStackSlot()) { |
| 183 Operand src = cgen_->ToOperand(source); | 183 Operand src = cgen_->ToOperand(source); |
| 184 if (destination->IsRegister()) { | 184 if (destination->IsRegister()) { |
| 185 Register dst = cgen_->ToRegister(destination); | 185 Register dst = cgen_->ToRegister(destination); |
| 186 __ movq(dst, src); | 186 __ movp(dst, src); |
| 187 } else { | 187 } else { |
| 188 ASSERT(destination->IsStackSlot()); | 188 ASSERT(destination->IsStackSlot()); |
| 189 Operand dst = cgen_->ToOperand(destination); | 189 Operand dst = cgen_->ToOperand(destination); |
| 190 __ movq(kScratchRegister, src); | 190 __ movp(kScratchRegister, src); |
| 191 __ movq(dst, kScratchRegister); | 191 __ movp(dst, kScratchRegister); |
| 192 } | 192 } |
| 193 | 193 |
| 194 } else if (source->IsConstantOperand()) { | 194 } else if (source->IsConstantOperand()) { |
| 195 LConstantOperand* constant_source = LConstantOperand::cast(source); | 195 LConstantOperand* constant_source = LConstantOperand::cast(source); |
| 196 if (destination->IsRegister()) { | 196 if (destination->IsRegister()) { |
| 197 Register dst = cgen_->ToRegister(destination); | 197 Register dst = cgen_->ToRegister(destination); |
| 198 if (cgen_->IsSmiConstant(constant_source)) { | 198 if (cgen_->IsSmiConstant(constant_source)) { |
| 199 __ Move(dst, cgen_->ToSmi(constant_source)); | 199 __ Move(dst, cgen_->ToSmi(constant_source)); |
| 200 } else if (cgen_->IsInteger32Constant(constant_source)) { | 200 } else if (cgen_->IsInteger32Constant(constant_source)) { |
| 201 __ Set(dst, cgen_->ToInteger32(constant_source)); | 201 __ Set(dst, cgen_->ToInteger32(constant_source)); |
| (...skipping 11 matching lines...) Expand all Loading... |
| 213 __ movq(dst, kScratchRegister); | 213 __ movq(dst, kScratchRegister); |
| 214 } | 214 } |
| 215 } else { | 215 } else { |
| 216 ASSERT(destination->IsStackSlot()); | 216 ASSERT(destination->IsStackSlot()); |
| 217 Operand dst = cgen_->ToOperand(destination); | 217 Operand dst = cgen_->ToOperand(destination); |
| 218 if (cgen_->IsSmiConstant(constant_source)) { | 218 if (cgen_->IsSmiConstant(constant_source)) { |
| 219 __ Move(dst, cgen_->ToSmi(constant_source)); | 219 __ Move(dst, cgen_->ToSmi(constant_source)); |
| 220 } else if (cgen_->IsInteger32Constant(constant_source)) { | 220 } else if (cgen_->IsInteger32Constant(constant_source)) { |
| 221 // Zero top 32 bits of a 64 bit spill slot that holds a 32 bit untagged | 221 // Zero top 32 bits of a 64 bit spill slot that holds a 32 bit untagged |
| 222 // value. | 222 // value. |
| 223 __ movq(dst, Immediate(cgen_->ToInteger32(constant_source))); | 223 __ movp(dst, Immediate(cgen_->ToInteger32(constant_source))); |
| 224 } else { | 224 } else { |
| 225 __ Move(kScratchRegister, cgen_->ToHandle(constant_source)); | 225 __ Move(kScratchRegister, cgen_->ToHandle(constant_source)); |
| 226 __ movq(dst, kScratchRegister); | 226 __ movp(dst, kScratchRegister); |
| 227 } | 227 } |
| 228 } | 228 } |
| 229 | 229 |
| 230 } else if (source->IsDoubleRegister()) { | 230 } else if (source->IsDoubleRegister()) { |
| 231 XMMRegister src = cgen_->ToDoubleRegister(source); | 231 XMMRegister src = cgen_->ToDoubleRegister(source); |
| 232 if (destination->IsDoubleRegister()) { | 232 if (destination->IsDoubleRegister()) { |
| 233 __ movaps(cgen_->ToDoubleRegister(destination), src); | 233 __ movaps(cgen_->ToDoubleRegister(destination), src); |
| 234 } else { | 234 } else { |
| 235 ASSERT(destination->IsDoubleStackSlot()); | 235 ASSERT(destination->IsDoubleStackSlot()); |
| 236 __ movsd(cgen_->ToOperand(destination), src); | 236 __ movsd(cgen_->ToOperand(destination), src); |
| (...skipping 27 matching lines...) Expand all Loading... |
| 264 Register dst = cgen_->ToRegister(destination); | 264 Register dst = cgen_->ToRegister(destination); |
| 265 __ xchgq(dst, src); | 265 __ xchgq(dst, src); |
| 266 | 266 |
| 267 } else if ((source->IsRegister() && destination->IsStackSlot()) || | 267 } else if ((source->IsRegister() && destination->IsStackSlot()) || |
| 268 (source->IsStackSlot() && destination->IsRegister())) { | 268 (source->IsStackSlot() && destination->IsRegister())) { |
| 269 // Swap a general-purpose register and a stack slot. | 269 // Swap a general-purpose register and a stack slot. |
| 270 Register reg = | 270 Register reg = |
| 271 cgen_->ToRegister(source->IsRegister() ? source : destination); | 271 cgen_->ToRegister(source->IsRegister() ? source : destination); |
| 272 Operand mem = | 272 Operand mem = |
| 273 cgen_->ToOperand(source->IsRegister() ? destination : source); | 273 cgen_->ToOperand(source->IsRegister() ? destination : source); |
| 274 __ movq(kScratchRegister, mem); | 274 __ movp(kScratchRegister, mem); |
| 275 __ movq(mem, reg); | 275 __ movp(mem, reg); |
| 276 __ movq(reg, kScratchRegister); | 276 __ movp(reg, kScratchRegister); |
| 277 | 277 |
| 278 } else if ((source->IsStackSlot() && destination->IsStackSlot()) || | 278 } else if ((source->IsStackSlot() && destination->IsStackSlot()) || |
| 279 (source->IsDoubleStackSlot() && destination->IsDoubleStackSlot())) { | 279 (source->IsDoubleStackSlot() && destination->IsDoubleStackSlot())) { |
| 280 // Swap two stack slots or two double stack slots. | 280 // Swap two stack slots or two double stack slots. |
| 281 Operand src = cgen_->ToOperand(source); | 281 Operand src = cgen_->ToOperand(source); |
| 282 Operand dst = cgen_->ToOperand(destination); | 282 Operand dst = cgen_->ToOperand(destination); |
| 283 __ movsd(xmm0, src); | 283 __ movsd(xmm0, src); |
| 284 __ movq(kScratchRegister, dst); | 284 __ movp(kScratchRegister, dst); |
| 285 __ movsd(dst, xmm0); | 285 __ movsd(dst, xmm0); |
| 286 __ movq(src, kScratchRegister); | 286 __ movp(src, kScratchRegister); |
| 287 | 287 |
| 288 } else if (source->IsDoubleRegister() && destination->IsDoubleRegister()) { | 288 } else if (source->IsDoubleRegister() && destination->IsDoubleRegister()) { |
| 289 // Swap two double registers. | 289 // Swap two double registers. |
| 290 XMMRegister source_reg = cgen_->ToDoubleRegister(source); | 290 XMMRegister source_reg = cgen_->ToDoubleRegister(source); |
| 291 XMMRegister destination_reg = cgen_->ToDoubleRegister(destination); | 291 XMMRegister destination_reg = cgen_->ToDoubleRegister(destination); |
| 292 __ movaps(xmm0, source_reg); | 292 __ movaps(xmm0, source_reg); |
| 293 __ movaps(source_reg, destination_reg); | 293 __ movaps(source_reg, destination_reg); |
| 294 __ movaps(destination_reg, xmm0); | 294 __ movaps(destination_reg, xmm0); |
| 295 | 295 |
| 296 } else if (source->IsDoubleRegister() || destination->IsDoubleRegister()) { | 296 } else if (source->IsDoubleRegister() || destination->IsDoubleRegister()) { |
| (...skipping 30 matching lines...) Expand all Loading... |
| 327 moves_[i].set_source(source); | 327 moves_[i].set_source(source); |
| 328 } | 328 } |
| 329 } | 329 } |
| 330 } | 330 } |
| 331 | 331 |
| 332 #undef __ | 332 #undef __ |
| 333 | 333 |
| 334 } } // namespace v8::internal | 334 } } // namespace v8::internal |
| 335 | 335 |
| 336 #endif // V8_TARGET_ARCH_X64 | 336 #endif // V8_TARGET_ARCH_X64 |
| OLD | NEW |