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 3112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3123 } | 3123 } |
3124 | 3124 |
3125 // Calculate power with integer exponent. | 3125 // Calculate power with integer exponent. |
3126 __ bind(&int_exponent); | 3126 __ bind(&int_exponent); |
3127 const XMMRegister double_scratch2 = double_exponent; | 3127 const XMMRegister double_scratch2 = double_exponent; |
3128 __ mov(scratch, exponent); // Back up exponent. | 3128 __ mov(scratch, exponent); // Back up exponent. |
3129 __ movsd(double_scratch, double_base); // Back up base. | 3129 __ movsd(double_scratch, double_base); // Back up base. |
3130 __ movsd(double_scratch2, double_result); // Load double_exponent with 1. | 3130 __ movsd(double_scratch2, double_result); // Load double_exponent with 1. |
3131 | 3131 |
3132 // Get absolute value of exponent. | 3132 // Get absolute value of exponent. |
3133 Label no_neg, while_true, no_multiply; | 3133 Label while_true, no_multiply; |
3134 __ cmp(exponent, 0); | 3134 const uint32_t kClearSignBitMask = 0x7FFFFFFF; |
3135 __ j(greater_equal, &no_neg, Label::kNear); | 3135 __ and_(exponent, Immediate(kClearSignBitMask)); |
3136 __ neg(exponent); | |
3137 __ bind(&no_neg); | |
3138 | 3136 |
3139 __ bind(&while_true); | 3137 __ bind(&while_true); |
3140 __ shr(exponent, 1); | 3138 __ shr(exponent, 1); |
3141 __ j(not_carry, &no_multiply, Label::kNear); | 3139 __ j(not_carry, &no_multiply, Label::kNear); |
3142 __ mulsd(double_result, double_base); | 3140 __ mulsd(double_result, double_base); |
3143 __ bind(&no_multiply); | 3141 __ bind(&no_multiply); |
3144 | 3142 |
3145 __ mulsd(double_base, double_base); | 3143 __ mulsd(double_base, double_base); |
3146 __ j(not_zero, &while_true); | 3144 __ j(not_zero, &while_true); |
3147 | 3145 |
(...skipping 4136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7284 false); | 7282 false); |
7285 __ pop(edx); | 7283 __ pop(edx); |
7286 __ ret(0); | 7284 __ ret(0); |
7287 } | 7285 } |
7288 | 7286 |
7289 #undef __ | 7287 #undef __ |
7290 | 7288 |
7291 } } // namespace v8::internal | 7289 } } // namespace v8::internal |
7292 | 7290 |
7293 #endif // V8_TARGET_ARCH_IA32 | 7291 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |