OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved.7 | 1 // Copyright 2012 the V8 project authors. All rights reserved.7 |
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 3424 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3435 DoubleRegister result = ToDoubleRegister(instr->result()); | 3435 DoubleRegister result = ToDoubleRegister(instr->result()); |
3436 DoubleRegister temp = ToDoubleRegister(instr->temp()); | 3436 DoubleRegister temp = ToDoubleRegister(instr->temp()); |
3437 | 3437 |
3438 DCHECK(!input.is(result)); | 3438 DCHECK(!input.is(result)); |
3439 | 3439 |
3440 // Note that according to ECMA-262 15.8.2.13: | 3440 // Note that according to ECMA-262 15.8.2.13: |
3441 // Math.pow(-Infinity, 0.5) == Infinity | 3441 // Math.pow(-Infinity, 0.5) == Infinity |
3442 // Math.sqrt(-Infinity) == NaN | 3442 // Math.sqrt(-Infinity) == NaN |
3443 Label done; | 3443 Label done; |
3444 __ Move(temp, static_cast<double>(-V8_INFINITY)); | 3444 __ Move(temp, static_cast<double>(-V8_INFINITY)); |
| 3445 // Set up Infinity. |
3445 __ Neg_d(result, temp); | 3446 __ Neg_d(result, temp); |
| 3447 // result is overwritten if the branch is not taken. |
3446 __ BranchF(&done, NULL, eq, temp, input); | 3448 __ BranchF(&done, NULL, eq, temp, input); |
3447 | 3449 |
3448 // Add +0 to convert -0 to +0. | 3450 // Add +0 to convert -0 to +0. |
3449 __ add_d(result, input, kDoubleRegZero); | 3451 __ add_d(result, input, kDoubleRegZero); |
3450 __ sqrt_d(result, result); | 3452 __ sqrt_d(result, result); |
3451 __ bind(&done); | 3453 __ bind(&done); |
3452 } | 3454 } |
3453 | 3455 |
3454 | 3456 |
3455 void LCodeGen::DoPower(LPower* instr) { | 3457 void LCodeGen::DoPower(LPower* instr) { |
(...skipping 2078 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5534 __ lw(result, FieldMemOperand(scratch, | 5536 __ lw(result, FieldMemOperand(scratch, |
5535 FixedArray::kHeaderSize - kPointerSize)); | 5537 FixedArray::kHeaderSize - kPointerSize)); |
5536 __ bind(deferred->exit()); | 5538 __ bind(deferred->exit()); |
5537 __ bind(&done); | 5539 __ bind(&done); |
5538 } | 5540 } |
5539 | 5541 |
5540 #undef __ | 5542 #undef __ |
5541 | 5543 |
5542 } // namespace internal | 5544 } // namespace internal |
5543 } // namespace v8 | 5545 } // namespace v8 |
OLD | NEW |