OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
276 | 276 |
277 | 277 |
278 void MacroAssembler::DoubleToI(Register result_reg, | 278 void MacroAssembler::DoubleToI(Register result_reg, |
279 XMMRegister input_reg, | 279 XMMRegister input_reg, |
280 XMMRegister scratch, | 280 XMMRegister scratch, |
281 MinusZeroMode minus_zero_mode, | 281 MinusZeroMode minus_zero_mode, |
282 Label* conversion_failed, | 282 Label* conversion_failed, |
283 Label::Distance dst) { | 283 Label::Distance dst) { |
284 ASSERT(!input_reg.is(scratch)); | 284 ASSERT(!input_reg.is(scratch)); |
285 cvttsd2si(result_reg, Operand(input_reg)); | 285 cvttsd2si(result_reg, Operand(input_reg)); |
286 cvtsi2sd(scratch, Operand(result_reg)); | 286 Cvtsi2sd(scratch, Operand(result_reg)); |
287 ucomisd(scratch, input_reg); | 287 ucomisd(scratch, input_reg); |
288 j(not_equal, conversion_failed, dst); | 288 j(not_equal, conversion_failed, dst); |
289 j(parity_even, conversion_failed, dst); // NaN. | 289 j(parity_even, conversion_failed, dst); // NaN. |
290 if (minus_zero_mode == FAIL_ON_MINUS_ZERO) { | 290 if (minus_zero_mode == FAIL_ON_MINUS_ZERO) { |
291 Label done; | 291 Label done; |
292 // The integer converted back is equal to the original. We | 292 // The integer converted back is equal to the original. We |
293 // only have to test if we got -0 as an input. | 293 // only have to test if we got -0 as an input. |
294 test(result_reg, Operand(result_reg)); | 294 test(result_reg, Operand(result_reg)); |
295 j(not_zero, &done, Label::kNear); | 295 j(not_zero, &done, Label::kNear); |
296 movmskpd(result_reg, input_reg); | 296 movmskpd(result_reg, input_reg); |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
385 cmp(FieldOperand(input_reg, HeapObject::kMapOffset), | 385 cmp(FieldOperand(input_reg, HeapObject::kMapOffset), |
386 isolate()->factory()->heap_number_map()); | 386 isolate()->factory()->heap_number_map()); |
387 j(not_equal, lost_precision, Label::kNear); | 387 j(not_equal, lost_precision, Label::kNear); |
388 | 388 |
389 if (CpuFeatures::IsSafeForSnapshot(SSE2)) { | 389 if (CpuFeatures::IsSafeForSnapshot(SSE2)) { |
390 ASSERT(!temp.is(no_xmm_reg)); | 390 ASSERT(!temp.is(no_xmm_reg)); |
391 CpuFeatureScope scope(this, SSE2); | 391 CpuFeatureScope scope(this, SSE2); |
392 | 392 |
393 movdbl(xmm0, FieldOperand(input_reg, HeapNumber::kValueOffset)); | 393 movdbl(xmm0, FieldOperand(input_reg, HeapNumber::kValueOffset)); |
394 cvttsd2si(result_reg, Operand(xmm0)); | 394 cvttsd2si(result_reg, Operand(xmm0)); |
395 cvtsi2sd(temp, Operand(result_reg)); | 395 Cvtsi2sd(temp, Operand(result_reg)); |
396 ucomisd(xmm0, temp); | 396 ucomisd(xmm0, temp); |
397 RecordComment("Deferred TaggedToI: lost precision"); | 397 RecordComment("Deferred TaggedToI: lost precision"); |
398 j(not_equal, lost_precision, Label::kNear); | 398 j(not_equal, lost_precision, Label::kNear); |
399 RecordComment("Deferred TaggedToI: NaN"); | 399 RecordComment("Deferred TaggedToI: NaN"); |
400 j(parity_even, lost_precision, Label::kNear); | 400 j(parity_even, lost_precision, Label::kNear); |
401 if (minus_zero_mode == FAIL_ON_MINUS_ZERO) { | 401 if (minus_zero_mode == FAIL_ON_MINUS_ZERO) { |
402 test(result_reg, Operand(result_reg)); | 402 test(result_reg, Operand(result_reg)); |
403 j(not_zero, &done, Label::kNear); | 403 j(not_zero, &done, Label::kNear); |
404 movmskpd(result_reg, xmm0); | 404 movmskpd(result_reg, xmm0); |
405 and_(result_reg, 1); | 405 and_(result_reg, 1); |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
450 static_cast<double>(static_cast<uint32_t>(0xFFFFFFFF)) + 1; | 450 static_cast<double>(static_cast<uint32_t>(0xFFFFFFFF)) + 1; |
451 | 451 |
452 | 452 |
453 void MacroAssembler::LoadUint32(XMMRegister dst, | 453 void MacroAssembler::LoadUint32(XMMRegister dst, |
454 Register src, | 454 Register src, |
455 XMMRegister scratch) { | 455 XMMRegister scratch) { |
456 Label done; | 456 Label done; |
457 cmp(src, Immediate(0)); | 457 cmp(src, Immediate(0)); |
458 movdbl(scratch, | 458 movdbl(scratch, |
459 Operand(reinterpret_cast<int32_t>(&kUint32Bias), RelocInfo::NONE32)); | 459 Operand(reinterpret_cast<int32_t>(&kUint32Bias), RelocInfo::NONE32)); |
460 cvtsi2sd(dst, src); | 460 Cvtsi2sd(dst, src); |
461 j(not_sign, &done, Label::kNear); | 461 j(not_sign, &done, Label::kNear); |
462 addsd(dst, scratch); | 462 addsd(dst, scratch); |
463 bind(&done); | 463 bind(&done); |
464 } | 464 } |
465 | 465 |
466 | 466 |
467 void MacroAssembler::RecordWriteArray(Register object, | 467 void MacroAssembler::RecordWriteArray(Register object, |
468 Register value, | 468 Register value, |
469 Register index, | 469 Register index, |
470 SaveFPRegsMode save_fp, | 470 SaveFPRegsMode save_fp, |
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
669 #ifdef ENABLE_DEBUGGER_SUPPORT | 669 #ifdef ENABLE_DEBUGGER_SUPPORT |
670 void MacroAssembler::DebugBreak() { | 670 void MacroAssembler::DebugBreak() { |
671 Set(eax, Immediate(0)); | 671 Set(eax, Immediate(0)); |
672 mov(ebx, Immediate(ExternalReference(Runtime::kDebugBreak, isolate()))); | 672 mov(ebx, Immediate(ExternalReference(Runtime::kDebugBreak, isolate()))); |
673 CEntryStub ces(1); | 673 CEntryStub ces(1); |
674 call(ces.GetCode(isolate()), RelocInfo::DEBUG_BREAK); | 674 call(ces.GetCode(isolate()), RelocInfo::DEBUG_BREAK); |
675 } | 675 } |
676 #endif | 676 #endif |
677 | 677 |
678 | 678 |
| 679 void MacroAssembler::Cvtsi2sd(XMMRegister dst, const Operand& src) { |
| 680 xorps(dst, dst); |
| 681 cvtsi2sd(dst, src); |
| 682 } |
| 683 |
| 684 |
679 void MacroAssembler::Set(Register dst, const Immediate& x) { | 685 void MacroAssembler::Set(Register dst, const Immediate& x) { |
680 if (x.is_zero()) { | 686 if (x.is_zero()) { |
681 xor_(dst, dst); // Shorter than mov. | 687 xor_(dst, dst); // Shorter than mov. |
682 } else { | 688 } else { |
683 mov(dst, x); | 689 mov(dst, x); |
684 } | 690 } |
685 } | 691 } |
686 | 692 |
687 | 693 |
688 void MacroAssembler::Set(const Operand& dst, const Immediate& x) { | 694 void MacroAssembler::Set(const Operand& dst, const Immediate& x) { |
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
827 } | 833 } |
828 jmp(&have_double_value, Label::kNear); | 834 jmp(&have_double_value, Label::kNear); |
829 | 835 |
830 bind(&smi_value); | 836 bind(&smi_value); |
831 // Value is a smi. Convert to a double and store. | 837 // Value is a smi. Convert to a double and store. |
832 // Preserve original value. | 838 // Preserve original value. |
833 mov(scratch1, maybe_number); | 839 mov(scratch1, maybe_number); |
834 SmiUntag(scratch1); | 840 SmiUntag(scratch1); |
835 if (CpuFeatures::IsSupported(SSE2) && specialize_for_processor) { | 841 if (CpuFeatures::IsSupported(SSE2) && specialize_for_processor) { |
836 CpuFeatureScope fscope(this, SSE2); | 842 CpuFeatureScope fscope(this, SSE2); |
837 cvtsi2sd(scratch2, scratch1); | 843 Cvtsi2sd(scratch2, scratch1); |
838 movdbl(FieldOperand(elements, key, times_4, | 844 movdbl(FieldOperand(elements, key, times_4, |
839 FixedDoubleArray::kHeaderSize - elements_offset), | 845 FixedDoubleArray::kHeaderSize - elements_offset), |
840 scratch2); | 846 scratch2); |
841 } else { | 847 } else { |
842 push(scratch1); | 848 push(scratch1); |
843 fild_s(Operand(esp, 0)); | 849 fild_s(Operand(esp, 0)); |
844 pop(scratch1); | 850 pop(scratch1); |
845 fstp_d(FieldOperand(elements, key, times_4, | 851 fstp_d(FieldOperand(elements, key, times_4, |
846 FixedDoubleArray::kHeaderSize - elements_offset)); | 852 FixedDoubleArray::kHeaderSize - elements_offset)); |
847 } | 853 } |
(...skipping 2576 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3424 j(greater, &no_memento_available); | 3430 j(greater, &no_memento_available); |
3425 cmp(MemOperand(scratch_reg, -AllocationMemento::kSize), | 3431 cmp(MemOperand(scratch_reg, -AllocationMemento::kSize), |
3426 Immediate(Handle<Map>(isolate()->heap()->allocation_memento_map()))); | 3432 Immediate(Handle<Map>(isolate()->heap()->allocation_memento_map()))); |
3427 bind(&no_memento_available); | 3433 bind(&no_memento_available); |
3428 } | 3434 } |
3429 | 3435 |
3430 | 3436 |
3431 } } // namespace v8::internal | 3437 } } // namespace v8::internal |
3432 | 3438 |
3433 #endif // V8_TARGET_ARCH_IA32 | 3439 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |