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 918 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
929 } | 929 } |
930 for (int i = kNumberOfSavedRegs - 1; i >= 0; i--) { | 930 for (int i = kNumberOfSavedRegs - 1; i >= 0; i--) { |
931 Register reg = saved_regs[i]; | 931 Register reg = saved_regs[i]; |
932 if (!reg.is(exclusion1) && !reg.is(exclusion2) && !reg.is(exclusion3)) { | 932 if (!reg.is(exclusion1) && !reg.is(exclusion2) && !reg.is(exclusion3)) { |
933 pop(reg); | 933 pop(reg); |
934 } | 934 } |
935 } | 935 } |
936 } | 936 } |
937 | 937 |
938 | 938 |
| 939 void MacroAssembler::Cvtlsi2sd(XMMRegister dst, Register src) { |
| 940 xorps(dst, dst); |
| 941 cvtlsi2sd(dst, src); |
| 942 } |
| 943 |
| 944 |
| 945 void MacroAssembler::Cvtlsi2sd(XMMRegister dst, const Operand& src) { |
| 946 xorps(dst, dst); |
| 947 cvtlsi2sd(dst, src); |
| 948 } |
| 949 |
| 950 |
939 void MacroAssembler::Set(Register dst, int64_t x) { | 951 void MacroAssembler::Set(Register dst, int64_t x) { |
940 if (x == 0) { | 952 if (x == 0) { |
941 xorl(dst, dst); | 953 xorl(dst, dst); |
942 } else if (is_uint32(x)) { | 954 } else if (is_uint32(x)) { |
943 movl(dst, Immediate(static_cast<uint32_t>(x))); | 955 movl(dst, Immediate(static_cast<uint32_t>(x))); |
944 } else if (is_int32(x)) { | 956 } else if (is_int32(x)) { |
945 movq(dst, Immediate(static_cast<int32_t>(x))); | 957 movq(dst, Immediate(static_cast<int32_t>(x))); |
946 } else { | 958 } else { |
947 movq(dst, x, RelocInfo::NONE64); | 959 movq(dst, x, RelocInfo::NONE64); |
948 } | 960 } |
(...skipping 1961 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2910 // the double array. | 2922 // the double array. |
2911 Set(kScratchRegister, BitCast<uint64_t>( | 2923 Set(kScratchRegister, BitCast<uint64_t>( |
2912 FixedDoubleArray::canonical_not_the_hole_nan_as_double())); | 2924 FixedDoubleArray::canonical_not_the_hole_nan_as_double())); |
2913 movq(xmm_scratch, kScratchRegister); | 2925 movq(xmm_scratch, kScratchRegister); |
2914 jmp(&have_double_value, Label::kNear); | 2926 jmp(&have_double_value, Label::kNear); |
2915 | 2927 |
2916 bind(&smi_value); | 2928 bind(&smi_value); |
2917 // Value is a smi. convert to a double and store. | 2929 // Value is a smi. convert to a double and store. |
2918 // Preserve original value. | 2930 // Preserve original value. |
2919 SmiToInteger32(kScratchRegister, maybe_number); | 2931 SmiToInteger32(kScratchRegister, maybe_number); |
2920 cvtlsi2sd(xmm_scratch, kScratchRegister); | 2932 Cvtlsi2sd(xmm_scratch, kScratchRegister); |
2921 movsd(FieldOperand(elements, index, times_8, | 2933 movsd(FieldOperand(elements, index, times_8, |
2922 FixedDoubleArray::kHeaderSize - elements_offset), | 2934 FixedDoubleArray::kHeaderSize - elements_offset), |
2923 xmm_scratch); | 2935 xmm_scratch); |
2924 bind(&done); | 2936 bind(&done); |
2925 } | 2937 } |
2926 | 2938 |
2927 | 2939 |
2928 void MacroAssembler::CompareMap(Register obj, | 2940 void MacroAssembler::CompareMap(Register obj, |
2929 Handle<Map> map, | 2941 Handle<Map> map, |
2930 Label* early_success) { | 2942 Label* early_success) { |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3043 } | 3055 } |
3044 | 3056 |
3045 | 3057 |
3046 void MacroAssembler::DoubleToI(Register result_reg, | 3058 void MacroAssembler::DoubleToI(Register result_reg, |
3047 XMMRegister input_reg, | 3059 XMMRegister input_reg, |
3048 XMMRegister scratch, | 3060 XMMRegister scratch, |
3049 MinusZeroMode minus_zero_mode, | 3061 MinusZeroMode minus_zero_mode, |
3050 Label* conversion_failed, | 3062 Label* conversion_failed, |
3051 Label::Distance dst) { | 3063 Label::Distance dst) { |
3052 cvttsd2si(result_reg, input_reg); | 3064 cvttsd2si(result_reg, input_reg); |
3053 cvtlsi2sd(xmm0, result_reg); | 3065 Cvtlsi2sd(xmm0, result_reg); |
3054 ucomisd(xmm0, input_reg); | 3066 ucomisd(xmm0, input_reg); |
3055 j(not_equal, conversion_failed, dst); | 3067 j(not_equal, conversion_failed, dst); |
3056 j(parity_even, conversion_failed, dst); // NaN. | 3068 j(parity_even, conversion_failed, dst); // NaN. |
3057 if (minus_zero_mode == FAIL_ON_MINUS_ZERO) { | 3069 if (minus_zero_mode == FAIL_ON_MINUS_ZERO) { |
3058 Label done; | 3070 Label done; |
3059 // The integer converted back is equal to the original. We | 3071 // The integer converted back is equal to the original. We |
3060 // only have to test if we got -0 as an input. | 3072 // only have to test if we got -0 as an input. |
3061 testl(result_reg, result_reg); | 3073 testl(result_reg, result_reg); |
3062 j(not_zero, &done, Label::kNear); | 3074 j(not_zero, &done, Label::kNear); |
3063 movmskpd(result_reg, input_reg); | 3075 movmskpd(result_reg, input_reg); |
(...skipping 16 matching lines...) Expand all Loading... |
3080 Label done; | 3092 Label done; |
3081 ASSERT(!temp.is(xmm0)); | 3093 ASSERT(!temp.is(xmm0)); |
3082 | 3094 |
3083 // Heap number map check. | 3095 // Heap number map check. |
3084 CompareRoot(FieldOperand(input_reg, HeapObject::kMapOffset), | 3096 CompareRoot(FieldOperand(input_reg, HeapObject::kMapOffset), |
3085 Heap::kHeapNumberMapRootIndex); | 3097 Heap::kHeapNumberMapRootIndex); |
3086 j(not_equal, lost_precision, dst); | 3098 j(not_equal, lost_precision, dst); |
3087 | 3099 |
3088 movsd(xmm0, FieldOperand(input_reg, HeapNumber::kValueOffset)); | 3100 movsd(xmm0, FieldOperand(input_reg, HeapNumber::kValueOffset)); |
3089 cvttsd2si(result_reg, xmm0); | 3101 cvttsd2si(result_reg, xmm0); |
3090 cvtlsi2sd(temp, result_reg); | 3102 Cvtlsi2sd(temp, result_reg); |
3091 ucomisd(xmm0, temp); | 3103 ucomisd(xmm0, temp); |
3092 RecordComment("Deferred TaggedToI: lost precision"); | 3104 RecordComment("Deferred TaggedToI: lost precision"); |
3093 j(not_equal, lost_precision, dst); | 3105 j(not_equal, lost_precision, dst); |
3094 RecordComment("Deferred TaggedToI: NaN"); | 3106 RecordComment("Deferred TaggedToI: NaN"); |
3095 j(parity_even, lost_precision, dst); // NaN. | 3107 j(parity_even, lost_precision, dst); // NaN. |
3096 if (minus_zero_mode == FAIL_ON_MINUS_ZERO) { | 3108 if (minus_zero_mode == FAIL_ON_MINUS_ZERO) { |
3097 testl(result_reg, result_reg); | 3109 testl(result_reg, result_reg); |
3098 j(not_zero, &done, Label::kNear); | 3110 j(not_zero, &done, Label::kNear); |
3099 movmskpd(result_reg, xmm0); | 3111 movmskpd(result_reg, xmm0); |
3100 andl(result_reg, Immediate(1)); | 3112 andl(result_reg, Immediate(1)); |
(...skipping 1706 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4807 j(greater, &no_memento_available); | 4819 j(greater, &no_memento_available); |
4808 CompareRoot(MemOperand(scratch_reg, -AllocationMemento::kSize), | 4820 CompareRoot(MemOperand(scratch_reg, -AllocationMemento::kSize), |
4809 Heap::kAllocationMementoMapRootIndex); | 4821 Heap::kAllocationMementoMapRootIndex); |
4810 bind(&no_memento_available); | 4822 bind(&no_memento_available); |
4811 } | 4823 } |
4812 | 4824 |
4813 | 4825 |
4814 } } // namespace v8::internal | 4826 } } // namespace v8::internal |
4815 | 4827 |
4816 #endif // V8_TARGET_ARCH_X64 | 4828 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |