| 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 #if V8_TARGET_ARCH_MIPS | 7 #if V8_TARGET_ARCH_MIPS |
| 8 | 8 |
| 9 #include "src/base/bits.h" | 9 #include "src/base/bits.h" |
| 10 #include "src/base/division-by-constant.h" | 10 #include "src/base/division-by-constant.h" |
| 11 #include "src/bootstrapper.h" | 11 #include "src/bootstrapper.h" |
| 12 #include "src/codegen.h" | 12 #include "src/codegen.h" |
| 13 #include "src/debug/debug.h" | 13 #include "src/debug/debug.h" |
| 14 #include "src/mips/macro-assembler-mips.h" | 14 #include "src/mips/macro-assembler-mips.h" |
| 15 #include "src/register-configuration.h" | 15 #include "src/register-configuration.h" |
| 16 #include "src/runtime/runtime.h" | 16 #include "src/runtime/runtime.h" |
| 17 | 17 |
| 18 namespace v8 { | 18 namespace v8 { |
| 19 namespace internal { | 19 namespace internal { |
| 20 | 20 |
| 21 // Floating point constants. | |
| 22 const uint32_t kDoubleSignMask = HeapNumber::kSignMask; | |
| 23 const uint32_t kDoubleExponentShift = HeapNumber::kExponentShift; | |
| 24 const uint32_t kDoubleNaNShift = kDoubleExponentShift - 1; | |
| 25 const uint32_t kDoubleNaNMask = | |
| 26 HeapNumber::kExponentMask | (1 << kDoubleNaNShift); | |
| 27 | |
| 28 const uint32_t kSingleSignMask = kBinary32SignMask; | |
| 29 const uint32_t kSingleExponentMask = kBinary32ExponentMask; | |
| 30 const uint32_t kSingleExponentShift = kBinary32ExponentShift; | |
| 31 const uint32_t kSingleNaNShift = kSingleExponentShift - 1; | |
| 32 const uint32_t kSingleNaNMask = kSingleExponentMask | (1 << kSingleNaNShift); | |
| 33 | |
| 34 MacroAssembler::MacroAssembler(Isolate* arg_isolate, void* buffer, int size, | 21 MacroAssembler::MacroAssembler(Isolate* arg_isolate, void* buffer, int size, |
| 35 CodeObjectRequired create_code_object) | 22 CodeObjectRequired create_code_object) |
| 36 : Assembler(arg_isolate, buffer, size), | 23 : Assembler(arg_isolate, buffer, size), |
| 37 generating_stub_(false), | 24 generating_stub_(false), |
| 38 has_frame_(false), | 25 has_frame_(false), |
| 39 has_double_zero_reg_set_(false) { | 26 has_double_zero_reg_set_(false) { |
| 40 if (create_code_object == CodeObjectRequired::kYes) { | 27 if (create_code_object == CodeObjectRequired::kYes) { |
| 41 code_object_ = | 28 code_object_ = |
| 42 Handle<Object>::New(isolate()->heap()->undefined_value(), isolate()); | 29 Handle<Object>::New(isolate()->heap()->undefined_value(), isolate()); |
| 43 } | 30 } |
| (...skipping 4706 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4750 | 4737 |
| 4751 bind(&done); | 4738 bind(&done); |
| 4752 Addu(scratch1, elements_reg, | 4739 Addu(scratch1, elements_reg, |
| 4753 Operand(FixedDoubleArray::kHeaderSize - kHeapObjectTag - | 4740 Operand(FixedDoubleArray::kHeaderSize - kHeapObjectTag - |
| 4754 elements_offset)); | 4741 elements_offset)); |
| 4755 Lsa(scratch1, scratch1, key_reg, kDoubleSizeLog2 - kSmiTagSize); | 4742 Lsa(scratch1, scratch1, key_reg, kDoubleSizeLog2 - kSmiTagSize); |
| 4756 // scratch1 is now effective address of the double element | 4743 // scratch1 is now effective address of the double element |
| 4757 sdc1(double_result, MemOperand(scratch1, 0)); | 4744 sdc1(double_result, MemOperand(scratch1, 0)); |
| 4758 } | 4745 } |
| 4759 | 4746 |
| 4760 void MacroAssembler::SubNanPreservePayloadAndSign_s(FloatRegister fd, | |
| 4761 FloatRegister fs, | |
| 4762 FloatRegister ft) { | |
| 4763 FloatRegister dest = fd.is(fs) || fd.is(ft) ? kLithiumScratchDouble : fd; | |
| 4764 Label check_nan, save_payload, done; | |
| 4765 Register scratch1 = t8; | |
| 4766 Register scratch2 = t9; | |
| 4767 | |
| 4768 sub_s(dest, fs, ft); | |
| 4769 // Check if the result of subtraction is NaN. | |
| 4770 BranchF32(nullptr, &check_nan, eq, fs, ft); | |
| 4771 Branch(USE_DELAY_SLOT, &done); | |
| 4772 dest.is(fd) ? nop() : mov_s(fd, dest); | |
| 4773 | |
| 4774 bind(&check_nan); | |
| 4775 // Check if first operand is a NaN. | |
| 4776 mfc1(scratch1, fs); | |
| 4777 BranchF32(nullptr, &save_payload, eq, fs, fs); | |
| 4778 // Second operand must be a NaN. | |
| 4779 mfc1(scratch1, ft); | |
| 4780 | |
| 4781 bind(&save_payload); | |
| 4782 // Reserve payload. | |
| 4783 And(scratch1, scratch1, | |
| 4784 Operand(kSingleSignMask | ((1 << kSingleNaNShift) - 1))); | |
| 4785 mfc1(scratch2, dest); | |
| 4786 And(scratch2, scratch2, Operand(kSingleNaNMask)); | |
| 4787 Or(scratch2, scratch2, scratch1); | |
| 4788 mtc1(scratch2, fd); | |
| 4789 | |
| 4790 bind(&done); | |
| 4791 } | |
| 4792 | |
| 4793 void MacroAssembler::SubNanPreservePayloadAndSign_d(DoubleRegister fd, | |
| 4794 DoubleRegister fs, | |
| 4795 DoubleRegister ft) { | |
| 4796 FloatRegister dest = fd.is(fs) || fd.is(ft) ? kLithiumScratchDouble : fd; | |
| 4797 Label check_nan, save_payload, done; | |
| 4798 Register scratch1 = t8; | |
| 4799 Register scratch2 = t9; | |
| 4800 | |
| 4801 sub_d(dest, fs, ft); | |
| 4802 // Check if the result of subtraction is NaN. | |
| 4803 BranchF64(nullptr, &check_nan, eq, fs, ft); | |
| 4804 Branch(USE_DELAY_SLOT, &done); | |
| 4805 dest.is(fd) ? nop() : mov_d(fd, dest); | |
| 4806 | |
| 4807 bind(&check_nan); | |
| 4808 // Check if first operand is a NaN. | |
| 4809 Mfhc1(scratch1, fs); | |
| 4810 mov_s(dest, fs); | |
| 4811 BranchF64(nullptr, &save_payload, eq, fs, fs); | |
| 4812 // Second operand must be a NaN. | |
| 4813 Mfhc1(scratch1, ft); | |
| 4814 mov_s(dest, ft); | |
| 4815 | |
| 4816 bind(&save_payload); | |
| 4817 // Reserve payload. | |
| 4818 And(scratch1, scratch1, | |
| 4819 Operand(kDoubleSignMask | ((1 << kDoubleNaNShift) - 1))); | |
| 4820 Mfhc1(scratch2, dest); | |
| 4821 And(scratch2, scratch2, Operand(kDoubleNaNMask)); | |
| 4822 Or(scratch2, scratch2, scratch1); | |
| 4823 Move_s(fd, dest); | |
| 4824 Mthc1(scratch2, fd); | |
| 4825 | |
| 4826 bind(&done); | |
| 4827 } | |
| 4828 | |
| 4829 void MacroAssembler::CompareMapAndBranch(Register obj, | 4747 void MacroAssembler::CompareMapAndBranch(Register obj, |
| 4830 Register scratch, | 4748 Register scratch, |
| 4831 Handle<Map> map, | 4749 Handle<Map> map, |
| 4832 Label* early_success, | 4750 Label* early_success, |
| 4833 Condition cond, | 4751 Condition cond, |
| 4834 Label* branch_to) { | 4752 Label* branch_to) { |
| 4835 lw(scratch, FieldMemOperand(obj, HeapObject::kMapOffset)); | 4753 lw(scratch, FieldMemOperand(obj, HeapObject::kMapOffset)); |
| 4836 CompareMapAndBranch(scratch, map, early_success, cond, branch_to); | 4754 CompareMapAndBranch(scratch, map, early_success, cond, branch_to); |
| 4837 } | 4755 } |
| 4838 | 4756 |
| (...skipping 2152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6991 if (mag.shift > 0) sra(result, result, mag.shift); | 6909 if (mag.shift > 0) sra(result, result, mag.shift); |
| 6992 srl(at, dividend, 31); | 6910 srl(at, dividend, 31); |
| 6993 Addu(result, result, Operand(at)); | 6911 Addu(result, result, Operand(at)); |
| 6994 } | 6912 } |
| 6995 | 6913 |
| 6996 | 6914 |
| 6997 } // namespace internal | 6915 } // namespace internal |
| 6998 } // namespace v8 | 6916 } // namespace v8 |
| 6999 | 6917 |
| 7000 #endif // V8_TARGET_ARCH_MIPS | 6918 #endif // V8_TARGET_ARCH_MIPS |
| OLD | NEW |