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 665 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
676 // Load double input. | 676 // Load double input. |
677 __ ldc1(double_scratch, MemOperand(input_reg, double_offset)); | 677 __ ldc1(double_scratch, MemOperand(input_reg, double_offset)); |
678 | 678 |
679 // Clear cumulative exception flags and save the FCSR. | 679 // Clear cumulative exception flags and save the FCSR. |
680 __ cfc1(scratch2, FCSR); | 680 __ cfc1(scratch2, FCSR); |
681 __ ctc1(zero_reg, FCSR); | 681 __ ctc1(zero_reg, FCSR); |
682 | 682 |
683 // Try a conversion to a signed integer. | 683 // Try a conversion to a signed integer. |
684 __ Trunc_w_d(double_scratch, double_scratch); | 684 __ Trunc_w_d(double_scratch, double_scratch); |
685 // Move the converted value into the result register. | 685 // Move the converted value into the result register. |
686 __ mfc1(result_reg, double_scratch); | 686 __ mfc1(scratch3, double_scratch); |
687 | 687 |
688 // Retrieve and restore the FCSR. | 688 // Retrieve and restore the FCSR. |
689 __ cfc1(scratch, FCSR); | 689 __ cfc1(scratch, FCSR); |
690 __ ctc1(scratch2, FCSR); | 690 __ ctc1(scratch2, FCSR); |
691 | 691 |
692 // Check for overflow and NaNs. | 692 // Check for overflow and NaNs. |
693 __ And( | 693 __ And( |
694 scratch, scratch, | 694 scratch, scratch, |
695 kFCSROverflowFlagMask | kFCSRUnderflowFlagMask | 695 kFCSROverflowFlagMask | kFCSRUnderflowFlagMask |
696 | kFCSRInvalidOpFlagMask); | 696 | kFCSRInvalidOpFlagMask); |
697 // If we had no exceptions we are done. | 697 // If we had no exceptions then set result_reg and we are done. |
698 __ Branch(&done, eq, scratch, Operand(zero_reg)); | 698 Label error; |
| 699 __ Branch(&error, ne, scratch, Operand(zero_reg)); |
| 700 __ Move(result_reg, scratch3); |
| 701 __ Branch(&done); |
| 702 __ bind(&error); |
699 } | 703 } |
700 | 704 |
701 // Load the double value and perform a manual truncation. | 705 // Load the double value and perform a manual truncation. |
702 Register input_high = scratch2; | 706 Register input_high = scratch2; |
703 Register input_low = scratch3; | 707 Register input_low = scratch3; |
704 | 708 |
705 __ lw(input_low, MemOperand(input_reg, double_offset)); | 709 __ lw(input_low, MemOperand(input_reg, double_offset)); |
706 __ lw(input_high, MemOperand(input_reg, double_offset + kIntSize)); | 710 __ lw(input_high, MemOperand(input_reg, double_offset + kIntSize)); |
707 | 711 |
708 Label normal_exponent, restore_sign; | 712 Label normal_exponent, restore_sign; |
(...skipping 5509 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6218 __ bind(&fast_elements_case); | 6222 __ bind(&fast_elements_case); |
6219 GenerateCase(masm, FAST_ELEMENTS); | 6223 GenerateCase(masm, FAST_ELEMENTS); |
6220 } | 6224 } |
6221 | 6225 |
6222 | 6226 |
6223 #undef __ | 6227 #undef __ |
6224 | 6228 |
6225 } } // namespace v8::internal | 6229 } } // namespace v8::internal |
6226 | 6230 |
6227 #endif // V8_TARGET_ARCH_MIPS | 6231 #endif // V8_TARGET_ARCH_MIPS |
OLD | NEW |