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 } | |
341 } else { | 316 } else { |
342 ASSERT(destination->IsStackSlot()); | 317 ASSERT(destination->IsStackSlot()); |
343 Operand dst = cgen_->ToOperand(destination); | 318 Operand dst = cgen_->ToOperand(destination); |
344 if (cgen_->IsSmi(constant_source)) { | 319 if (cgen_->IsSmi(constant_source)) { |
345 __ Set(dst, cgen_->ToSmiImmediate(constant_source)); | 320 __ Set(dst, cgen_->ToSmiImmediate(constant_source)); |
346 } else if (cgen_->IsInteger32(constant_source)) { | 321 } else if (cgen_->IsInteger32(constant_source)) { |
347 __ Set(dst, cgen_->ToInteger32Immediate(constant_source)); | 322 __ Set(dst, cgen_->ToInteger32Immediate(constant_source)); |
348 } else { | 323 } else { |
349 Register tmp = EnsureTempRegister(); | 324 Register tmp = EnsureTempRegister(); |
350 __ LoadObject(tmp, cgen_->ToHandle(constant_source)); | 325 __ LoadObject(tmp, cgen_->ToHandle(constant_source)); |
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
544 } else if (destination->IsRegister()) { | 519 } else if (destination->IsRegister()) { |
545 source_uses_[destination->index()] = CountSourceUses(destination); | 520 source_uses_[destination->index()] = CountSourceUses(destination); |
546 } | 521 } |
547 } | 522 } |
548 | 523 |
549 #undef __ | 524 #undef __ |
550 | 525 |
551 } } // namespace v8::internal | 526 } } // namespace v8::internal |
552 | 527 |
553 #endif // V8_TARGET_ARCH_IA32 | 528 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |