| OLD | NEW |
| 1 // Copyright (c) 2011 Sun Microsystems Inc. | 1 // Copyright (c) 2011 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 1097 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1108 m *= m; | 1108 m *= m; |
| 1109 n >>= 2; | 1109 n >>= 2; |
| 1110 } | 1110 } |
| 1111 return p; | 1111 return p; |
| 1112 } | 1112 } |
| 1113 | 1113 |
| 1114 | 1114 |
| 1115 double power_double_double(double x, double y) { | 1115 double power_double_double(double x, double y) { |
| 1116 // The checks for special cases can be dropped in ia32 because it has already | 1116 // The checks for special cases can be dropped in ia32 because it has already |
| 1117 // been done in generated code before bailing out here. | 1117 // been done in generated code before bailing out here. |
| 1118 #if !defined(V8_TARGET_ARCH_IA32) | 1118 if (isnan(y) || ((x == 1 || x == -1) && isinf(y))) return OS::nan_value(); |
| 1119 int y_int = static_cast<int>(y); | |
| 1120 if (y == y_int) { | |
| 1121 return power_double_int(x, y_int); // Returns 1.0 for exponent 0. | |
| 1122 } | |
| 1123 if (!isinf(x)) { | |
| 1124 if (y == 0.5) return sqrt(x + 0.0); // -0 must be converted to +0. | |
| 1125 if (y == -0.5) return 1.0 / sqrt(x + 0.0); | |
| 1126 } | |
| 1127 #endif | |
| 1128 if (isnan(y) || ((x == 1 || x == -1) && isinf(y))) { | |
| 1129 return OS::nan_value(); | |
| 1130 } | |
| 1131 return pow(x, y); | 1119 return pow(x, y); |
| 1132 } | 1120 } |
| 1133 | 1121 |
| 1134 | 1122 |
| 1135 ExternalReference ExternalReference::power_double_double_function( | 1123 ExternalReference ExternalReference::power_double_double_function( |
| 1136 Isolate* isolate) { | 1124 Isolate* isolate) { |
| 1137 return ExternalReference(Redirect(isolate, | 1125 return ExternalReference(Redirect(isolate, |
| 1138 FUNCTION_ADDR(power_double_double), | 1126 FUNCTION_ADDR(power_double_double), |
| 1139 BUILTIN_FP_FP_CALL)); | 1127 BUILTIN_FP_FP_CALL)); |
| 1140 } | 1128 } |
| (...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1265 assembler_->RecordRelocInfo(RelocInfo::POSITION, state_.current_position); | 1253 assembler_->RecordRelocInfo(RelocInfo::POSITION, state_.current_position); |
| 1266 state_.written_position = state_.current_position; | 1254 state_.written_position = state_.current_position; |
| 1267 written = true; | 1255 written = true; |
| 1268 } | 1256 } |
| 1269 | 1257 |
| 1270 // Return whether something was written. | 1258 // Return whether something was written. |
| 1271 return written; | 1259 return written; |
| 1272 } | 1260 } |
| 1273 | 1261 |
| 1274 } } // namespace v8::internal | 1262 } } // namespace v8::internal |
| OLD | NEW |