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 2163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2174 | 2174 |
2175 // Calculate power with integer exponent. | 2175 // Calculate power with integer exponent. |
2176 __ bind(&int_exponent); | 2176 __ bind(&int_exponent); |
2177 const XMMRegister double_scratch2 = double_exponent; | 2177 const XMMRegister double_scratch2 = double_exponent; |
2178 // Back up exponent as we need to check if exponent is negative later. | 2178 // Back up exponent as we need to check if exponent is negative later. |
2179 __ movq(scratch, exponent); // Back up exponent. | 2179 __ movq(scratch, exponent); // Back up exponent. |
2180 __ movsd(double_scratch, double_base); // Back up base. | 2180 __ movsd(double_scratch, double_base); // Back up base. |
2181 __ movsd(double_scratch2, double_result); // Load double_exponent with 1. | 2181 __ movsd(double_scratch2, double_result); // Load double_exponent with 1. |
2182 | 2182 |
2183 // Get absolute value of exponent. | 2183 // Get absolute value of exponent. |
2184 Label no_neg, while_true, no_multiply; | 2184 Label while_true, no_multiply; |
2185 __ cmpl(scratch, Immediate(0)); | 2185 const uint32_t kClearSignBitMask = 0x7FFFFFFF; |
2186 __ j(positive, &no_neg, Label::kNear); | 2186 __ andl(scratch, Immediate(kClearSignBitMask)); |
2187 __ negl(scratch); | |
2188 __ bind(&no_neg); | |
2189 | 2187 |
2190 __ bind(&while_true); | 2188 __ bind(&while_true); |
2191 __ shrl(scratch, Immediate(1)); | 2189 __ shrl(scratch, Immediate(1)); |
2192 __ j(not_carry, &no_multiply, Label::kNear); | 2190 __ j(not_carry, &no_multiply, Label::kNear); |
2193 __ mulsd(double_result, double_scratch); | 2191 __ mulsd(double_result, double_scratch); |
2194 __ bind(&no_multiply); | 2192 __ bind(&no_multiply); |
2195 | 2193 |
2196 __ mulsd(double_scratch, double_scratch); | 2194 __ mulsd(double_scratch, double_scratch); |
2197 __ j(not_zero, &while_true); | 2195 __ j(not_zero, &while_true); |
2198 | 2196 |
(...skipping 4016 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6215 xmm0, | 6213 xmm0, |
6216 &slow_elements); | 6214 &slow_elements); |
6217 __ ret(0); | 6215 __ ret(0); |
6218 } | 6216 } |
6219 | 6217 |
6220 #undef __ | 6218 #undef __ |
6221 | 6219 |
6222 } } // namespace v8::internal | 6220 } } // namespace v8::internal |
6223 | 6221 |
6224 #endif // V8_TARGET_ARCH_X64 | 6222 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |