| 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 3677 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3688 // Extract exponent to t5. | 3688 // Extract exponent to t5. |
| 3689 __ srl(t5, value, kBinary32MantissaBits); | 3689 __ srl(t5, value, kBinary32MantissaBits); |
| 3690 __ And(t5, t5, Operand(kBinary32ExponentMask >> kBinary32MantissaBits)); | 3690 __ And(t5, t5, Operand(kBinary32ExponentMask >> kBinary32MantissaBits)); |
| 3691 | 3691 |
| 3692 Label exponent_rebiased; | 3692 Label exponent_rebiased; |
| 3693 __ Branch(&exponent_rebiased, eq, t5, Operand(zero_reg)); | 3693 __ Branch(&exponent_rebiased, eq, t5, Operand(zero_reg)); |
| 3694 | 3694 |
| 3695 __ li(t0, 0x7ff); | 3695 __ li(t0, 0x7ff); |
| 3696 __ Xor(t1, t5, Operand(0xFF)); | 3696 __ Xor(t1, t5, Operand(0xFF)); |
| 3697 __ Movz(t5, t0, t1); // Set t5 to 0x7ff only if t5 is equal to 0xff. | 3697 __ Movz(t5, t0, t1); // Set t5 to 0x7ff only if t5 is equal to 0xff. |
| 3698 __ Branch(&exponent_rebiased, eq, t0, Operand(0xff)); | 3698 __ Branch(&exponent_rebiased, eq, t1, Operand(zero_reg)); |
| 3699 | 3699 |
| 3700 // Rebias exponent. | 3700 // Rebias exponent. |
| 3701 __ Addu(t5, | 3701 __ Addu(t5, |
| 3702 t5, | 3702 t5, |
| 3703 Operand(-kBinary32ExponentBias + HeapNumber::kExponentBias)); | 3703 Operand(-kBinary32ExponentBias + HeapNumber::kExponentBias)); |
| 3704 | 3704 |
| 3705 __ bind(&exponent_rebiased); | 3705 __ bind(&exponent_rebiased); |
| 3706 __ And(a2, value, Operand(kBinary32SignMask)); | 3706 __ And(a2, value, Operand(kBinary32SignMask)); |
| 3707 value = no_reg; | 3707 value = no_reg; |
| 3708 __ sll(t0, t5, HeapNumber::kMantissaBitsInTopWord); | 3708 __ sll(t0, t5, HeapNumber::kMantissaBitsInTopWord); |
| (...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3988 | 3988 |
| 3989 // Test for all special exponent values: zeros, subnormal numbers, NaNs | 3989 // Test for all special exponent values: zeros, subnormal numbers, NaNs |
| 3990 // and infinities. All these should be converted to 0. | 3990 // and infinities. All these should be converted to 0. |
| 3991 __ li(t5, HeapNumber::kExponentMask); | 3991 __ li(t5, HeapNumber::kExponentMask); |
| 3992 __ and_(t6, t3, t5); | 3992 __ and_(t6, t3, t5); |
| 3993 __ Branch(&nan_or_infinity_or_zero, eq, t6, Operand(zero_reg)); | 3993 __ Branch(&nan_or_infinity_or_zero, eq, t6, Operand(zero_reg)); |
| 3994 | 3994 |
| 3995 __ xor_(t1, t6, t5); | 3995 __ xor_(t1, t6, t5); |
| 3996 __ li(t2, kBinary32ExponentMask); | 3996 __ li(t2, kBinary32ExponentMask); |
| 3997 __ Movz(t6, t2, t1); // Only if t6 is equal to t5. | 3997 __ Movz(t6, t2, t1); // Only if t6 is equal to t5. |
| 3998 __ Branch(&nan_or_infinity_or_zero, eq, t6, Operand(t5)); | 3998 __ Branch(&nan_or_infinity_or_zero, eq, t1, Operand(zero_reg)); |
| 3999 | 3999 |
| 4000 // Rebias exponent. | 4000 // Rebias exponent. |
| 4001 __ srl(t6, t6, HeapNumber::kExponentShift); | 4001 __ srl(t6, t6, HeapNumber::kExponentShift); |
| 4002 __ Addu(t6, | 4002 __ Addu(t6, |
| 4003 t6, | 4003 t6, |
| 4004 Operand(kBinary32ExponentBias - HeapNumber::kExponentBias)); | 4004 Operand(kBinary32ExponentBias - HeapNumber::kExponentBias)); |
| 4005 | 4005 |
| 4006 __ li(t1, Operand(kBinary32MaxExponent)); | 4006 __ li(t1, Operand(kBinary32MaxExponent)); |
| 4007 __ Slt(t1, t1, t6); | 4007 __ Slt(t1, t1, t6); |
| 4008 __ And(t2, t3, Operand(HeapNumber::kSignMask)); | 4008 __ And(t2, t3, Operand(HeapNumber::kSignMask)); |
| (...skipping 10 matching lines...) Expand all Loading... |
| 4019 __ And(t3, t3, Operand(HeapNumber::kMantissaMask)); | 4019 __ And(t3, t3, Operand(HeapNumber::kMantissaMask)); |
| 4020 __ sll(t3, t3, kMantissaInHiWordShift); | 4020 __ sll(t3, t3, kMantissaInHiWordShift); |
| 4021 __ or_(t7, t7, t3); | 4021 __ or_(t7, t7, t3); |
| 4022 __ srl(t4, t4, kMantissaInLoWordShift); | 4022 __ srl(t4, t4, kMantissaInLoWordShift); |
| 4023 __ or_(t7, t7, t4); | 4023 __ or_(t7, t7, t4); |
| 4024 __ sll(t6, t6, kBinary32ExponentShift); | 4024 __ sll(t6, t6, kBinary32ExponentShift); |
| 4025 __ or_(t3, t7, t6); | 4025 __ or_(t3, t7, t6); |
| 4026 | 4026 |
| 4027 __ bind(&done); | 4027 __ bind(&done); |
| 4028 __ sll(t9, key, 1); | 4028 __ sll(t9, key, 1); |
| 4029 __ addu(t9, a2, t9); | 4029 __ addu(t9, a3, t9); |
| 4030 __ sw(t3, MemOperand(t9, 0)); | 4030 __ sw(t3, MemOperand(t9, 0)); |
| 4031 | 4031 |
| 4032 // Entry registers are intact, a0 holds the value which is the return | 4032 // Entry registers are intact, a0 holds the value which is the return |
| 4033 // value. | 4033 // value. |
| 4034 __ mov(v0, a0); | 4034 __ mov(v0, a0); |
| 4035 __ Ret(); | 4035 __ Ret(); |
| 4036 | 4036 |
| 4037 __ bind(&nan_or_infinity_or_zero); | 4037 __ bind(&nan_or_infinity_or_zero); |
| 4038 __ And(t7, t3, Operand(HeapNumber::kSignMask)); | 4038 __ And(t7, t3, Operand(HeapNumber::kSignMask)); |
| 4039 __ And(t3, t3, Operand(HeapNumber::kMantissaMask)); | 4039 __ And(t3, t3, Operand(HeapNumber::kMantissaMask)); |
| 4040 __ or_(t6, t6, t7); | 4040 __ or_(t6, t6, t7); |
| 4041 __ sll(t3, t3, kMantissaInHiWordShift); | 4041 __ sll(t3, t3, kMantissaInHiWordShift); |
| 4042 __ or_(t6, t6, t3); | 4042 __ or_(t6, t6, t3); |
| 4043 __ srl(t4, t4, kMantissaInLoWordShift); | 4043 __ srl(t4, t4, kMantissaInLoWordShift); |
| 4044 __ or_(t3, t6, t4); | 4044 __ or_(t3, t6, t4); |
| 4045 __ Branch(&done); | 4045 __ Branch(&done); |
| 4046 } else if (elements_kind == EXTERNAL_DOUBLE_ELEMENTS) { | 4046 } else if (elements_kind == EXTERNAL_DOUBLE_ELEMENTS) { |
| 4047 __ sll(t8, t0, 3); | 4047 __ sll(t8, key, 2); |
| 4048 __ addu(t8, a3, t8); | 4048 __ addu(t8, a3, t8); |
| 4049 // t8: effective address of destination element. | 4049 // t8: effective address of destination element. |
| 4050 __ sw(t4, MemOperand(t8, 0)); | 4050 __ sw(t4, MemOperand(t8, 0)); |
| 4051 __ sw(t3, MemOperand(t8, Register::kSizeInBytes)); | 4051 __ sw(t3, MemOperand(t8, Register::kSizeInBytes)); |
| 4052 __ mov(v0, a0); | 4052 __ mov(v0, a0); |
| 4053 __ Ret(); | 4053 __ Ret(); |
| 4054 } else { | 4054 } else { |
| 4055 bool is_signed_type = IsElementTypeSigned(elements_kind); | 4055 bool is_signed_type = IsElementTypeSigned(elements_kind); |
| 4056 int meaningfull_bits = is_signed_type ? (kBitsPerInt - 1) : kBitsPerInt; | 4056 int meaningfull_bits = is_signed_type ? (kBitsPerInt - 1) : kBitsPerInt; |
| 4057 int32_t min_value = is_signed_type ? 0x80000000 : 0x00000000; | 4057 int32_t min_value = is_signed_type ? 0x80000000 : 0x00000000; |
| (...skipping 533 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4591 __ Jump(ic_slow, RelocInfo::CODE_TARGET); | 4591 __ Jump(ic_slow, RelocInfo::CODE_TARGET); |
| 4592 } | 4592 } |
| 4593 } | 4593 } |
| 4594 | 4594 |
| 4595 | 4595 |
| 4596 #undef __ | 4596 #undef __ |
| 4597 | 4597 |
| 4598 } } // namespace v8::internal | 4598 } } // namespace v8::internal |
| 4599 | 4599 |
| 4600 #endif // V8_TARGET_ARCH_MIPS | 4600 #endif // V8_TARGET_ARCH_MIPS |
| OLD | NEW |