| 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 535 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 546 #endif // DEBUG | 546 #endif // DEBUG |
| 547 | 547 |
| 548 | 548 |
| 549 // ----------------------------------------------------------------------------- | 549 // ----------------------------------------------------------------------------- |
| 550 // Implementation of ExternalReference | 550 // Implementation of ExternalReference |
| 551 | 551 |
| 552 ExternalReference::ExternalReference(Builtins::CFunctionId id) | 552 ExternalReference::ExternalReference(Builtins::CFunctionId id) |
| 553 : address_(Redirect(Builtins::c_function_address(id))) {} | 553 : address_(Redirect(Builtins::c_function_address(id))) {} |
| 554 | 554 |
| 555 | 555 |
| 556 ExternalReference::ExternalReference(ApiFunction* fun) | 556 ExternalReference::ExternalReference( |
| 557 : address_(Redirect(fun->address())) {} | 557 ApiFunction* fun, Type type = ExternalReference::BUILTIN_CALL) |
| 558 : address_(Redirect(fun->address(), type)) {} |
| 558 | 559 |
| 559 | 560 |
| 560 ExternalReference::ExternalReference(Builtins::Name name) | 561 ExternalReference::ExternalReference(Builtins::Name name) |
| 561 : address_(Isolate::Current()->builtins()->builtin_address(name)) {} | 562 : address_(Isolate::Current()->builtins()->builtin_address(name)) {} |
| 562 | 563 |
| 563 | 564 |
| 564 ExternalReference::ExternalReference(Runtime::FunctionId id) | 565 ExternalReference::ExternalReference(Runtime::FunctionId id) |
| 565 : address_(Redirect(Runtime::FunctionForId(id)->entry)) {} | 566 : address_(Redirect(Runtime::FunctionForId(id)->entry)) {} |
| 566 | 567 |
| 567 | 568 |
| (...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 846 return p; | 847 return p; |
| 847 } | 848 } |
| 848 | 849 |
| 849 | 850 |
| 850 double power_double_double(double x, double y) { | 851 double power_double_double(double x, double y) { |
| 851 int y_int = static_cast<int>(y); | 852 int y_int = static_cast<int>(y); |
| 852 if (y == y_int) { | 853 if (y == y_int) { |
| 853 return power_double_int(x, y_int); // Returns 1.0 for exponent 0. | 854 return power_double_int(x, y_int); // Returns 1.0 for exponent 0. |
| 854 } | 855 } |
| 855 if (!isinf(x)) { | 856 if (!isinf(x)) { |
| 856 if (y == 0.5) return sqrt(x); | 857 if (y == 0.5) return sqrt(x + 0.0); // -0 must be converted to +0. |
| 857 if (y == -0.5) return 1.0 / sqrt(x); | 858 if (y == -0.5) return 1.0 / sqrt(x + 0.0); |
| 858 } | 859 } |
| 859 if (isnan(y) || ((x == 1 || x == -1) && isinf(y))) { | 860 if (isnan(y) || ((x == 1 || x == -1) && isinf(y))) { |
| 860 return OS::nan_value(); | 861 return OS::nan_value(); |
| 861 } | 862 } |
| 862 return pow(x, y); | 863 return pow(x, y); |
| 863 } | 864 } |
| 864 | 865 |
| 865 | 866 |
| 866 ExternalReference ExternalReference::power_double_double_function() { | 867 ExternalReference ExternalReference::power_double_double_function() { |
| 867 return ExternalReference(Redirect(FUNCTION_ADDR(power_double_double))); | 868 return ExternalReference(Redirect(FUNCTION_ADDR(power_double_double))); |
| (...skipping 28 matching lines...) Expand all Loading... |
| 896 case Token::DIV: | 897 case Token::DIV: |
| 897 function = &div_two_doubles; | 898 function = &div_two_doubles; |
| 898 break; | 899 break; |
| 899 case Token::MOD: | 900 case Token::MOD: |
| 900 function = &mod_two_doubles; | 901 function = &mod_two_doubles; |
| 901 break; | 902 break; |
| 902 default: | 903 default: |
| 903 UNREACHABLE(); | 904 UNREACHABLE(); |
| 904 } | 905 } |
| 905 // Passing true as 2nd parameter indicates that they return an fp value. | 906 // Passing true as 2nd parameter indicates that they return an fp value. |
| 906 return ExternalReference(Redirect(FUNCTION_ADDR(function), true)); | 907 return ExternalReference(Redirect(FUNCTION_ADDR(function), FP_RETURN_CALL)); |
| 907 } | 908 } |
| 908 | 909 |
| 909 | 910 |
| 910 ExternalReference ExternalReference::compare_doubles() { | 911 ExternalReference ExternalReference::compare_doubles() { |
| 911 return ExternalReference(Redirect(FUNCTION_ADDR(native_compare_doubles), | 912 return ExternalReference(Redirect(FUNCTION_ADDR(native_compare_doubles), |
| 912 false)); | 913 BUILTIN_CALL)); |
| 913 } | 914 } |
| 914 | 915 |
| 915 | 916 |
| 916 #ifdef ENABLE_DEBUGGER_SUPPORT | 917 #ifdef ENABLE_DEBUGGER_SUPPORT |
| 917 ExternalReference ExternalReference::debug_break() { | 918 ExternalReference ExternalReference::debug_break() { |
| 918 return ExternalReference(Redirect(FUNCTION_ADDR(Debug::Break))); | 919 return ExternalReference(Redirect(FUNCTION_ADDR(Debug::Break))); |
| 919 } | 920 } |
| 920 | 921 |
| 921 | 922 |
| 922 ExternalReference ExternalReference::debug_step_in_fp_address() { | 923 ExternalReference ExternalReference::debug_step_in_fp_address() { |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 970 assembler_->RecordRelocInfo(RelocInfo::POSITION, state_.current_position); | 971 assembler_->RecordRelocInfo(RelocInfo::POSITION, state_.current_position); |
| 971 state_.written_position = state_.current_position; | 972 state_.written_position = state_.current_position; |
| 972 written = true; | 973 written = true; |
| 973 } | 974 } |
| 974 | 975 |
| 975 // Return whether something was written. | 976 // Return whether something was written. |
| 976 return written; | 977 return written; |
| 977 } | 978 } |
| 978 | 979 |
| 979 } } // namespace v8::internal | 980 } } // namespace v8::internal |
| OLD | NEW |