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 295 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
306 LConstantOperand* constant_source = LConstantOperand::cast(source); | 306 LConstantOperand* constant_source = LConstantOperand::cast(source); |
307 if (destination->IsRegister()) { | 307 if (destination->IsRegister()) { |
308 Register dst = cgen_->ToRegister(destination); | 308 Register dst = cgen_->ToRegister(destination); |
309 if (cgen_->IsSmi(constant_source)) { | 309 if (cgen_->IsSmi(constant_source)) { |
310 __ Set(dst, cgen_->ToSmiImmediate(constant_source)); | 310 __ Set(dst, cgen_->ToSmiImmediate(constant_source)); |
311 } else if (cgen_->IsInteger32(constant_source)) { | 311 } else if (cgen_->IsInteger32(constant_source)) { |
312 __ Set(dst, cgen_->ToInteger32Immediate(constant_source)); | 312 __ Set(dst, cgen_->ToInteger32Immediate(constant_source)); |
313 } else { | 313 } else { |
314 __ LoadObject(dst, cgen_->ToHandle(constant_source)); | 314 __ LoadObject(dst, cgen_->ToHandle(constant_source)); |
315 } | 315 } |
| 316 } else if (destination->IsDoubleRegister()) { |
| 317 double v = cgen_->ToDouble(constant_source); |
| 318 uint64_t int_val = BitCast<uint64_t, double>(v); |
| 319 int32_t lower = static_cast<int32_t>(int_val); |
| 320 int32_t upper = static_cast<int32_t>(int_val >> kBitsPerInt); |
| 321 if (CpuFeatures::IsSupported(SSE2)) { |
| 322 CpuFeatureScope scope(cgen_->masm(), SSE2); |
| 323 XMMRegister dst = cgen_->ToDoubleRegister(destination); |
| 324 if (int_val == 0) { |
| 325 __ xorps(dst, dst); |
| 326 } else { |
| 327 __ push(Immediate(upper)); |
| 328 __ push(Immediate(lower)); |
| 329 __ movdbl(dst, Operand(esp, 0)); |
| 330 __ add(esp, Immediate(kDoubleSize)); |
| 331 } |
| 332 } else { |
| 333 __ push(Immediate(upper)); |
| 334 __ push(Immediate(lower)); |
| 335 if (cgen_->X87StackNonEmpty()) { |
| 336 cgen_->PopX87(); |
| 337 } |
| 338 cgen_->PushX87DoubleOperand(MemOperand(esp, 0)); |
| 339 __ add(esp, Immediate(kDoubleSize)); |
| 340 } |
316 } else { | 341 } else { |
317 ASSERT(destination->IsStackSlot()); | 342 ASSERT(destination->IsStackSlot()); |
318 Operand dst = cgen_->ToOperand(destination); | 343 Operand dst = cgen_->ToOperand(destination); |
319 if (cgen_->IsSmi(constant_source)) { | 344 if (cgen_->IsSmi(constant_source)) { |
320 __ Set(dst, cgen_->ToSmiImmediate(constant_source)); | 345 __ Set(dst, cgen_->ToSmiImmediate(constant_source)); |
321 } else if (cgen_->IsInteger32(constant_source)) { | 346 } else if (cgen_->IsInteger32(constant_source)) { |
322 __ Set(dst, cgen_->ToInteger32Immediate(constant_source)); | 347 __ Set(dst, cgen_->ToInteger32Immediate(constant_source)); |
323 } else { | 348 } else { |
324 Register tmp = EnsureTempRegister(); | 349 Register tmp = EnsureTempRegister(); |
325 __ LoadObject(tmp, cgen_->ToHandle(constant_source)); | 350 __ LoadObject(tmp, cgen_->ToHandle(constant_source)); |
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
519 } else if (destination->IsRegister()) { | 544 } else if (destination->IsRegister()) { |
520 source_uses_[destination->index()] = CountSourceUses(destination); | 545 source_uses_[destination->index()] = CountSourceUses(destination); |
521 } | 546 } |
522 } | 547 } |
523 | 548 |
524 #undef __ | 549 #undef __ |
525 | 550 |
526 } } // namespace v8::internal | 551 } } // namespace v8::internal |
527 | 552 |
528 #endif // V8_TARGET_ARCH_IA32 | 553 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |