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