| 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 740 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 751 // Alternate (inline) version for better readability with USE_DELAY_SLOT. | 751 // Alternate (inline) version for better readability with USE_DELAY_SLOT. |
| 752 inline void BranchF(BranchDelaySlot bd, | 752 inline void BranchF(BranchDelaySlot bd, |
| 753 Label* target, | 753 Label* target, |
| 754 Label* nan, | 754 Label* nan, |
| 755 Condition cc, | 755 Condition cc, |
| 756 FPURegister cmp1, | 756 FPURegister cmp1, |
| 757 FPURegister cmp2) { | 757 FPURegister cmp2) { |
| 758 BranchF(target, nan, cc, cmp1, cmp2, bd); | 758 BranchF(target, nan, cc, cmp1, cmp2, bd); |
| 759 }; | 759 }; |
| 760 | 760 |
| 761 // Convert the HeapNumber pointed to by source to a 32bits signed integer | |
| 762 // dest. If the HeapNumber does not fit into a 32bits signed integer branch | |
| 763 // to not_int32 label. If FPU is available double_scratch is used but not | |
| 764 // scratch2. | |
| 765 void ConvertToInt32(Register source, | |
| 766 Register dest, | |
| 767 Register scratch, | |
| 768 Register scratch2, | |
| 769 FPURegister double_scratch, | |
| 770 Label *not_int32); | |
| 771 | |
| 772 // Truncates a double using a specific rounding mode, and writes the value | 761 // Truncates a double using a specific rounding mode, and writes the value |
| 773 // to the result register. | 762 // to the result register. |
| 774 // The except_flag will contain any exceptions caused by the instruction. | 763 // The except_flag will contain any exceptions caused by the instruction. |
| 775 // If check_inexact is kDontCheckForInexactConversion, then the inexact | 764 // If check_inexact is kDontCheckForInexactConversion, then the inexact |
| 776 // exception is masked. | 765 // exception is masked. |
| 777 void EmitFPUTruncate(FPURoundingMode rounding_mode, | 766 void EmitFPUTruncate(FPURoundingMode rounding_mode, |
| 778 Register result, | 767 Register result, |
| 779 DoubleRegister double_input, | 768 DoubleRegister double_input, |
| 780 Register scratch, | 769 Register scratch, |
| 781 DoubleRegister double_scratch, | 770 DoubleRegister double_scratch, |
| 782 Register except_flag, | 771 Register except_flag, |
| 783 CheckForInexactConversion check_inexact | 772 CheckForInexactConversion check_inexact |
| 784 = kDontCheckForInexactConversion); | 773 = kDontCheckForInexactConversion); |
| 785 | 774 |
| 786 // Helper for EmitECMATruncate. | |
| 787 // This will truncate a floating-point value outside of the singed 32bit | |
| 788 // integer range to a 32bit signed integer. | |
| 789 // Expects the double value loaded in input_high and input_low. | |
| 790 // Exits with the answer in 'result'. | |
| 791 // Note that this code does not work for values in the 32bit range! | |
| 792 void EmitOutOfInt32RangeTruncate(Register result, | |
| 793 Register input_high, | |
| 794 Register input_low, | |
| 795 Register scratch); | |
| 796 | |
| 797 // Performs a truncating conversion of a floating point number as used by | 775 // Performs a truncating conversion of a floating point number as used by |
| 798 // the JS bitwise operations. See ECMA-262 9.5: ToInt32. Goes to 'done' if it | 776 // the JS bitwise operations. See ECMA-262 9.5: ToInt32. Goes to 'done' if it |
| 799 // succeeds, otherwise falls through if result is saturated. On return | 777 // succeeds, otherwise falls through if result is saturated. On return |
| 800 // 'result' either holds answer, or is clobbered on fall through. | 778 // 'result' either holds answer, or is clobbered on fall through. |
| 801 // | 779 // |
| 802 // Only public for the test code in test-code-stubs-arm.cc. | 780 // Only public for the test code in test-code-stubs-arm.cc. |
| 803 void TryInlineTruncateDoubleToI(Register result, | 781 void TryInlineTruncateDoubleToI(Register result, |
| 804 DoubleRegister input, | 782 DoubleRegister input, |
| 805 Label* done); | 783 Label* done); |
| 806 | 784 |
| 807 // Performs a truncating conversion of a floating point number as used by | 785 // Performs a truncating conversion of a floating point number as used by |
| 808 // the JS bitwise operations. See ECMA-262 9.5: ToInt32. | 786 // the JS bitwise operations. See ECMA-262 9.5: ToInt32. |
| 809 // Exits with 'result' holding the answer. | 787 // Exits with 'result' holding the answer. |
| 810 void TruncateDoubleToI(Register result, DoubleRegister double_input); | 788 void TruncateDoubleToI(Register result, DoubleRegister double_input); |
| 811 | 789 |
| 812 // Performs a truncating conversion of a heap number as used by | 790 // Performs a truncating conversion of a heap number as used by |
| 813 // the JS bitwise operations. See ECMA-262 9.5: ToInt32. 'result' and 'input' | 791 // the JS bitwise operations. See ECMA-262 9.5: ToInt32. 'result' and 'input' |
| 814 // must be different registers. Exits with 'result' holding the answer. | 792 // must be different registers. Exits with 'result' holding the answer. |
| 815 void TruncateHeapNumberToI(Register result, Register object); | 793 void TruncateHeapNumberToI(Register result, Register object); |
| 816 | 794 |
| 817 // Converts the smi or heap number in object to an int32 using the rules | 795 // Converts the smi or heap number in object to an int32 using the rules |
| 818 // for ToInt32 as described in ECMAScript 9.5.: the value is truncated | 796 // for ToInt32 as described in ECMAScript 9.5.: the value is truncated |
| 819 // and brought into the range -2^31 .. +2^31 - 1. 'result' and 'input' must be | 797 // and brought into the range -2^31 .. +2^31 - 1. 'result' and 'input' must be |
| 820 // different registers. | 798 // different registers. |
| 821 void TruncateNumberToI(Register object, | 799 void TruncateNumberToI(Register object, |
| 822 Register result, | 800 Register result, |
| 823 Register heap_number_map, | 801 Register heap_number_map, |
| 824 Register scratch1, | 802 Register scratch, |
| 825 Register scratch2, | |
| 826 Register scratch3, | |
| 827 Label* not_int32); | 803 Label* not_int32); |
| 828 | 804 |
| 829 // Loads the number from object into dst register. | 805 // Loads the number from object into dst register. |
| 830 // If |object| is neither smi nor heap number, |not_number| is jumped to | 806 // If |object| is neither smi nor heap number, |not_number| is jumped to |
| 831 // with |object| still intact. | 807 // with |object| still intact. |
| 832 void LoadNumber(Register object, | 808 void LoadNumber(Register object, |
| 833 FPURegister dst, | 809 FPURegister dst, |
| 834 Register heap_number_map, | 810 Register heap_number_map, |
| 835 Register scratch, | 811 Register scratch, |
| 836 Label* not_number); | 812 Label* not_number); |
| (...skipping 802 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1639 #define CODE_COVERAGE_TOSTRING(x) CODE_COVERAGE_STRINGIFY(x) | 1615 #define CODE_COVERAGE_TOSTRING(x) CODE_COVERAGE_STRINGIFY(x) |
| 1640 #define __FILE_LINE__ __FILE__ ":" CODE_COVERAGE_TOSTRING(__LINE__) | 1616 #define __FILE_LINE__ __FILE__ ":" CODE_COVERAGE_TOSTRING(__LINE__) |
| 1641 #define ACCESS_MASM(masm) masm->stop(__FILE_LINE__); masm-> | 1617 #define ACCESS_MASM(masm) masm->stop(__FILE_LINE__); masm-> |
| 1642 #else | 1618 #else |
| 1643 #define ACCESS_MASM(masm) masm-> | 1619 #define ACCESS_MASM(masm) masm-> |
| 1644 #endif | 1620 #endif |
| 1645 | 1621 |
| 1646 } } // namespace v8::internal | 1622 } } // namespace v8::internal |
| 1647 | 1623 |
| 1648 #endif // V8_MIPS_MACRO_ASSEMBLER_MIPS_H_ | 1624 #endif // V8_MIPS_MACRO_ASSEMBLER_MIPS_H_ |
| OLD | NEW |