| 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 int native_compare_doubles(double x, double y) { |
| 612 if (x == y) return 0; |
| 613 return x < y ? 1 : -1; |
| 614 } |
| 615 |
| 616 |
| 611 ExternalReference ExternalReference::double_fp_operation( | 617 ExternalReference ExternalReference::double_fp_operation( |
| 612 Token::Value operation) { | 618 Token::Value operation) { |
| 613 typedef double BinaryFPOperation(double x, double y); | 619 typedef double BinaryFPOperation(double x, double y); |
| 614 BinaryFPOperation* function = NULL; | 620 BinaryFPOperation* function = NULL; |
| 615 switch (operation) { | 621 switch (operation) { |
| 616 case Token::ADD: | 622 case Token::ADD: |
| 617 function = &add_two_doubles; | 623 function = &add_two_doubles; |
| 618 break; | 624 break; |
| 619 case Token::SUB: | 625 case Token::SUB: |
| 620 function = &sub_two_doubles; | 626 function = &sub_two_doubles; |
| 621 break; | 627 break; |
| 622 case Token::MUL: | 628 case Token::MUL: |
| 623 function = &mul_two_doubles; | 629 function = &mul_two_doubles; |
| 624 break; | 630 break; |
| 625 default: | 631 default: |
| 626 UNREACHABLE(); | 632 UNREACHABLE(); |
| 627 } | 633 } |
| 628 // Passing true as 2nd parameter indicates that they return an fp value. | 634 // Passing true as 2nd parameter indicates that they return an fp value. |
| 629 return ExternalReference(Redirect(FUNCTION_ADDR(function), true)); | 635 return ExternalReference(Redirect(FUNCTION_ADDR(function), true)); |
| 630 } | 636 } |
| 631 | 637 |
| 632 | 638 |
| 639 ExternalReference ExternalReference::compare_doubles() { |
| 640 return ExternalReference(Redirect(FUNCTION_ADDR(native_compare_doubles), |
| 641 false)); |
| 642 } |
| 643 |
| 644 |
| 633 ExternalReferenceRedirector* ExternalReference::redirector_ = NULL; | 645 ExternalReferenceRedirector* ExternalReference::redirector_ = NULL; |
| 634 | 646 |
| 635 | 647 |
| 636 #ifdef ENABLE_DEBUGGER_SUPPORT | 648 #ifdef ENABLE_DEBUGGER_SUPPORT |
| 637 ExternalReference ExternalReference::debug_break() { | 649 ExternalReference ExternalReference::debug_break() { |
| 638 return ExternalReference(Redirect(FUNCTION_ADDR(Debug::Break))); | 650 return ExternalReference(Redirect(FUNCTION_ADDR(Debug::Break))); |
| 639 } | 651 } |
| 640 | 652 |
| 641 | 653 |
| 642 ExternalReference ExternalReference::debug_step_in_fp_address() { | 654 ExternalReference ExternalReference::debug_step_in_fp_address() { |
| 643 return ExternalReference(Debug::step_in_fp_addr()); | 655 return ExternalReference(Debug::step_in_fp_addr()); |
| 644 } | 656 } |
| 645 #endif | 657 #endif |
| 646 | 658 |
| 647 } } // namespace v8::internal | 659 } } // namespace v8::internal |
| OLD | NEW |