OLD | NEW |
1 // Copyright 2010 the V8 project authors. All rights reserved. | 1 // Copyright 2010 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 8274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8285 // Both fsin and fcos require arguments in the range +/-2^63 and | 8285 // Both fsin and fcos require arguments in the range +/-2^63 and |
8286 // return NaN for infinities and NaN. They can share all code except | 8286 // return NaN for infinities and NaN. They can share all code except |
8287 // the actual fsin/fcos operation. | 8287 // the actual fsin/fcos operation. |
8288 Label in_range; | 8288 Label in_range; |
8289 // If argument is outside the range -2^63..2^63, fsin/cos doesn't | 8289 // If argument is outside the range -2^63..2^63, fsin/cos doesn't |
8290 // work. We must reduce it to the appropriate range. | 8290 // work. We must reduce it to the appropriate range. |
8291 __ movq(rdi, rbx); | 8291 __ movq(rdi, rbx); |
8292 // Move exponent and sign bits to low bits. | 8292 // Move exponent and sign bits to low bits. |
8293 __ shr(rdi, Immediate(HeapNumber::kMantissaBits)); | 8293 __ shr(rdi, Immediate(HeapNumber::kMantissaBits)); |
8294 // Remove sign bit. | 8294 // Remove sign bit. |
8295 __ andl(rdi, Immediate((1 << HeapNumber::KExponentBits) - 1)); | 8295 __ andl(rdi, Immediate((1 << HeapNumber::kExponentBits) - 1)); |
8296 int supported_exponent_limit = (63 + HeapNumber::kExponentBias); | 8296 int supported_exponent_limit = (63 + HeapNumber::kExponentBias); |
8297 __ cmpl(rdi, Immediate(supported_exponent_limit)); | 8297 __ cmpl(rdi, Immediate(supported_exponent_limit)); |
8298 __ j(below, &in_range); | 8298 __ j(below, &in_range); |
8299 // Check for infinity and NaN. Both return NaN for sin. | 8299 // Check for infinity and NaN. Both return NaN for sin. |
8300 __ cmpl(rdi, Immediate(0x7ff)); | 8300 __ cmpl(rdi, Immediate(0x7ff)); |
8301 __ j(equal, on_nan_result); | 8301 __ j(equal, on_nan_result); |
8302 | 8302 |
8303 // Use fpmod to restrict argument to the range +/-2*PI. | 8303 // Use fpmod to restrict argument to the range +/-2*PI. |
8304 __ fldpi(); | 8304 __ fldpi(); |
8305 __ fadd(0); | 8305 __ fadd(0); |
(...skipping 3638 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
11944 } | 11944 } |
11945 | 11945 |
11946 #endif | 11946 #endif |
11947 | 11947 |
11948 | 11948 |
11949 #undef __ | 11949 #undef __ |
11950 | 11950 |
11951 } } // namespace v8::internal | 11951 } } // namespace v8::internal |
11952 | 11952 |
11953 #endif // V8_TARGET_ARCH_X64 | 11953 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |