| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include <limits.h> // For LONG_MIN, LONG_MAX. | 5 #include <limits.h> // For LONG_MIN, LONG_MAX. |
| 6 | 6 |
| 7 #include "src/v8.h" | 7 #include "src/v8.h" |
| 8 | 8 |
| 9 #if V8_TARGET_ARCH_MIPS64 | 9 #if V8_TARGET_ARCH_MIPS64 |
| 10 | 10 |
| (...skipping 3847 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3858 Branch(fail, hi, scratch, | 3858 Branch(fail, hi, scratch, |
| 3859 Operand(Map::kMaximumBitField2FastHoleySmiElementValue)); | 3859 Operand(Map::kMaximumBitField2FastHoleySmiElementValue)); |
| 3860 } | 3860 } |
| 3861 | 3861 |
| 3862 | 3862 |
| 3863 void MacroAssembler::StoreNumberToDoubleElements(Register value_reg, | 3863 void MacroAssembler::StoreNumberToDoubleElements(Register value_reg, |
| 3864 Register key_reg, | 3864 Register key_reg, |
| 3865 Register elements_reg, | 3865 Register elements_reg, |
| 3866 Register scratch1, | 3866 Register scratch1, |
| 3867 Register scratch2, | 3867 Register scratch2, |
| 3868 Register scratch3, | |
| 3869 Label* fail, | 3868 Label* fail, |
| 3870 int elements_offset) { | 3869 int elements_offset) { |
| 3871 Label smi_value, maybe_nan, have_double_value, is_nan, done; | 3870 Label smi_value, done; |
| 3872 Register mantissa_reg = scratch2; | |
| 3873 Register exponent_reg = scratch3; | |
| 3874 | 3871 |
| 3875 // Handle smi values specially. | 3872 // Handle smi values specially. |
| 3876 JumpIfSmi(value_reg, &smi_value); | 3873 JumpIfSmi(value_reg, &smi_value); |
| 3877 | 3874 |
| 3878 // Ensure that the object is a heap number | 3875 // Ensure that the object is a heap number. |
| 3879 CheckMap(value_reg, | 3876 CheckMap(value_reg, |
| 3880 scratch1, | 3877 scratch1, |
| 3881 Heap::kHeapNumberMapRootIndex, | 3878 Heap::kHeapNumberMapRootIndex, |
| 3882 fail, | 3879 fail, |
| 3883 DONT_DO_SMI_CHECK); | 3880 DONT_DO_SMI_CHECK); |
| 3884 | 3881 |
| 3885 // Check for nan: all NaN values have a value greater (signed) than 0x7ff00000 | 3882 // Double value, turn potential sNaN into qNan. |
| 3886 // in the exponent. | 3883 DoubleRegister double_result = f0; |
| 3887 li(scratch1, Operand(kHoleNanUpper32 & HeapNumber::kExponentMask)); | 3884 DoubleRegister double_scratch = f2; |
| 3888 lw(exponent_reg, FieldMemOperand(value_reg, HeapNumber::kExponentOffset)); | |
| 3889 Branch(&maybe_nan, ge, exponent_reg, Operand(scratch1)); | |
| 3890 | 3885 |
| 3891 lwu(mantissa_reg, FieldMemOperand(value_reg, HeapNumber::kMantissaOffset)); | 3886 ldc1(double_result, FieldMemOperand(value_reg, HeapNumber::kValueOffset)); |
| 3892 | 3887 FPUCanonicalizeNaN(double_result, double_result); |
| 3893 bind(&have_double_value); | 3888 Branch(&done); |
| 3894 // dsll(scratch1, key_reg, kDoubleSizeLog2 - kSmiTagSize); | |
| 3895 dsra(scratch1, key_reg, 32 - kDoubleSizeLog2); | |
| 3896 Daddu(scratch1, scratch1, elements_reg); | |
| 3897 sw(mantissa_reg, FieldMemOperand( | |
| 3898 scratch1, FixedDoubleArray::kHeaderSize - elements_offset)); | |
| 3899 uint32_t offset = FixedDoubleArray::kHeaderSize - elements_offset + | |
| 3900 sizeof(kHoleNanLower32); | |
| 3901 sw(exponent_reg, FieldMemOperand(scratch1, offset)); | |
| 3902 jmp(&done); | |
| 3903 | |
| 3904 bind(&maybe_nan); | |
| 3905 // Could be NaN, Infinity or -Infinity. If fraction is not zero, it's NaN, | |
| 3906 // otherwise it's Infinity or -Infinity, and the non-NaN code path applies. | |
| 3907 lw(mantissa_reg, FieldMemOperand(value_reg, HeapNumber::kMantissaOffset)); | |
| 3908 Branch(&have_double_value, eq, mantissa_reg, Operand(zero_reg)); | |
| 3909 bind(&is_nan); | |
| 3910 // Load canonical NaN for storing into the double array. | |
| 3911 LoadRoot(at, Heap::kNanValueRootIndex); | |
| 3912 lw(mantissa_reg, FieldMemOperand(at, HeapNumber::kMantissaOffset)); | |
| 3913 lw(exponent_reg, FieldMemOperand(at, HeapNumber::kExponentOffset)); | |
| 3914 jmp(&have_double_value); | |
| 3915 | 3889 |
| 3916 bind(&smi_value); | 3890 bind(&smi_value); |
| 3891 // scratch1 is now effective address of the double element. |
| 3892 // Untag and transfer. |
| 3893 mthc1(value_reg, double_scratch); |
| 3894 cvt_d_w(double_result, double_scratch); |
| 3895 |
| 3896 bind(&done); |
| 3917 Daddu(scratch1, elements_reg, | 3897 Daddu(scratch1, elements_reg, |
| 3918 Operand(FixedDoubleArray::kHeaderSize - kHeapObjectTag - | 3898 Operand(FixedDoubleArray::kHeaderSize - kHeapObjectTag - |
| 3919 elements_offset)); | 3899 elements_offset)); |
| 3920 // dsll(scratch2, key_reg, kDoubleSizeLog2 - kSmiTagSize); | |
| 3921 dsra(scratch2, key_reg, 32 - kDoubleSizeLog2); | 3900 dsra(scratch2, key_reg, 32 - kDoubleSizeLog2); |
| 3922 Daddu(scratch1, scratch1, scratch2); | 3901 Daddu(scratch1, scratch1, scratch2); |
| 3923 // scratch1 is now effective address of the double element | 3902 sdc1(double_result, MemOperand(scratch1, 0)); |
| 3924 | |
| 3925 Register untagged_value = elements_reg; | |
| 3926 SmiUntag(untagged_value, value_reg); | |
| 3927 mtc1(untagged_value, f2); | |
| 3928 cvt_d_w(f0, f2); | |
| 3929 sdc1(f0, MemOperand(scratch1, 0)); | |
| 3930 bind(&done); | |
| 3931 } | 3903 } |
| 3932 | 3904 |
| 3933 | 3905 |
| 3934 void MacroAssembler::CompareMapAndBranch(Register obj, | 3906 void MacroAssembler::CompareMapAndBranch(Register obj, |
| 3935 Register scratch, | 3907 Register scratch, |
| 3936 Handle<Map> map, | 3908 Handle<Map> map, |
| 3937 Label* early_success, | 3909 Label* early_success, |
| 3938 Condition cond, | 3910 Condition cond, |
| 3939 Label* branch_to) { | 3911 Label* branch_to) { |
| 3940 ld(scratch, FieldMemOperand(obj, HeapObject::kMapOffset)); | 3912 ld(scratch, FieldMemOperand(obj, HeapObject::kMapOffset)); |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3992 LoadRoot(at, index); | 3964 LoadRoot(at, index); |
| 3993 Branch(fail, ne, scratch, Operand(at)); | 3965 Branch(fail, ne, scratch, Operand(at)); |
| 3994 } | 3966 } |
| 3995 | 3967 |
| 3996 | 3968 |
| 3997 void MacroAssembler::GetWeakValue(Register value, Handle<WeakCell> cell) { | 3969 void MacroAssembler::GetWeakValue(Register value, Handle<WeakCell> cell) { |
| 3998 li(value, Operand(cell)); | 3970 li(value, Operand(cell)); |
| 3999 ld(value, FieldMemOperand(value, WeakCell::kValueOffset)); | 3971 ld(value, FieldMemOperand(value, WeakCell::kValueOffset)); |
| 4000 } | 3972 } |
| 4001 | 3973 |
| 3974 void MacroAssembler::FPUCanonicalizeNaN(const DoubleRegister dst, |
| 3975 const DoubleRegister src) { |
| 3976 sub_d(dst, src, kDoubleRegZero); |
| 3977 } |
| 4002 | 3978 |
| 4003 void MacroAssembler::LoadWeakValue(Register value, Handle<WeakCell> cell, | 3979 void MacroAssembler::LoadWeakValue(Register value, Handle<WeakCell> cell, |
| 4004 Label* miss) { | 3980 Label* miss) { |
| 4005 GetWeakValue(value, cell); | 3981 GetWeakValue(value, cell); |
| 4006 JumpIfSmi(value, miss); | 3982 JumpIfSmi(value, miss); |
| 4007 } | 3983 } |
| 4008 | 3984 |
| 4009 | 3985 |
| 4010 void MacroAssembler::MovFromFloatResult(const DoubleRegister dst) { | 3986 void MacroAssembler::MovFromFloatResult(const DoubleRegister dst) { |
| 4011 if (IsMipsSoftFloatABI) { | 3987 if (IsMipsSoftFloatABI) { |
| (...skipping 2189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6201 } | 6177 } |
| 6202 if (mag.shift > 0) sra(result, result, mag.shift); | 6178 if (mag.shift > 0) sra(result, result, mag.shift); |
| 6203 srl(at, dividend, 31); | 6179 srl(at, dividend, 31); |
| 6204 Addu(result, result, Operand(at)); | 6180 Addu(result, result, Operand(at)); |
| 6205 } | 6181 } |
| 6206 | 6182 |
| 6207 | 6183 |
| 6208 } } // namespace v8::internal | 6184 } } // namespace v8::internal |
| 6209 | 6185 |
| 6210 #endif // V8_TARGET_ARCH_MIPS64 | 6186 #endif // V8_TARGET_ARCH_MIPS64 |
| OLD | NEW |