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 3427 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3438 DoubleRegister result = ToDoubleRegister(instr->result()); | 3438 DoubleRegister result = ToDoubleRegister(instr->result()); |
3439 DoubleRegister temp = ToDoubleRegister(instr->temp()); | 3439 DoubleRegister temp = ToDoubleRegister(instr->temp()); |
3440 | 3440 |
3441 DCHECK(!input.is(result)); | 3441 DCHECK(!input.is(result)); |
3442 | 3442 |
3443 // Note that according to ECMA-262 15.8.2.13: | 3443 // Note that according to ECMA-262 15.8.2.13: |
3444 // Math.pow(-Infinity, 0.5) == Infinity | 3444 // Math.pow(-Infinity, 0.5) == Infinity |
3445 // Math.sqrt(-Infinity) == NaN | 3445 // Math.sqrt(-Infinity) == NaN |
3446 Label done; | 3446 Label done; |
3447 __ Move(temp, static_cast<double>(-V8_INFINITY)); | 3447 __ Move(temp, static_cast<double>(-V8_INFINITY)); |
3448 __ BranchF(USE_DELAY_SLOT, &done, NULL, eq, temp, input); | 3448 __ Neg_d(result, temp); |
3449 // Set up Infinity in the delay slot. | 3449 __ BranchF(&done, NULL, eq, temp, input); |
3450 // result is overwritten if the branch is not taken. | |
3451 __ neg_d(result, temp); | |
3452 | 3450 |
3453 // Add +0 to convert -0 to +0. | 3451 // Add +0 to convert -0 to +0. |
3454 __ add_d(result, input, kDoubleRegZero); | 3452 __ add_d(result, input, kDoubleRegZero); |
3455 __ sqrt_d(result, result); | 3453 __ sqrt_d(result, result); |
3456 __ bind(&done); | 3454 __ bind(&done); |
3457 } | 3455 } |
3458 | 3456 |
3459 | 3457 |
3460 void LCodeGen::DoPower(LPower* instr) { | 3458 void LCodeGen::DoPower(LPower* instr) { |
3461 Representation exponent_type = instr->hydrogen()->right()->representation(); | 3459 Representation exponent_type = instr->hydrogen()->right()->representation(); |
(...skipping 2077 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5539 __ lw(result, FieldMemOperand(scratch, | 5537 __ lw(result, FieldMemOperand(scratch, |
5540 FixedArray::kHeaderSize - kPointerSize)); | 5538 FixedArray::kHeaderSize - kPointerSize)); |
5541 __ bind(deferred->exit()); | 5539 __ bind(deferred->exit()); |
5542 __ bind(&done); | 5540 __ bind(&done); |
5543 } | 5541 } |
5544 | 5542 |
5545 #undef __ | 5543 #undef __ |
5546 | 5544 |
5547 } // namespace internal | 5545 } // namespace internal |
5548 } // namespace v8 | 5546 } // namespace v8 |
OLD | NEW |