Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(288)

Side by Side Diff: src/assembler.cc

Issue 8749002: Implement Math.pow using FPU instructions and inline it in crankshaft (ia32). (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Also do NaN/infinity check on base for TAGGED case. Created 9 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 1095 matching lines...) Expand 10 before | Expand all | Expand 10 after
1106 m *= m; 1106 m *= m;
1107 if ((n & 2) != 0) p *= m; 1107 if ((n & 2) != 0) p *= m;
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
1117 // been done in generated code before bailing out here.
1118 #if !defined(V8_TARGET_ARCH_IA32)
1116 int y_int = static_cast<int>(y); 1119 int y_int = static_cast<int>(y);
1117 if (y == y_int) { 1120 if (y == y_int) {
1118 return power_double_int(x, y_int); // Returns 1.0 for exponent 0. 1121 return power_double_int(x, y_int); // Returns 1.0 for exponent 0.
1119 } 1122 }
1120 if (!isinf(x)) { 1123 if (!isinf(x)) {
1121 if (y == 0.5) return sqrt(x + 0.0); // -0 must be converted to +0. 1124 if (y == 0.5) return sqrt(x + 0.0); // -0 must be converted to +0.
1122 if (y == -0.5) return 1.0 / sqrt(x + 0.0); 1125 if (y == -0.5) return 1.0 / sqrt(x + 0.0);
1123 } 1126 }
1127 #endif
1124 if (isnan(y) || ((x == 1 || x == -1) && isinf(y))) { 1128 if (isnan(y) || ((x == 1 || x == -1) && isinf(y))) {
1125 return OS::nan_value(); 1129 return OS::nan_value();
1126 } 1130 }
1127 return pow(x, y); 1131 return pow(x, y);
1128 } 1132 }
1129 1133
1130 1134
1131 ExternalReference ExternalReference::power_double_double_function( 1135 ExternalReference ExternalReference::power_double_double_function(
1132 Isolate* isolate) { 1136 Isolate* isolate) {
1133 return ExternalReference(Redirect(isolate, 1137 return ExternalReference(Redirect(isolate,
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
1261 assembler_->RecordRelocInfo(RelocInfo::POSITION, state_.current_position); 1265 assembler_->RecordRelocInfo(RelocInfo::POSITION, state_.current_position);
1262 state_.written_position = state_.current_position; 1266 state_.written_position = state_.current_position;
1263 written = true; 1267 written = true;
1264 } 1268 }
1265 1269
1266 // Return whether something was written. 1270 // Return whether something was written.
1267 return written; 1271 return written;
1268 } 1272 }
1269 1273
1270 } } // namespace v8::internal 1274 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/arm/full-codegen-arm.cc ('k') | src/code-stubs.h » ('j') | src/ia32/code-stubs-ia32.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698