| OLD | NEW |
| 1 // Copyright (c) 1994-2006 Sun Microsystems Inc. | 1 // Copyright (c) 1994-2006 Sun Microsystems Inc. |
| 2 // All Rights Reserved. | 2 // All Rights Reserved. |
| 3 // | 3 // |
| 4 // Redistribution and use in source and binary forms, with or without | 4 // Redistribution and use in source and binary forms, with or without |
| 5 // modification, are permitted provided that the following conditions are | 5 // modification, are permitted provided that the following conditions are |
| 6 // met: | 6 // met: |
| 7 // | 7 // |
| 8 // - Redistributions of source code must retain the above copyright notice, | 8 // - Redistributions of source code must retain the above copyright notice, |
| 9 // this list of conditions and the following disclaimer. | 9 // this list of conditions and the following disclaimer. |
| 10 // | 10 // |
| (...skipping 590 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 601 static double sub_two_doubles(double x, double y) { | 601 static double sub_two_doubles(double x, double y) { |
| 602 return x - y; | 602 return x - y; |
| 603 } | 603 } |
| 604 | 604 |
| 605 | 605 |
| 606 static double mul_two_doubles(double x, double y) { | 606 static double mul_two_doubles(double x, double y) { |
| 607 return x * y; | 607 return x * y; |
| 608 } | 608 } |
| 609 | 609 |
| 610 | 610 |
| 611 static double div_two_doubles(double x, double y) { |
| 612 return x / y; |
| 613 } |
| 614 |
| 615 |
| 616 static double mod_two_doubles(double x, double y) { |
| 617 return fmod(x, y); |
| 618 } |
| 619 |
| 620 |
| 611 static int native_compare_doubles(double x, double y) { | 621 static int native_compare_doubles(double x, double y) { |
| 612 if (x == y) return 0; | 622 if (x == y) return 0; |
| 613 return x < y ? 1 : -1; | 623 return x < y ? 1 : -1; |
| 614 } | 624 } |
| 615 | 625 |
| 616 | 626 |
| 617 ExternalReference ExternalReference::double_fp_operation( | 627 ExternalReference ExternalReference::double_fp_operation( |
| 618 Token::Value operation) { | 628 Token::Value operation) { |
| 619 typedef double BinaryFPOperation(double x, double y); | 629 typedef double BinaryFPOperation(double x, double y); |
| 620 BinaryFPOperation* function = NULL; | 630 BinaryFPOperation* function = NULL; |
| 621 switch (operation) { | 631 switch (operation) { |
| 622 case Token::ADD: | 632 case Token::ADD: |
| 623 function = &add_two_doubles; | 633 function = &add_two_doubles; |
| 624 break; | 634 break; |
| 625 case Token::SUB: | 635 case Token::SUB: |
| 626 function = &sub_two_doubles; | 636 function = &sub_two_doubles; |
| 627 break; | 637 break; |
| 628 case Token::MUL: | 638 case Token::MUL: |
| 629 function = &mul_two_doubles; | 639 function = &mul_two_doubles; |
| 630 break; | 640 break; |
| 641 case Token::DIV: |
| 642 function = &div_two_doubles; |
| 643 break; |
| 644 case Token::MOD: |
| 645 function = &mod_two_doubles; |
| 646 break; |
| 631 default: | 647 default: |
| 632 UNREACHABLE(); | 648 UNREACHABLE(); |
| 633 } | 649 } |
| 634 // Passing true as 2nd parameter indicates that they return an fp value. | 650 // Passing true as 2nd parameter indicates that they return an fp value. |
| 635 return ExternalReference(Redirect(FUNCTION_ADDR(function), true)); | 651 return ExternalReference(Redirect(FUNCTION_ADDR(function), true)); |
| 636 } | 652 } |
| 637 | 653 |
| 638 | 654 |
| 639 ExternalReference ExternalReference::compare_doubles() { | 655 ExternalReference ExternalReference::compare_doubles() { |
| 640 return ExternalReference(Redirect(FUNCTION_ADDR(native_compare_doubles), | 656 return ExternalReference(Redirect(FUNCTION_ADDR(native_compare_doubles), |
| 641 false)); | 657 false)); |
| 642 } | 658 } |
| 643 | 659 |
| 644 | 660 |
| 645 ExternalReferenceRedirector* ExternalReference::redirector_ = NULL; | 661 ExternalReferenceRedirector* ExternalReference::redirector_ = NULL; |
| 646 | 662 |
| 647 | 663 |
| 648 #ifdef ENABLE_DEBUGGER_SUPPORT | 664 #ifdef ENABLE_DEBUGGER_SUPPORT |
| 649 ExternalReference ExternalReference::debug_break() { | 665 ExternalReference ExternalReference::debug_break() { |
| 650 return ExternalReference(Redirect(FUNCTION_ADDR(Debug::Break))); | 666 return ExternalReference(Redirect(FUNCTION_ADDR(Debug::Break))); |
| 651 } | 667 } |
| 652 | 668 |
| 653 | 669 |
| 654 ExternalReference ExternalReference::debug_step_in_fp_address() { | 670 ExternalReference ExternalReference::debug_step_in_fp_address() { |
| 655 return ExternalReference(Debug::step_in_fp_addr()); | 671 return ExternalReference(Debug::step_in_fp_addr()); |
| 656 } | 672 } |
| 657 #endif | 673 #endif |
| 658 | 674 |
| 659 } } // namespace v8::internal | 675 } } // namespace v8::internal |
| OLD | NEW |