OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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 501 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
512 ASSERT(ExternalReference::math_exp_constants(0).address() != NULL); | 512 ASSERT(ExternalReference::math_exp_constants(0).address() != NULL); |
513 | 513 |
514 Label done; | 514 Label done; |
515 DoubleRegister double_temp3 = result; | 515 DoubleRegister double_temp3 = result; |
516 Register constants = temp3; | 516 Register constants = temp3; |
517 | 517 |
518 // The algorithm used relies on some magic constants which are initialized in | 518 // The algorithm used relies on some magic constants which are initialized in |
519 // ExternalReference::InitializeMathExpData(). | 519 // ExternalReference::InitializeMathExpData(). |
520 | 520 |
521 // Load the address of the start of the array. | 521 // Load the address of the start of the array. |
522 __ Mov(constants, Operand(ExternalReference::math_exp_constants(0))); | 522 __ Mov(constants, ExternalReference::math_exp_constants(0)); |
523 | 523 |
524 // We have to do a four-way split here: | 524 // We have to do a four-way split here: |
525 // - If input <= about -708.4, the output always rounds to zero. | 525 // - If input <= about -708.4, the output always rounds to zero. |
526 // - If input >= about 709.8, the output always rounds to +infinity. | 526 // - If input >= about 709.8, the output always rounds to +infinity. |
527 // - If the input is NaN, the output is NaN. | 527 // - If the input is NaN, the output is NaN. |
528 // - Otherwise, the result needs to be calculated. | 528 // - Otherwise, the result needs to be calculated. |
529 Label result_is_finite_non_zero; | 529 Label result_is_finite_non_zero; |
530 // Assert that we can load offset 0 (the small input threshold) and offset 1 | 530 // Assert that we can load offset 0 (the small input threshold) and offset 1 |
531 // (the large input threshold) with a single ldp. | 531 // (the large input threshold) with a single ldp. |
532 ASSERT(kDRegSize == (ExpConstant(constants, 1).offset() - | 532 ASSERT(kDRegSize == (ExpConstant(constants, 1).offset() - |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
588 // The 8th constant is 1.0, so use an immediate move rather than a load. | 588 // The 8th constant is 1.0, so use an immediate move rather than a load. |
589 // We can't generate a runtime assertion here as we would need to call Abort | 589 // We can't generate a runtime assertion here as we would need to call Abort |
590 // in the runtime and we don't have an Isolate when we generate this code. | 590 // in the runtime and we don't have an Isolate when we generate this code. |
591 __ Fmov(double_temp2, 1.0); | 591 __ Fmov(double_temp2, 1.0); |
592 __ Fadd(double_temp3, double_temp3, double_temp2); | 592 __ Fadd(double_temp3, double_temp3, double_temp2); |
593 | 593 |
594 __ And(temp2, temp2, 0x7ff); | 594 __ And(temp2, temp2, 0x7ff); |
595 __ Add(temp1, temp1, 0x3ff); | 595 __ Add(temp1, temp1, 0x3ff); |
596 | 596 |
597 // Do the final table lookup. | 597 // Do the final table lookup. |
598 __ Mov(temp3, Operand(ExternalReference::math_exp_log_table())); | 598 __ Mov(temp3, ExternalReference::math_exp_log_table()); |
599 | 599 |
600 __ Add(temp3, temp3, Operand(temp2, LSL, kDRegSizeLog2)); | 600 __ Add(temp3, temp3, Operand(temp2, LSL, kDRegSizeLog2)); |
601 __ Ldp(temp2.W(), temp3.W(), MemOperand(temp3)); | 601 __ Ldp(temp2.W(), temp3.W(), MemOperand(temp3)); |
602 __ Orr(temp1.W(), temp3.W(), Operand(temp1.W(), LSL, 20)); | 602 __ Orr(temp1.W(), temp3.W(), Operand(temp1.W(), LSL, 20)); |
603 __ Bfi(temp2, temp1, 32, 32); | 603 __ Bfi(temp2, temp1, 32, 32); |
604 __ Fmov(double_temp1, temp2); | 604 __ Fmov(double_temp1, temp2); |
605 | 605 |
606 __ Fmul(result, double_temp3, double_temp1); | 606 __ Fmul(result, double_temp3, double_temp1); |
607 | 607 |
608 __ Bind(&done); | 608 __ Bind(&done); |
609 } | 609 } |
610 | 610 |
611 #undef __ | 611 #undef __ |
612 | 612 |
613 } } // namespace v8::internal | 613 } } // namespace v8::internal |
614 | 614 |
615 #endif // V8_TARGET_ARCH_A64 | 615 #endif // V8_TARGET_ARCH_A64 |
OLD | NEW |