OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 2844 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2855 | 2855 |
2856 // Note that according to ECMA-262 15.8.2.13: | 2856 // Note that according to ECMA-262 15.8.2.13: |
2857 // Math.pow(-Infinity, 0.5) == Infinity | 2857 // Math.pow(-Infinity, 0.5) == Infinity |
2858 // Math.sqrt(-Infinity) == NaN | 2858 // Math.sqrt(-Infinity) == NaN |
2859 Label done, sqrt; | 2859 Label done, sqrt; |
2860 // Check base for -Infinity. According to IEEE-754, double-precision | 2860 // Check base for -Infinity. According to IEEE-754, double-precision |
2861 // -Infinity has the highest 12 bits set and the lowest 52 bits cleared. | 2861 // -Infinity has the highest 12 bits set and the lowest 52 bits cleared. |
2862 __ movq(kScratchRegister, V8_INT64_C(0xFFF0000000000000), RelocInfo::NONE); | 2862 __ movq(kScratchRegister, V8_INT64_C(0xFFF0000000000000), RelocInfo::NONE); |
2863 __ movq(xmm_scratch, kScratchRegister); | 2863 __ movq(xmm_scratch, kScratchRegister); |
2864 __ ucomisd(xmm_scratch, input_reg); | 2864 __ ucomisd(xmm_scratch, input_reg); |
| 2865 // Comparing -Infinity with NaN results in "unordered", which sets the |
| 2866 // zero flag as if both were equal. However, it also sets the carry flag. |
2865 __ j(not_equal, &sqrt, Label::kNear); | 2867 __ j(not_equal, &sqrt, Label::kNear); |
| 2868 __ j(carry, &sqrt, Label::kNear); |
2866 // If input is -Infinity, return Infinity. | 2869 // If input is -Infinity, return Infinity. |
2867 __ xorps(input_reg, input_reg); | 2870 __ xorps(input_reg, input_reg); |
2868 __ subsd(input_reg, xmm_scratch); | 2871 __ subsd(input_reg, xmm_scratch); |
2869 __ jmp(&done, Label::kNear); | 2872 __ jmp(&done, Label::kNear); |
2870 | 2873 |
2871 // Square root. | 2874 // Square root. |
2872 __ bind(&sqrt); | 2875 __ bind(&sqrt); |
2873 __ xorps(xmm_scratch, xmm_scratch); | 2876 __ xorps(xmm_scratch, xmm_scratch); |
2874 __ addsd(input_reg, xmm_scratch); // Convert -0 to +0. | 2877 __ addsd(input_reg, xmm_scratch); // Convert -0 to +0. |
2875 __ sqrtsd(input_reg, input_reg); | 2878 __ sqrtsd(input_reg, input_reg); |
(...skipping 1467 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4343 RegisterEnvironmentForDeoptimization(environment, Safepoint::kNoLazyDeopt); | 4346 RegisterEnvironmentForDeoptimization(environment, Safepoint::kNoLazyDeopt); |
4344 ASSERT(osr_pc_offset_ == -1); | 4347 ASSERT(osr_pc_offset_ == -1); |
4345 osr_pc_offset_ = masm()->pc_offset(); | 4348 osr_pc_offset_ = masm()->pc_offset(); |
4346 } | 4349 } |
4347 | 4350 |
4348 #undef __ | 4351 #undef __ |
4349 | 4352 |
4350 } } // namespace v8::internal | 4353 } } // namespace v8::internal |
4351 | 4354 |
4352 #endif // V8_TARGET_ARCH_X64 | 4355 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |